| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ |
| 12 #define WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ |
| 13 | 13 |
| 14 #include "webrtc/modules/include/module_common_types.h" | 14 #include "webrtc/modules/include/module_common_types.h" |
| 15 #include "webrtc/typedefs.h" | 15 #include "webrtc/typedefs.h" |
| 16 #include "webrtc/video_frame.h" | 16 #include "webrtc/video_frame.h" |
| 17 | 17 |
| 18 namespace webrtc { | 18 namespace webrtc { |
| 19 | 19 |
| 20 // Error codes | 20 // Error codes |
| 21 #define VCM_FRAME_NOT_READY 3 | 21 #define VCM_FRAME_NOT_READY 3 |
| 22 #define VCM_REQUEST_SLI 2 | 22 #define VCM_REQUEST_SLI 2 |
| 23 #define VCM_MISSING_CALLBACK 1 | 23 #define VCM_MISSING_CALLBACK 1 |
| 24 #define VCM_OK 0 | 24 #define VCM_OK 0 |
| 25 #define VCM_GENERAL_ERROR -1 | 25 #define VCM_GENERAL_ERROR -1 |
| 26 #define VCM_LEVEL_EXCEEDED -2 | 26 #define VCM_LEVEL_EXCEEDED -2 |
| 27 #define VCM_MEMORY -3 | 27 #define VCM_MEMORY -3 |
| 28 #define VCM_PARAMETER_ERROR -4 | 28 #define VCM_PARAMETER_ERROR -4 |
| 29 #define VCM_UNKNOWN_PAYLOAD -5 | 29 #define VCM_UNKNOWN_PAYLOAD -5 |
| 30 #define VCM_CODEC_ERROR -6 | 30 #define VCM_CODEC_ERROR -6 |
| 31 #define VCM_UNINITIALIZED -7 | 31 #define VCM_UNINITIALIZED -7 |
| 32 #define VCM_NO_CODEC_REGISTERED -8 | 32 #define VCM_NO_CODEC_REGISTERED -8 |
| 33 #define VCM_JITTER_BUFFER_ERROR -9 | 33 #define VCM_JITTER_BUFFER_ERROR -9 |
| 34 #define VCM_OLD_PACKET_ERROR -10 | 34 #define VCM_OLD_PACKET_ERROR -10 |
| 35 #define VCM_NO_FRAME_DECODED -11 | 35 #define VCM_NO_FRAME_DECODED -11 |
| 36 #define VCM_ERROR_REQUEST_SLI -12 | 36 #define VCM_ERROR_REQUEST_SLI -12 |
| 37 #define VCM_NOT_IMPLEMENTED -20 | 37 #define VCM_NOT_IMPLEMENTED -20 |
| 38 | 38 |
| 39 enum { kDefaultStartBitrateKbps = 300 }; | 39 enum { kDefaultStartBitrateKbps = 300 }; |
| 40 | 40 |
| 41 enum VCMVideoProtection { | 41 enum VCMVideoProtection { |
| 42 kProtectionNone, | 42 kProtectionNone, |
| 43 kProtectionNack, | 43 kProtectionNack, |
| 44 kProtectionFEC, | 44 kProtectionFEC, |
| 45 kProtectionNackFEC, | 45 kProtectionNackFEC, |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 enum VCMTemporalDecimation { | 48 enum VCMTemporalDecimation { |
| 49 kBitrateOverUseDecimation, | 49 kBitrateOverUseDecimation, |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 struct VCMFrameCount { | 52 struct VCMFrameCount { |
| 53 uint32_t numKeyFrames; | 53 uint32_t numKeyFrames; |
| 54 uint32_t numDeltaFrames; | 54 uint32_t numDeltaFrames; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // Callback class used for sending data ready to be packetized | 57 // Callback class used for sending data ready to be packetized |
| 58 class VCMPacketizationCallback { | 58 class VCMPacketizationCallback { |
| 59 public: | 59 public: |
| 60 virtual int32_t SendData(uint8_t payloadType, | 60 virtual int32_t SendData(uint8_t payloadType, |
| 61 const EncodedImage& encoded_image, | 61 const EncodedImage& encoded_image, |
| 62 const RTPFragmentationHeader& fragmentationHeader, | 62 const RTPFragmentationHeader& fragmentationHeader, |
| 63 const RTPVideoHeader* rtpVideoHdr) = 0; | 63 const RTPVideoHeader* rtpVideoHdr) = 0; |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 virtual ~VCMPacketizationCallback() { | 66 virtual ~VCMPacketizationCallback() {} |
| 67 } | |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 // Callback class used for passing decoded frames which are ready to be rendered
. | 69 // Callback class used for passing decoded frames which are ready to be |
| 70 // rendered. |
| 71 class VCMReceiveCallback { | 71 class VCMReceiveCallback { |
| 72 public: | 72 public: |
| 73 virtual int32_t FrameToRender(VideoFrame& videoFrame) = 0; | 73 virtual int32_t FrameToRender(VideoFrame& videoFrame) = 0; // NOLINT |
| 74 virtual int32_t ReceivedDecodedReferenceFrame( | 74 virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) { |
| 75 const uint64_t pictureId) { | |
| 76 return -1; | 75 return -1; |
| 77 } | 76 } |
| 78 // Called when the current receive codec changes. | 77 // Called when the current receive codec changes. |
| 79 virtual void OnIncomingPayloadType(int payload_type) {} | 78 virtual void OnIncomingPayloadType(int payload_type) {} |
| 80 | 79 |
| 81 protected: | 80 protected: |
| 82 virtual ~VCMReceiveCallback() { | 81 virtual ~VCMReceiveCallback() {} |
| 83 } | |
| 84 }; | 82 }; |
| 85 | 83 |
| 86 // Callback class used for informing the user of the bit rate and frame rate pro
duced by the | 84 // Callback class used for informing the user of the bit rate and frame rate |
| 85 // produced by the |
| 87 // encoder. | 86 // encoder. |
| 88 class VCMSendStatisticsCallback { | 87 class VCMSendStatisticsCallback { |
| 89 public: | 88 public: |
| 90 virtual int32_t SendStatistics(const uint32_t bitRate, | 89 virtual int32_t SendStatistics(const uint32_t bitRate, |
| 91 const uint32_t frameRate) = 0; | 90 const uint32_t frameRate) = 0; |
| 92 | 91 |
| 93 protected: | 92 protected: |
| 94 virtual ~VCMSendStatisticsCallback() { | 93 virtual ~VCMSendStatisticsCallback() {} |
| 95 } | |
| 96 }; | 94 }; |
| 97 | 95 |
| 98 // Callback class used for informing the user of the incoming bit rate and frame
rate. | 96 // Callback class used for informing the user of the incoming bit rate and frame |
| 97 // rate. |
| 99 class VCMReceiveStatisticsCallback { | 98 class VCMReceiveStatisticsCallback { |
| 100 public: | 99 public: |
| 101 virtual void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) = 0; | 100 virtual void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) = 0; |
| 102 virtual void OnDiscardedPacketsUpdated(int discarded_packets) = 0; | 101 virtual void OnDiscardedPacketsUpdated(int discarded_packets) = 0; |
| 103 virtual void OnFrameCountsUpdated(const FrameCounts& frame_counts) = 0; | 102 virtual void OnFrameCountsUpdated(const FrameCounts& frame_counts) = 0; |
| 104 | 103 |
| 105 protected: | 104 protected: |
| 106 virtual ~VCMReceiveStatisticsCallback() { | 105 virtual ~VCMReceiveStatisticsCallback() {} |
| 107 } | |
| 108 }; | 106 }; |
| 109 | 107 |
| 110 // Callback class used for informing the user of decode timing info. | 108 // Callback class used for informing the user of decode timing info. |
| 111 class VCMDecoderTimingCallback { | 109 class VCMDecoderTimingCallback { |
| 112 public: | 110 public: |
| 113 virtual void OnDecoderTiming(int decode_ms, | 111 virtual void OnDecoderTiming(int decode_ms, |
| 114 int max_decode_ms, | 112 int max_decode_ms, |
| 115 int current_delay_ms, | 113 int current_delay_ms, |
| 116 int target_delay_ms, | 114 int target_delay_ms, |
| 117 int jitter_buffer_ms, | 115 int jitter_buffer_ms, |
| 118 int min_playout_delay_ms, | 116 int min_playout_delay_ms, |
| 119 int render_delay_ms) = 0; | 117 int render_delay_ms) = 0; |
| 120 | 118 |
| 121 protected: | 119 protected: |
| 122 virtual ~VCMDecoderTimingCallback() {} | 120 virtual ~VCMDecoderTimingCallback() {} |
| 123 }; | 121 }; |
| 124 | 122 |
| 125 // Callback class used for telling the user about how to configure the FEC, | 123 // Callback class used for telling the user about how to configure the FEC, |
| 126 // and the rates sent the last second is returned to the VCM. | 124 // and the rates sent the last second is returned to the VCM. |
| 127 class VCMProtectionCallback { | 125 class VCMProtectionCallback { |
| 128 public: | 126 public: |
| 129 virtual int ProtectionRequest(const FecProtectionParams* delta_params, | 127 virtual int ProtectionRequest(const FecProtectionParams* delta_params, |
| 130 const FecProtectionParams* key_params, | 128 const FecProtectionParams* key_params, |
| 131 uint32_t* sent_video_rate_bps, | 129 uint32_t* sent_video_rate_bps, |
| 132 uint32_t* sent_nack_rate_bps, | 130 uint32_t* sent_nack_rate_bps, |
| 133 uint32_t* sent_fec_rate_bps) = 0; | 131 uint32_t* sent_fec_rate_bps) = 0; |
| 134 | 132 |
| 135 protected: | 133 protected: |
| 136 virtual ~VCMProtectionCallback() { | 134 virtual ~VCMProtectionCallback() {} |
| 137 } | |
| 138 }; | 135 }; |
| 139 | 136 |
| 140 class VideoEncoderRateObserver { | 137 class VideoEncoderRateObserver { |
| 141 public: | 138 public: |
| 142 virtual ~VideoEncoderRateObserver() {} | 139 virtual ~VideoEncoderRateObserver() {} |
| 143 virtual void OnSetRates(uint32_t bitrate_bps, int framerate) = 0; | 140 virtual void OnSetRates(uint32_t bitrate_bps, int framerate) = 0; |
| 144 }; | 141 }; |
| 145 | 142 |
| 146 // Callback class used for telling the user about what frame type needed to cont
inue decoding. | 143 // Callback class used for telling the user about what frame type needed to |
| 144 // continue decoding. |
| 147 // Typically a key frame when the stream has been corrupted in some way. | 145 // Typically a key frame when the stream has been corrupted in some way. |
| 148 class VCMFrameTypeCallback { | 146 class VCMFrameTypeCallback { |
| 149 public: | 147 public: |
| 150 virtual int32_t RequestKeyFrame() = 0; | 148 virtual int32_t RequestKeyFrame() = 0; |
| 151 virtual int32_t SliceLossIndicationRequest( | 149 virtual int32_t SliceLossIndicationRequest(const uint64_t pictureId) { |
| 152 const uint64_t pictureId) { | |
| 153 return -1; | 150 return -1; |
| 154 } | 151 } |
| 155 | 152 |
| 156 protected: | 153 protected: |
| 157 virtual ~VCMFrameTypeCallback() { | 154 virtual ~VCMFrameTypeCallback() {} |
| 158 } | |
| 159 }; | 155 }; |
| 160 | 156 |
| 161 // Callback class used for telling the user about which packet sequence numbers
are currently | 157 // Callback class used for telling the user about which packet sequence numbers |
| 158 // are currently |
| 162 // missing and need to be resent. | 159 // missing and need to be resent. |
| 163 class VCMPacketRequestCallback { | 160 class VCMPacketRequestCallback { |
| 164 public: | 161 public: |
| 165 virtual int32_t ResendPackets(const uint16_t* sequenceNumbers, | 162 virtual int32_t ResendPackets(const uint16_t* sequenceNumbers, |
| 166 uint16_t length) = 0; | 163 uint16_t length) = 0; |
| 167 | 164 |
| 168 protected: | 165 protected: |
| 169 virtual ~VCMPacketRequestCallback() { | 166 virtual ~VCMPacketRequestCallback() {} |
| 170 } | |
| 171 }; | 167 }; |
| 172 | 168 |
| 173 // Callback used to inform the user of the the desired resolution | 169 // Callback used to inform the user of the the desired resolution |
| 174 // as subscribed by Media Optimization (Quality Modes) | 170 // as subscribed by Media Optimization (Quality Modes) |
| 175 class VCMQMSettingsCallback { | 171 class VCMQMSettingsCallback { |
| 176 public: | 172 public: |
| 177 virtual int32_t SetVideoQMSettings(const uint32_t frameRate, | 173 virtual int32_t SetVideoQMSettings(const uint32_t frameRate, |
| 178 const uint32_t width, | 174 const uint32_t width, |
| 179 const uint32_t height) = 0; | 175 const uint32_t height) = 0; |
| 180 | 176 |
| 181 virtual void SetTargetFramerate(int frame_rate) = 0; | 177 virtual void SetTargetFramerate(int frame_rate) = 0; |
| 182 | 178 |
| 183 protected: | 179 protected: |
| 184 virtual ~VCMQMSettingsCallback() { | 180 virtual ~VCMQMSettingsCallback() {} |
| 185 } | |
| 186 }; | 181 }; |
| 187 | 182 |
| 188 // Callback class used for telling the user about the size (in time) of the | 183 // Callback class used for telling the user about the size (in time) of the |
| 189 // render buffer, that is the size in time of the complete continuous frames. | 184 // render buffer, that is the size in time of the complete continuous frames. |
| 190 class VCMRenderBufferSizeCallback { | 185 class VCMRenderBufferSizeCallback { |
| 191 public: | 186 public: |
| 192 virtual void RenderBufferSizeMs(int buffer_size_ms) = 0; | 187 virtual void RenderBufferSizeMs(int buffer_size_ms) = 0; |
| 193 | 188 |
| 194 protected: | 189 protected: |
| 195 virtual ~VCMRenderBufferSizeCallback() { | 190 virtual ~VCMRenderBufferSizeCallback() {} |
| 196 } | |
| 197 }; | 191 }; |
| 198 | 192 |
| 199 } // namespace webrtc | 193 } // namespace webrtc |
| 200 | 194 |
| 201 #endif // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ | 195 #endif // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ |
| OLD | NEW |