tor-browser

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

video_coding_defines.h (3033B)


      1 /*
      2 *  Copyright (c) 2012 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 #ifndef MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_
     12 #define MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_
     13 
     14 #include <stddef.h>
     15 #include <stdint.h>
     16 
     17 #include <optional>
     18 
     19 #include "api/units/time_delta.h"
     20 #include "api/video/video_content_type.h"
     21 #include "api/video/video_frame.h"
     22 #include "api/video/video_frame_type.h"
     23 #include "api/video_codecs/video_decoder.h"
     24 
     25 namespace webrtc {
     26 
     27 // Error codes
     28 #define VCM_FRAME_NOT_READY 3
     29 #define VCM_MISSING_CALLBACK 1
     30 #define VCM_OK 0
     31 #define VCM_GENERAL_ERROR -1
     32 #define VCM_PARAMETER_ERROR -4
     33 #define VCM_NO_CODEC_REGISTERED -8
     34 #define VCM_JITTER_BUFFER_ERROR -9
     35 
     36 enum {
     37  // Timing frames settings. Timing frames are sent every
     38  // `kDefaultTimingFramesDelayMs`, or if the frame is at least
     39  // `kDefaultOutlierFrameSizePercent` in size of average frame.
     40  kDefaultTimingFramesDelayMs = 200,
     41  kDefaultOutlierFrameSizePercent = 500,
     42  // Maximum number of frames for what we store encode start timing information.
     43  kMaxEncodeStartTimeListSize = 150,
     44 };
     45 
     46 enum VCMVideoProtection {
     47  kProtectionNack,
     48  kProtectionNackFEC,
     49 };
     50 
     51 // Callback class used for passing decoded frames which are ready to be
     52 // rendered.
     53 class VCMReceiveCallback {
     54 public:
     55  struct FrameToRender {
     56    VideoFrame& video_frame;
     57    std::optional<uint8_t> qp;
     58    TimeDelta decode_time;
     59    VideoContentType content_type;
     60    VideoFrameType frame_type;
     61  };
     62 
     63  virtual int32_t OnFrameToRender(const FrameToRender& arguments) = 0;
     64 
     65  virtual void OnDroppedFrames(uint32_t frames_dropped);
     66 
     67  // Called when the current receive codec changes.
     68  virtual void OnIncomingPayloadType(int payload_type);
     69  virtual void OnDecoderInfoChanged(
     70      const VideoDecoder::DecoderInfo& decoder_info);
     71 
     72 protected:
     73  virtual ~VCMReceiveCallback() {}
     74 };
     75 
     76 // Callback class used for telling the user about what frame type needed to
     77 // continue decoding.
     78 // Typically a key frame when the stream has been corrupted in some way.
     79 class VCMFrameTypeCallback {
     80 public:
     81  virtual int32_t RequestKeyFrame() = 0;
     82 
     83 protected:
     84  virtual ~VCMFrameTypeCallback() {}
     85 };
     86 
     87 // Callback class used for telling the user about which packet sequence numbers
     88 // are currently
     89 // missing and need to be resent.
     90 // TODO(philipel): Deprecate VCMPacketRequestCallback
     91 //                 and use NackSender instead.
     92 class VCMPacketRequestCallback {
     93 public:
     94  virtual int32_t ResendPackets(const uint16_t* sequenceNumbers,
     95                                uint16_t length) = 0;
     96 
     97 protected:
     98  virtual ~VCMPacketRequestCallback() {}
     99 };
    100 
    101 }  // namespace webrtc
    102 
    103 #endif  // MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_