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_VIDEO_CODING_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ |
12 #define WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ |
13 | 13 |
14 #include "webrtc/modules/video_coding/include/video_coding.h" | 14 #include "webrtc/modules/video_coding/include/video_coding.h" |
15 | 15 |
16 #include <memory> | 16 #include <memory> |
17 #include <string> | 17 #include <string> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "webrtc/base/onetimeevent.h" | 20 #include "webrtc/base/onetimeevent.h" |
| 21 #include "webrtc/base/sequenced_task_checker.h" |
21 #include "webrtc/base/thread_annotations.h" | 22 #include "webrtc/base/thread_annotations.h" |
22 #include "webrtc/base/sequenced_task_checker.h" | 23 #include "webrtc/base/thread_checker.h" |
23 #include "webrtc/common_video/include/frame_callback.h" | 24 #include "webrtc/common_video/include/frame_callback.h" |
24 #include "webrtc/modules/video_coding/codec_database.h" | 25 #include "webrtc/modules/video_coding/codec_database.h" |
25 #include "webrtc/modules/video_coding/frame_buffer.h" | 26 #include "webrtc/modules/video_coding/frame_buffer.h" |
26 #include "webrtc/modules/video_coding/generic_decoder.h" | 27 #include "webrtc/modules/video_coding/generic_decoder.h" |
27 #include "webrtc/modules/video_coding/generic_encoder.h" | 28 #include "webrtc/modules/video_coding/generic_encoder.h" |
28 #include "webrtc/modules/video_coding/jitter_buffer.h" | 29 #include "webrtc/modules/video_coding/jitter_buffer.h" |
29 #include "webrtc/modules/video_coding/media_optimization.h" | 30 #include "webrtc/modules/video_coding/media_optimization.h" |
30 #include "webrtc/modules/video_coding/qp_parser.h" | 31 #include "webrtc/modules/video_coding/qp_parser.h" |
31 #include "webrtc/modules/video_coding/receiver.h" | 32 #include "webrtc/modules/video_coding/receiver.h" |
32 #include "webrtc/modules/video_coding/timing.h" | 33 #include "webrtc/modules/video_coding/timing.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 VCMReceiveStatisticsCallback* receiveStats); | 165 VCMReceiveStatisticsCallback* receiveStats); |
165 int32_t RegisterDecoderTimingCallback( | 166 int32_t RegisterDecoderTimingCallback( |
166 VCMDecoderTimingCallback* decoderTiming); | 167 VCMDecoderTimingCallback* decoderTiming); |
167 int32_t RegisterFrameTypeCallback(VCMFrameTypeCallback* frameTypeCallback); | 168 int32_t RegisterFrameTypeCallback(VCMFrameTypeCallback* frameTypeCallback); |
168 int32_t RegisterPacketRequestCallback(VCMPacketRequestCallback* callback); | 169 int32_t RegisterPacketRequestCallback(VCMPacketRequestCallback* callback); |
169 | 170 |
170 int32_t Decode(uint16_t maxWaitTimeMs); | 171 int32_t Decode(uint16_t maxWaitTimeMs); |
171 | 172 |
172 int32_t Decode(const webrtc::VCMEncodedFrame* frame); | 173 int32_t Decode(const webrtc::VCMEncodedFrame* frame); |
173 | 174 |
| 175 // Called on the decoder thread when thread is exiting. |
| 176 void DecodingStopped(); |
| 177 |
174 int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const; | 178 int32_t ReceiveCodec(VideoCodec* currentReceiveCodec) const; |
175 VideoCodecType ReceiveCodec() const; | 179 VideoCodecType ReceiveCodec() const; |
176 | 180 |
177 int32_t IncomingPacket(const uint8_t* incomingPayload, | 181 int32_t IncomingPacket(const uint8_t* incomingPayload, |
178 size_t payloadLength, | 182 size_t payloadLength, |
179 const WebRtcRTPHeader& rtpInfo); | 183 const WebRtcRTPHeader& rtpInfo); |
180 int32_t SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs); | 184 int32_t SetMinimumPlayoutDelay(uint32_t minPlayoutDelayMs); |
181 int32_t SetRenderDelay(uint32_t timeMS); | 185 int32_t SetRenderDelay(uint32_t timeMS); |
182 int32_t Delay() const; | 186 int32_t Delay() const; |
183 uint32_t DiscardedPackets() const; | 187 uint32_t DiscardedPackets() const; |
(...skipping 15 matching lines...) Expand all Loading... |
199 | 203 |
200 void TriggerDecoderShutdown(); | 204 void TriggerDecoderShutdown(); |
201 | 205 |
202 protected: | 206 protected: |
203 int32_t Decode(const webrtc::VCMEncodedFrame& frame) | 207 int32_t Decode(const webrtc::VCMEncodedFrame& frame) |
204 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); | 208 EXCLUSIVE_LOCKS_REQUIRED(receive_crit_); |
205 int32_t RequestKeyFrame(); | 209 int32_t RequestKeyFrame(); |
206 int32_t RequestSliceLossIndication(const uint64_t pictureID) const; | 210 int32_t RequestSliceLossIndication(const uint64_t pictureID) const; |
207 | 211 |
208 private: | 212 private: |
| 213 rtc::ThreadChecker construction_thread_; |
209 Clock* const clock_; | 214 Clock* const clock_; |
210 rtc::CriticalSection process_crit_; | 215 rtc::CriticalSection process_crit_; |
211 rtc::CriticalSection receive_crit_; | 216 rtc::CriticalSection receive_crit_; |
212 VCMTiming* _timing; | 217 VCMTiming* _timing; |
213 VCMReceiver _receiver; | 218 VCMReceiver _receiver; |
214 VCMDecodedFrameCallback _decodedFrameCallback; | 219 VCMDecodedFrameCallback _decodedFrameCallback; |
215 VCMFrameTypeCallback* _frameTypeCallback GUARDED_BY(process_crit_); | 220 VCMFrameTypeCallback* _frameTypeCallback GUARDED_BY(process_crit_); |
216 VCMReceiveStatisticsCallback* _receiveStatsCallback GUARDED_BY(process_crit_); | 221 VCMReceiveStatisticsCallback* _receiveStatsCallback GUARDED_BY(process_crit_); |
217 VCMDecoderTimingCallback* _decoderTimingCallback GUARDED_BY(process_crit_); | 222 VCMDecoderTimingCallback* _decoderTimingCallback GUARDED_BY(process_crit_); |
218 VCMPacketRequestCallback* _packetRequestCallback GUARDED_BY(process_crit_); | 223 VCMPacketRequestCallback* _packetRequestCallback GUARDED_BY(process_crit_); |
219 VCMGenericDecoder* _decoder; | |
220 | 224 |
221 VCMFrameBuffer _frameFromFile; | 225 VCMFrameBuffer _frameFromFile; |
222 bool _scheduleKeyRequest GUARDED_BY(process_crit_); | 226 bool _scheduleKeyRequest GUARDED_BY(process_crit_); |
223 bool drop_frames_until_keyframe_ GUARDED_BY(process_crit_); | 227 bool drop_frames_until_keyframe_ GUARDED_BY(process_crit_); |
224 size_t max_nack_list_size_ GUARDED_BY(process_crit_); | 228 size_t max_nack_list_size_ GUARDED_BY(process_crit_); |
225 | 229 |
226 VCMCodecDataBase _codecDataBase GUARDED_BY(receive_crit_); | 230 VCMCodecDataBase _codecDataBase GUARDED_BY(receive_crit_); |
227 EncodedImageCallback* pre_decode_image_callback_; | 231 EncodedImageCallback* pre_decode_image_callback_; |
228 | 232 |
229 VCMProcessTimer _receiveStatsTimer; | 233 VCMProcessTimer _receiveStatsTimer; |
230 VCMProcessTimer _retransmissionTimer; | 234 VCMProcessTimer _retransmissionTimer; |
231 VCMProcessTimer _keyRequestTimer; | 235 VCMProcessTimer _keyRequestTimer; |
232 QpParser qp_parser_; | 236 QpParser qp_parser_; |
233 ThreadUnsafeOneTimeEvent first_frame_received_; | 237 ThreadUnsafeOneTimeEvent first_frame_received_; |
234 }; | 238 }; |
235 | 239 |
236 } // namespace vcm | 240 } // namespace vcm |
237 } // namespace webrtc | 241 } // namespace webrtc |
238 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ | 242 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ |
OLD | NEW |