Chromium Code Reviews| 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 <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/base/onetimeevent.h" | 19 #include "webrtc/base/onetimeevent.h" |
| 20 #include "webrtc/base/thread_annotations.h" | 20 #include "webrtc/base/thread_annotations.h" |
| 21 #include "webrtc/base/thread_checker.h" | 21 #include "webrtc/base/thread_checker.h" |
| 22 #include "webrtc/modules/video_coding/codec_database.h" | 22 #include "webrtc/modules/video_coding/codec_database.h" |
| 23 #include "webrtc/modules/video_coding/frame_buffer.h" | 23 #include "webrtc/modules/video_coding/frame_buffer.h" |
| 24 #include "webrtc/modules/video_coding/generic_decoder.h" | 24 #include "webrtc/modules/video_coding/generic_decoder.h" |
| 25 #include "webrtc/modules/video_coding/generic_encoder.h" | 25 #include "webrtc/modules/video_coding/generic_encoder.h" |
| 26 #include "webrtc/modules/video_coding/jitter_buffer.h" | 26 #include "webrtc/modules/video_coding/jitter_buffer.h" |
| 27 #include "webrtc/modules/video_coding/media_optimization.h" | 27 #include "webrtc/modules/video_coding/media_optimization.h" |
| 28 #include "webrtc/modules/video_coding/receiver.h" | 28 #include "webrtc/modules/video_coding/receiver.h" |
| 29 #include "webrtc/modules/video_coding/timing.h" | 29 #include "webrtc/modules/video_coding/timing.h" |
| 30 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h" | |
| 30 #include "webrtc/modules/video_coding/utility/qp_parser.h" | 31 #include "webrtc/modules/video_coding/utility/qp_parser.h" |
| 31 #include "webrtc/system_wrappers/include/clock.h" | 32 #include "webrtc/system_wrappers/include/clock.h" |
| 32 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | |
| 33 | 33 |
| 34 namespace webrtc { | 34 namespace webrtc { |
| 35 | 35 |
| 36 namespace vcm { | 36 namespace vcm { |
| 37 | 37 |
| 38 class VCMProcessTimer { | 38 class VCMProcessTimer { |
| 39 public: | 39 public: |
| 40 VCMProcessTimer(int64_t periodMs, Clock* clock) | 40 VCMProcessTimer(int64_t periodMs, Clock* clock) |
| 41 : _clock(clock), | 41 : _clock(clock), |
| 42 _periodMs(periodMs), | 42 _periodMs(periodMs), |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 | 96 |
| 97 int64_t TimeUntilNextProcess(); | 97 int64_t TimeUntilNextProcess(); |
| 98 void Process(); | 98 void Process(); |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 void SetEncoderParameters(EncoderParameters params) | 101 void SetEncoderParameters(EncoderParameters params) |
| 102 EXCLUSIVE_LOCKS_REQUIRED(encoder_crit_); | 102 EXCLUSIVE_LOCKS_REQUIRED(encoder_crit_); |
| 103 | 103 |
| 104 Clock* const clock_; | 104 Clock* const clock_; |
| 105 | 105 |
| 106 std::unique_ptr<CriticalSectionWrapper> process_crit_sect_; | 106 rtc::CriticalSection process_lock_; |
| 107 rtc::CriticalSection encoder_crit_; | 107 rtc::CriticalSection encoder_crit_; |
| 108 VCMGenericEncoder* _encoder; | 108 VCMGenericEncoder* _encoder; |
| 109 VCMEncodedFrameCallback _encodedFrameCallback GUARDED_BY(encoder_crit_); | 109 VCMEncodedFrameCallback _encodedFrameCallback GUARDED_BY(encoder_crit_); |
| 110 media_optimization::MediaOptimization _mediaOpt; | 110 media_optimization::MediaOptimization _mediaOpt; |
| 111 VCMSendStatisticsCallback* _sendStatsCallback GUARDED_BY(process_crit_sect_); | 111 VCMSendStatisticsCallback* _sendStatsCallback GUARDED_BY(process_lock_); |
| 112 VCMCodecDataBase _codecDataBase GUARDED_BY(encoder_crit_); | 112 VCMCodecDataBase _codecDataBase GUARDED_BY(encoder_crit_); |
| 113 bool frame_dropper_enabled_ GUARDED_BY(encoder_crit_); | 113 bool frame_dropper_enabled_ GUARDED_BY(encoder_crit_); |
| 114 VCMProcessTimer _sendStatsTimer; | 114 VCMProcessTimer _sendStatsTimer; |
| 115 | 115 |
| 116 // Must be accessed on the construction thread of VideoSender. | 116 // Must be accessed on the construction thread of VideoSender. |
| 117 VideoCodec current_codec_; | 117 VideoCodec current_codec_; |
| 118 rtc::ThreadChecker main_thread_; | 118 rtc::ThreadChecker main_thread_; |
| 119 | 119 |
| 120 VCMQMSettingsCallback* const qm_settings_callback_; | 120 VCMQMSettingsCallback* const qm_settings_callback_; |
| 121 VCMProtectionCallback* protection_callback_; | 121 VCMProtectionCallback* protection_callback_; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 int32_t SetVideoProtection(VCMVideoProtection videoProtection, bool enable); | 177 int32_t SetVideoProtection(VCMVideoProtection videoProtection, bool enable); |
| 178 | 178 |
| 179 int64_t TimeUntilNextProcess(); | 179 int64_t TimeUntilNextProcess(); |
| 180 void Process(); | 180 void Process(); |
| 181 | 181 |
| 182 void RegisterPreDecodeImageCallback(EncodedImageCallback* observer); | 182 void RegisterPreDecodeImageCallback(EncodedImageCallback* observer); |
| 183 void TriggerDecoderShutdown(); | 183 void TriggerDecoderShutdown(); |
| 184 | 184 |
| 185 protected: | 185 protected: |
| 186 int32_t Decode(const webrtc::VCMEncodedFrame& frame) | 186 int32_t Decode(const webrtc::VCMEncodedFrame& frame) |
| 187 EXCLUSIVE_LOCKS_REQUIRED(_receiveCritSect); | 187 EXCLUSIVE_LOCKS_REQUIRED(receive_lock_); |
| 188 int32_t RequestKeyFrame(); | 188 int32_t RequestKeyFrame(); |
| 189 int32_t RequestSliceLossIndication(const uint64_t pictureID) const; | 189 int32_t RequestSliceLossIndication(const uint64_t pictureID) const; |
| 190 | 190 |
| 191 private: | 191 private: |
| 192 static const bool kEnableFrameRecording = false; | |
| 193 | |
| 192 Clock* const clock_; | 194 Clock* const clock_; |
| 193 std::unique_ptr<CriticalSectionWrapper> process_crit_sect_; | 195 rtc::CriticalSection process_lock_; |
|
pbos-webrtc
2016/04/12 11:20:55
s/lock/crit for consistency
sprang_webrtc
2016/04/12 14:06:17
Done.
| |
| 194 CriticalSectionWrapper* _receiveCritSect; | 196 rtc::CriticalSection receive_lock_; |
| 195 VCMTiming _timing; | 197 VCMTiming _timing; |
| 196 VCMReceiver _receiver; | 198 VCMReceiver _receiver; |
| 197 VCMDecodedFrameCallback _decodedFrameCallback; | 199 VCMDecodedFrameCallback _decodedFrameCallback; |
| 198 VCMFrameTypeCallback* _frameTypeCallback GUARDED_BY(process_crit_sect_); | 200 VCMFrameTypeCallback* _frameTypeCallback GUARDED_BY(process_lock_); |
| 199 VCMReceiveStatisticsCallback* _receiveStatsCallback | 201 VCMReceiveStatisticsCallback* _receiveStatsCallback GUARDED_BY(process_lock_); |
| 200 GUARDED_BY(process_crit_sect_); | 202 VCMDecoderTimingCallback* _decoderTimingCallback GUARDED_BY(process_lock_); |
| 201 VCMDecoderTimingCallback* _decoderTimingCallback | 203 VCMPacketRequestCallback* _packetRequestCallback GUARDED_BY(process_lock_); |
| 202 GUARDED_BY(process_crit_sect_); | |
| 203 VCMPacketRequestCallback* _packetRequestCallback | |
| 204 GUARDED_BY(process_crit_sect_); | |
| 205 VCMRenderBufferSizeCallback* render_buffer_callback_ | 204 VCMRenderBufferSizeCallback* render_buffer_callback_ |
| 206 GUARDED_BY(process_crit_sect_); | 205 GUARDED_BY(process_lock_); |
| 207 VCMGenericDecoder* _decoder; | 206 VCMGenericDecoder* _decoder; |
| 208 #ifdef DEBUG_DECODER_BIT_STREAM | 207 |
| 209 FILE* _bitStreamBeforeDecoder; | |
| 210 #endif | |
| 211 VCMFrameBuffer _frameFromFile; | 208 VCMFrameBuffer _frameFromFile; |
| 212 bool _scheduleKeyRequest GUARDED_BY(process_crit_sect_); | 209 bool _scheduleKeyRequest GUARDED_BY(process_lock_); |
| 213 bool drop_frames_until_keyframe_ GUARDED_BY(process_crit_sect_); | 210 bool drop_frames_until_keyframe_ GUARDED_BY(process_lock_); |
| 214 size_t max_nack_list_size_ GUARDED_BY(process_crit_sect_); | 211 size_t max_nack_list_size_ GUARDED_BY(process_lock_); |
| 215 | 212 |
| 216 VCMCodecDataBase _codecDataBase GUARDED_BY(_receiveCritSect); | 213 VCMCodecDataBase _codecDataBase GUARDED_BY(receive_lock_); |
| 217 EncodedImageCallback* pre_decode_image_callback_ GUARDED_BY(_receiveCritSect); | 214 EncodedImageCallback* pre_decode_image_callback_ GUARDED_BY(receive_lock_); |
| 218 | 215 |
| 219 VCMProcessTimer _receiveStatsTimer; | 216 VCMProcessTimer _receiveStatsTimer; |
| 220 VCMProcessTimer _retransmissionTimer; | 217 VCMProcessTimer _retransmissionTimer; |
| 221 VCMProcessTimer _keyRequestTimer; | 218 VCMProcessTimer _keyRequestTimer; |
| 222 QpParser qp_parser_; | 219 QpParser qp_parser_; |
| 223 ThreadUnsafeOneTimeEvent first_frame_received_; | 220 ThreadUnsafeOneTimeEvent first_frame_received_; |
| 221 | |
| 222 rtc::CriticalSection file_write_lock_; | |
|
pbos-webrtc
2016/04/12 11:20:55
crit_, but I think all of this should be moved to
sprang_webrtc
2016/04/12 14:06:17
Done.
| |
| 223 uint32_t ssrc_; | |
|
pbos-webrtc
2016/04/12 11:20:55
There shouldn't be a SSRC for a video-coding modul
sprang_webrtc
2016/04/12 14:06:17
Acknowledged.
| |
| 224 std::unique_ptr<IvfFileWriter> file_writer_ GUARDED_BY(file_write_lock_); | |
| 224 }; | 225 }; |
| 225 | 226 |
| 226 } // namespace vcm | 227 } // namespace vcm |
| 227 } // namespace webrtc | 228 } // namespace webrtc |
| 228 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ | 229 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ |
| OLD | NEW |