| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 virtual void OnEncoderImplementationName(const char* implementation_name) {} | 65 virtual void OnEncoderImplementationName(const char* implementation_name) {} |
| 66 | 66 |
| 67 protected: | 67 protected: |
| 68 virtual ~VCMPacketizationCallback() { | 68 virtual ~VCMPacketizationCallback() {} |
| 69 } | |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 // Callback class used for passing decoded frames which are ready to be rendered
. | 71 // Callback class used for passing decoded frames which are ready to be |
| 72 // rendered. |
| 73 class VCMReceiveCallback { | 73 class VCMReceiveCallback { |
| 74 public: | 74 public: |
| 75 virtual int32_t FrameToRender(VideoFrame& videoFrame) = 0; | 75 virtual int32_t FrameToRender(VideoFrame& videoFrame) = 0; // NOLINT |
| 76 virtual int32_t ReceivedDecodedReferenceFrame( | 76 virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) { |
| 77 const uint64_t pictureId) { | |
| 78 return -1; | 77 return -1; |
| 79 } | 78 } |
| 80 // Called when the current receive codec changes. | 79 // Called when the current receive codec changes. |
| 81 virtual void OnIncomingPayloadType(int payload_type) {} | 80 virtual void OnIncomingPayloadType(int payload_type) {} |
| 82 virtual void OnDecoderImplementationName(const char* implementation_name) {} | 81 virtual void OnDecoderImplementationName(const char* implementation_name) {} |
| 83 | 82 |
| 84 protected: | 83 protected: |
| 85 virtual ~VCMReceiveCallback() { | 84 virtual ~VCMReceiveCallback() {} |
| 86 } | |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 // Callback class used for informing the user of the bit rate and frame rate pro
duced by the | 87 // Callback class used for informing the user of the bit rate and frame rate |
| 88 // produced by the |
| 90 // encoder. | 89 // encoder. |
| 91 class VCMSendStatisticsCallback { | 90 class VCMSendStatisticsCallback { |
| 92 public: | 91 public: |
| 93 virtual int32_t SendStatistics(const uint32_t bitRate, | 92 virtual int32_t SendStatistics(const uint32_t bitRate, |
| 94 const uint32_t frameRate) = 0; | 93 const uint32_t frameRate) = 0; |
| 95 | 94 |
| 96 protected: | 95 protected: |
| 97 virtual ~VCMSendStatisticsCallback() { | 96 virtual ~VCMSendStatisticsCallback() {} |
| 98 } | |
| 99 }; | 97 }; |
| 100 | 98 |
| 101 // Callback class used for informing the user of the incoming bit rate and frame
rate. | 99 // Callback class used for informing the user of the incoming bit rate and frame |
| 100 // rate. |
| 102 class VCMReceiveStatisticsCallback { | 101 class VCMReceiveStatisticsCallback { |
| 103 public: | 102 public: |
| 104 virtual void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) = 0; | 103 virtual void OnReceiveRatesUpdated(uint32_t bitRate, uint32_t frameRate) = 0; |
| 105 virtual void OnDiscardedPacketsUpdated(int discarded_packets) = 0; | 104 virtual void OnDiscardedPacketsUpdated(int discarded_packets) = 0; |
| 106 virtual void OnFrameCountsUpdated(const FrameCounts& frame_counts) = 0; | 105 virtual void OnFrameCountsUpdated(const FrameCounts& frame_counts) = 0; |
| 107 | 106 |
| 108 protected: | 107 protected: |
| 109 virtual ~VCMReceiveStatisticsCallback() { | 108 virtual ~VCMReceiveStatisticsCallback() {} |
| 110 } | |
| 111 }; | 109 }; |
| 112 | 110 |
| 113 // Callback class used for informing the user of decode timing info. | 111 // Callback class used for informing the user of decode timing info. |
| 114 class VCMDecoderTimingCallback { | 112 class VCMDecoderTimingCallback { |
| 115 public: | 113 public: |
| 116 virtual void OnDecoderTiming(int decode_ms, | 114 virtual void OnDecoderTiming(int decode_ms, |
| 117 int max_decode_ms, | 115 int max_decode_ms, |
| 118 int current_delay_ms, | 116 int current_delay_ms, |
| 119 int target_delay_ms, | 117 int target_delay_ms, |
| 120 int jitter_buffer_ms, | 118 int jitter_buffer_ms, |
| 121 int min_playout_delay_ms, | 119 int min_playout_delay_ms, |
| 122 int render_delay_ms) = 0; | 120 int render_delay_ms) = 0; |
| 123 | 121 |
| 124 protected: | 122 protected: |
| 125 virtual ~VCMDecoderTimingCallback() {} | 123 virtual ~VCMDecoderTimingCallback() {} |
| 126 }; | 124 }; |
| 127 | 125 |
| 128 // Callback class used for telling the user about how to configure the FEC, | 126 // Callback class used for telling the user about how to configure the FEC, |
| 129 // and the rates sent the last second is returned to the VCM. | 127 // and the rates sent the last second is returned to the VCM. |
| 130 class VCMProtectionCallback { | 128 class VCMProtectionCallback { |
| 131 public: | 129 public: |
| 132 virtual int ProtectionRequest(const FecProtectionParams* delta_params, | 130 virtual int ProtectionRequest(const FecProtectionParams* delta_params, |
| 133 const FecProtectionParams* key_params, | 131 const FecProtectionParams* key_params, |
| 134 uint32_t* sent_video_rate_bps, | 132 uint32_t* sent_video_rate_bps, |
| 135 uint32_t* sent_nack_rate_bps, | 133 uint32_t* sent_nack_rate_bps, |
| 136 uint32_t* sent_fec_rate_bps) = 0; | 134 uint32_t* sent_fec_rate_bps) = 0; |
| 137 | 135 |
| 138 protected: | 136 protected: |
| 139 virtual ~VCMProtectionCallback() { | 137 virtual ~VCMProtectionCallback() {} |
| 140 } | |
| 141 }; | 138 }; |
| 142 | 139 |
| 143 class VideoEncoderRateObserver { | 140 class VideoEncoderRateObserver { |
| 144 public: | 141 public: |
| 145 virtual ~VideoEncoderRateObserver() {} | 142 virtual ~VideoEncoderRateObserver() {} |
| 146 virtual void OnSetRates(uint32_t bitrate_bps, int framerate) = 0; | 143 virtual void OnSetRates(uint32_t bitrate_bps, int framerate) = 0; |
| 147 }; | 144 }; |
| 148 | 145 |
| 149 // Callback class used for telling the user about what frame type needed to cont
inue decoding. | 146 // Callback class used for telling the user about what frame type needed to |
| 147 // continue decoding. |
| 150 // Typically a key frame when the stream has been corrupted in some way. | 148 // Typically a key frame when the stream has been corrupted in some way. |
| 151 class VCMFrameTypeCallback { | 149 class VCMFrameTypeCallback { |
| 152 public: | 150 public: |
| 153 virtual int32_t RequestKeyFrame() = 0; | 151 virtual int32_t RequestKeyFrame() = 0; |
| 154 virtual int32_t SliceLossIndicationRequest( | 152 virtual int32_t SliceLossIndicationRequest(const uint64_t pictureId) { |
| 155 const uint64_t pictureId) { | |
| 156 return -1; | 153 return -1; |
| 157 } | 154 } |
| 158 | 155 |
| 159 protected: | 156 protected: |
| 160 virtual ~VCMFrameTypeCallback() { | 157 virtual ~VCMFrameTypeCallback() {} |
| 161 } | |
| 162 }; | 158 }; |
| 163 | 159 |
| 164 // Callback class used for telling the user about which packet sequence numbers
are currently | 160 // Callback class used for telling the user about which packet sequence numbers |
| 161 // are currently |
| 165 // missing and need to be resent. | 162 // missing and need to be resent. |
| 166 class VCMPacketRequestCallback { | 163 class VCMPacketRequestCallback { |
| 167 public: | 164 public: |
| 168 virtual int32_t ResendPackets(const uint16_t* sequenceNumbers, | 165 virtual int32_t ResendPackets(const uint16_t* sequenceNumbers, |
| 169 uint16_t length) = 0; | 166 uint16_t length) = 0; |
| 170 | 167 |
| 171 protected: | 168 protected: |
| 172 virtual ~VCMPacketRequestCallback() { | 169 virtual ~VCMPacketRequestCallback() {} |
| 173 } | |
| 174 }; | 170 }; |
| 175 | 171 |
| 176 // Callback used to inform the user of the the desired resolution | 172 // Callback used to inform the user of the the desired resolution |
| 177 // as subscribed by Media Optimization (Quality Modes) | 173 // as subscribed by Media Optimization (Quality Modes) |
| 178 class VCMQMSettingsCallback { | 174 class VCMQMSettingsCallback { |
| 179 public: | 175 public: |
| 180 virtual int32_t SetVideoQMSettings(const uint32_t frameRate, | 176 virtual int32_t SetVideoQMSettings(const uint32_t frameRate, |
| 181 const uint32_t width, | 177 const uint32_t width, |
| 182 const uint32_t height) = 0; | 178 const uint32_t height) = 0; |
| 183 | 179 |
| 184 virtual void SetTargetFramerate(int frame_rate) = 0; | 180 virtual void SetTargetFramerate(int frame_rate) = 0; |
| 185 | 181 |
| 186 protected: | 182 protected: |
| 187 virtual ~VCMQMSettingsCallback() { | 183 virtual ~VCMQMSettingsCallback() {} |
| 188 } | |
| 189 }; | 184 }; |
| 190 | 185 |
| 191 // Callback class used for telling the user about the size (in time) of the | 186 // Callback class used for telling the user about the size (in time) of the |
| 192 // render buffer, that is the size in time of the complete continuous frames. | 187 // render buffer, that is the size in time of the complete continuous frames. |
| 193 class VCMRenderBufferSizeCallback { | 188 class VCMRenderBufferSizeCallback { |
| 194 public: | 189 public: |
| 195 virtual void RenderBufferSizeMs(int buffer_size_ms) = 0; | 190 virtual void RenderBufferSizeMs(int buffer_size_ms) = 0; |
| 196 | 191 |
| 197 protected: | 192 protected: |
| 198 virtual ~VCMRenderBufferSizeCallback() { | 193 virtual ~VCMRenderBufferSizeCallback() {} |
| 199 } | |
| 200 }; | 194 }; |
| 201 | 195 |
| 202 } // namespace webrtc | 196 } // namespace webrtc |
| 203 | 197 |
| 204 #endif // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ | 198 #endif // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODING_DEFINES_H_ |
| OLD | NEW |