tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

video_decoder.cc (2091B)


      1 /*
      2 *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #include "api/video_codecs/video_decoder.h"
     12 
     13 #include <cstdint>
     14 #include <optional>
     15 #include <string>
     16 
     17 #include "api/video/video_frame.h"
     18 #include "rtc_base/checks.h"
     19 #include "rtc_base/strings/string_builder.h"
     20 
     21 namespace webrtc {
     22 
     23 int32_t DecodedImageCallback::Decoded(VideoFrame& decodedImage,
     24                                      int64_t /* decode_time_ms */) {
     25  // The default implementation ignores custom decode time value.
     26  return Decoded(decodedImage);
     27 }
     28 
     29 void DecodedImageCallback::Decoded(VideoFrame& decodedImage,
     30                                   std::optional<int32_t> decode_time_ms,
     31                                   std::optional<uint8_t> /* qp */) {
     32  Decoded(decodedImage, decode_time_ms.value_or(-1));
     33 }
     34 
     35 VideoDecoder::DecoderInfo VideoDecoder::GetDecoderInfo() const {
     36  DecoderInfo info;
     37  info.implementation_name = ImplementationName();
     38  return info;
     39 }
     40 
     41 const char* VideoDecoder::ImplementationName() const {
     42  return "unknown";
     43 }
     44 
     45 std::string VideoDecoder::DecoderInfo::ToString() const {
     46  char string_buf[2048];
     47  SimpleStringBuilder oss(string_buf);
     48 
     49  oss << "DecoderInfo { "
     50      << "prefers_late_decoding = " << "implementation_name = '"
     51      << implementation_name << "', " << "is_hardware_accelerated = "
     52      << (is_hardware_accelerated ? "true" : "false") << " }";
     53  return oss.str();
     54 }
     55 
     56 bool VideoDecoder::DecoderInfo::operator==(const DecoderInfo& rhs) const {
     57  return is_hardware_accelerated == rhs.is_hardware_accelerated &&
     58         implementation_name == rhs.implementation_name;
     59 }
     60 
     61 void VideoDecoder::Settings::set_number_of_cores(int value) {
     62  RTC_DCHECK_GT(value, 0);
     63  number_of_cores_ = value;
     64 }
     65 
     66 }  // namespace webrtc