2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
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.
11 #ifndef WEBRTC_MODULES_INTERFACE_VIDEO_CODING_DEFINES_H_
12 #define WEBRTC_MODULES_INTERFACE_VIDEO_CODING_DEFINES_H_
14 #include "webrtc/common_video/interface/i420_video_frame.h"
15 #include "webrtc/modules/interface/module_common_types.h"
16 #include "webrtc/typedefs.h"
21 #define VCM_FRAME_NOT_READY 3
22 #define VCM_REQUEST_SLI 2
23 #define VCM_MISSING_CALLBACK 1
25 #define VCM_GENERAL_ERROR -1
26 #define VCM_LEVEL_EXCEEDED -2
28 #define VCM_PARAMETER_ERROR -4
29 #define VCM_UNKNOWN_PAYLOAD -5
30 #define VCM_CODEC_ERROR -6
31 #define VCM_UNINITIALIZED -7
32 #define VCM_NO_CODEC_REGISTERED -8
33 #define VCM_JITTER_BUFFER_ERROR -9
34 #define VCM_OLD_PACKET_ERROR -10
35 #define VCM_NO_FRAME_DECODED -11
36 #define VCM_ERROR_REQUEST_SLI -12
37 #define VCM_NOT_IMPLEMENTED -20
39 #define VCM_RED_PAYLOAD_TYPE 96
40 #define VCM_ULPFEC_PAYLOAD_TYPE 97
41 #define VCM_VP8_PAYLOAD_TYPE 100
42 #define VCM_VP9_PAYLOAD_TYPE 101
43 #define VCM_I420_PAYLOAD_TYPE 124
44 #define VCM_H264_PAYLOAD_TYPE 127
46 enum { kDefaultStartBitrateKbps = 300 };
48 enum VCMVideoProtection {
49 kProtectionNack, // Both send-side and receive-side
50 kProtectionNackSender, // Send-side only
51 kProtectionNackReceiver, // Receive-side only
52 kProtectionDualDecoder,
56 kProtectionKeyOnKeyLoss,
57 kProtectionPeriodicKeyFrames
60 enum VCMTemporalDecimation {
61 kBitrateOverUseDecimation,
64 struct VCMFrameCount {
65 uint32_t numKeyFrames;
66 uint32_t numDeltaFrames;
69 // Callback class used for sending data ready to be packetized
70 class VCMPacketizationCallback {
72 virtual int32_t SendData(
76 int64_t capture_time_ms,
77 const uint8_t* payloadData,
79 const RTPFragmentationHeader& fragmentationHeader,
80 const RTPVideoHeader* rtpVideoHdr) = 0;
82 virtual ~VCMPacketizationCallback() {
86 // Callback class used for passing decoded frames which are ready to be rendered.
87 class VCMReceiveCallback {
89 virtual int32_t FrameToRender(I420VideoFrame& videoFrame) = 0;
90 virtual int32_t ReceivedDecodedReferenceFrame(
91 const uint64_t pictureId) {
94 // Called when the current receive codec changes.
95 virtual void IncomingCodecChanged(const VideoCodec& codec) {}
98 virtual ~VCMReceiveCallback() {
102 // Callback class used for informing the user of the bit rate and frame rate produced by the
104 class VCMSendStatisticsCallback {
106 virtual int32_t SendStatistics(const uint32_t bitRate,
107 const uint32_t frameRate) = 0;
110 virtual ~VCMSendStatisticsCallback() {
114 // Callback class used for informing the user of the incoming bit rate and frame rate.
115 class VCMReceiveStatisticsCallback {
117 virtual int32_t OnReceiveStatisticsUpdate(const uint32_t bitRate,
118 const uint32_t frameRate) = 0;
121 virtual ~VCMReceiveStatisticsCallback() {
125 // Callback class used for informing the user of decode timing info.
126 class VCMDecoderTimingCallback {
128 virtual void OnDecoderTiming(int decode_ms,
130 int current_delay_ms,
132 int jitter_buffer_ms,
133 int min_playout_delay_ms,
134 int render_delay_ms) = 0;
137 virtual ~VCMDecoderTimingCallback() {}
140 // Callback class used for telling the user about how to configure the FEC,
141 // and the rates sent the last second is returned to the VCM.
142 class VCMProtectionCallback {
144 virtual int ProtectionRequest(const FecProtectionParams* delta_params,
145 const FecProtectionParams* key_params,
146 uint32_t* sent_video_rate_bps,
147 uint32_t* sent_nack_rate_bps,
148 uint32_t* sent_fec_rate_bps) = 0;
151 virtual ~VCMProtectionCallback() {
155 // Callback class used for telling the user about what frame type needed to continue decoding.
156 // Typically a key frame when the stream has been corrupted in some way.
157 class VCMFrameTypeCallback {
159 virtual int32_t RequestKeyFrame() = 0;
160 virtual int32_t SliceLossIndicationRequest(
161 const uint64_t pictureId) {
166 virtual ~VCMFrameTypeCallback() {
170 // Callback class used for telling the user about which packet sequence numbers are currently
171 // missing and need to be resent.
172 class VCMPacketRequestCallback {
174 virtual int32_t ResendPackets(const uint16_t* sequenceNumbers,
175 uint16_t length) = 0;
178 virtual ~VCMPacketRequestCallback() {
182 // Callback used to inform the user of the the desired resolution
183 // as subscribed by Media Optimization (Quality Modes)
184 class VCMQMSettingsCallback {
186 virtual int32_t SetVideoQMSettings(const uint32_t frameRate,
187 const uint32_t width,
188 const uint32_t height) = 0;
191 virtual ~VCMQMSettingsCallback() {
195 // Callback class used for telling the user about the size (in time) of the
196 // render buffer, that is the size in time of the complete continuous frames.
197 class VCMRenderBufferSizeCallback {
199 virtual void RenderBufferSizeMs(int buffer_size_ms) = 0;
202 virtual ~VCMRenderBufferSizeCallback() {
206 } // namespace webrtc
208 #endif // WEBRTC_MODULES_INTERFACE_VIDEO_CODING_DEFINES_H_