| 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 <vector> | 18 #include <vector> |
| 18 | 19 |
| 19 #include "webrtc/base/onetimeevent.h" | 20 #include "webrtc/base/onetimeevent.h" |
| 20 #include "webrtc/base/thread_annotations.h" | 21 #include "webrtc/base/thread_annotations.h" |
| 21 #include "webrtc/base/thread_checker.h" | 22 #include "webrtc/base/thread_checker.h" |
| 22 #include "webrtc/common_video/include/frame_callback.h" | 23 #include "webrtc/common_video/include/frame_callback.h" |
| 23 #include "webrtc/modules/video_coding/codec_database.h" | 24 #include "webrtc/modules/video_coding/codec_database.h" |
| 24 #include "webrtc/modules/video_coding/frame_buffer.h" | 25 #include "webrtc/modules/video_coding/frame_buffer.h" |
| 25 #include "webrtc/modules/video_coding/generic_decoder.h" | 26 #include "webrtc/modules/video_coding/generic_decoder.h" |
| 26 #include "webrtc/modules/video_coding/generic_encoder.h" | 27 #include "webrtc/modules/video_coding/generic_encoder.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 51 int64_t _latestMs; | 52 int64_t _latestMs; |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 class VideoSender : public Module { | 55 class VideoSender : public Module { |
| 55 public: | 56 public: |
| 56 typedef VideoCodingModule::SenderNackMode SenderNackMode; | 57 typedef VideoCodingModule::SenderNackMode SenderNackMode; |
| 57 | 58 |
| 58 VideoSender(Clock* clock, | 59 VideoSender(Clock* clock, |
| 59 EncodedImageCallback* post_encode_callback, | 60 EncodedImageCallback* post_encode_callback, |
| 60 VideoEncoderRateObserver* encoder_rate_observer, | 61 VideoEncoderRateObserver* encoder_rate_observer, |
| 61 VCMQMSettingsCallback* qm_settings_callback); | 62 VCMQMSettingsCallback* qm_settings_callback, |
| 63 VCMSendStatisticsCallback* send_stats_callback); |
| 62 | 64 |
| 63 ~VideoSender(); | 65 ~VideoSender(); |
| 64 | 66 |
| 65 // Register the send codec to be used. | 67 // Register the send codec to be used. |
| 66 // This method must be called on the construction thread. | 68 // This method must be called on the construction thread. |
| 67 int32_t RegisterSendCodec(const VideoCodec* sendCodec, | 69 int32_t RegisterSendCodec(const VideoCodec* sendCodec, |
| 68 uint32_t numberOfCores, | 70 uint32_t numberOfCores, |
| 69 uint32_t maxPayloadSize); | 71 uint32_t maxPayloadSize); |
| 70 | 72 |
| 71 void RegisterExternalEncoder(VideoEncoder* externalEncoder, | 73 void RegisterExternalEncoder(VideoEncoder* externalEncoder, |
| 72 uint8_t payloadType, | 74 uint8_t payloadType, |
| 73 bool internalSource); | 75 bool internalSource); |
| 74 | 76 |
| 75 int Bitrate(unsigned int* bitrate) const; | 77 int Bitrate(unsigned int* bitrate) const; |
| 76 int FrameRate(unsigned int* framerate) const; | 78 int FrameRate(unsigned int* framerate) const; |
| 77 | 79 |
| 78 int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s. | 80 int32_t SetChannelParameters(uint32_t target_bitrate, // bits/s. |
| 79 uint8_t lossRate, | 81 uint8_t lossRate, |
| 80 int64_t rtt); | 82 int64_t rtt); |
| 81 | 83 |
| 82 // Deprecated. Use |post_encode_callback| instead. | |
| 83 // TODO(perkj): Remove once |OnEncoderImplementationName| is not used. | |
| 84 int32_t RegisterTransportCallback(VCMPacketizationCallback* transport); | |
| 85 int32_t RegisterSendStatisticsCallback(VCMSendStatisticsCallback* sendStats); | |
| 86 int32_t RegisterProtectionCallback(VCMProtectionCallback* protection); | 84 int32_t RegisterProtectionCallback(VCMProtectionCallback* protection); |
| 87 void SetVideoProtection(VCMVideoProtection videoProtection); | 85 void SetVideoProtection(VCMVideoProtection videoProtection); |
| 88 | 86 |
| 89 int32_t AddVideoFrame(const VideoFrame& videoFrame, | 87 int32_t AddVideoFrame(const VideoFrame& videoFrame, |
| 90 const VideoContentMetrics* _contentMetrics, | 88 const VideoContentMetrics* _contentMetrics, |
| 91 const CodecSpecificInfo* codecSpecificInfo); | 89 const CodecSpecificInfo* codecSpecificInfo); |
| 92 | 90 |
| 93 int32_t IntraFrameRequest(int stream_index); | 91 int32_t IntraFrameRequest(int stream_index); |
| 94 int32_t EnableFrameDropper(bool enable); | 92 int32_t EnableFrameDropper(bool enable); |
| 95 | 93 |
| 96 void SuspendBelowMinBitrate(); | 94 void SuspendBelowMinBitrate(); |
| 97 bool VideoSuspended() const; | 95 bool VideoSuspended() const; |
| 98 | 96 |
| 99 int64_t TimeUntilNextProcess() override; | 97 int64_t TimeUntilNextProcess() override; |
| 100 void Process() override; | 98 void Process() override; |
| 101 | 99 |
| 102 private: | 100 private: |
| 103 void SetEncoderParameters(EncoderParameters params) | 101 void SetEncoderParameters(EncoderParameters params) |
| 104 EXCLUSIVE_LOCKS_REQUIRED(encoder_crit_); | 102 EXCLUSIVE_LOCKS_REQUIRED(encoder_crit_); |
| 105 | 103 |
| 106 Clock* const clock_; | 104 Clock* const clock_; |
| 107 | 105 |
| 108 rtc::CriticalSection process_crit_; | |
| 109 rtc::CriticalSection encoder_crit_; | 106 rtc::CriticalSection encoder_crit_; |
| 110 VCMGenericEncoder* _encoder; | 107 VCMGenericEncoder* _encoder; |
| 111 VCMEncodedFrameCallback _encodedFrameCallback GUARDED_BY(encoder_crit_); | 108 VCMEncodedFrameCallback _encodedFrameCallback GUARDED_BY(encoder_crit_); |
| 112 media_optimization::MediaOptimization _mediaOpt; | 109 media_optimization::MediaOptimization _mediaOpt; |
| 113 VCMSendStatisticsCallback* _sendStatsCallback GUARDED_BY(process_crit_); | 110 VCMSendStatisticsCallback* const send_stats_callback_; |
| 114 VCMCodecDataBase _codecDataBase GUARDED_BY(encoder_crit_); | 111 VCMCodecDataBase _codecDataBase GUARDED_BY(encoder_crit_); |
| 115 bool frame_dropper_enabled_ GUARDED_BY(encoder_crit_); | 112 bool frame_dropper_enabled_ GUARDED_BY(encoder_crit_); |
| 116 VCMProcessTimer _sendStatsTimer; | 113 VCMProcessTimer _sendStatsTimer; |
| 117 | 114 |
| 118 // Must be accessed on the construction thread of VideoSender. | 115 // Must be accessed on the construction thread of VideoSender. |
| 119 VideoCodec current_codec_; | 116 VideoCodec current_codec_; |
| 120 rtc::ThreadChecker main_thread_; | 117 rtc::ThreadChecker main_thread_; |
| 121 | 118 |
| 122 VCMQMSettingsCallback* const qm_settings_callback_; | 119 VCMQMSettingsCallback* const qm_settings_callback_; |
| 123 VCMProtectionCallback* protection_callback_; | 120 VCMProtectionCallback* protection_callback_; |
| 124 | 121 |
| 125 rtc::CriticalSection params_crit_; | 122 rtc::CriticalSection params_crit_; |
| 126 EncoderParameters encoder_params_ GUARDED_BY(params_crit_); | 123 EncoderParameters encoder_params_ GUARDED_BY(params_crit_); |
| 127 bool encoder_has_internal_source_ GUARDED_BY(params_crit_); | 124 bool encoder_has_internal_source_ GUARDED_BY(params_crit_); |
| 125 std::string encoder_name_ GUARDED_BY(params_crit_); |
| 128 std::vector<FrameType> next_frame_types_ GUARDED_BY(params_crit_); | 126 std::vector<FrameType> next_frame_types_ GUARDED_BY(params_crit_); |
| 129 }; | 127 }; |
| 130 | 128 |
| 131 class VideoReceiver { | 129 class VideoReceiver { |
| 132 public: | 130 public: |
| 133 typedef VideoCodingModule::ReceiverRobustness ReceiverRobustness; | 131 typedef VideoCodingModule::ReceiverRobustness ReceiverRobustness; |
| 134 | 132 |
| 135 VideoReceiver(Clock* clock, | 133 VideoReceiver(Clock* clock, |
| 136 EventFactory* event_factory, | 134 EventFactory* event_factory, |
| 137 EncodedImageCallback* pre_decode_image_callback, | 135 EncodedImageCallback* pre_decode_image_callback, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 VCMProcessTimer _receiveStatsTimer; | 214 VCMProcessTimer _receiveStatsTimer; |
| 217 VCMProcessTimer _retransmissionTimer; | 215 VCMProcessTimer _retransmissionTimer; |
| 218 VCMProcessTimer _keyRequestTimer; | 216 VCMProcessTimer _keyRequestTimer; |
| 219 QpParser qp_parser_; | 217 QpParser qp_parser_; |
| 220 ThreadUnsafeOneTimeEvent first_frame_received_; | 218 ThreadUnsafeOneTimeEvent first_frame_received_; |
| 221 }; | 219 }; |
| 222 | 220 |
| 223 } // namespace vcm | 221 } // namespace vcm |
| 224 } // namespace webrtc | 222 } // namespace webrtc |
| 225 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ | 223 #endif // WEBRTC_MODULES_VIDEO_CODING_VIDEO_CODING_IMPL_H_ |
| OLD | NEW |