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