OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
(...skipping 17 matching lines...) Expand all Loading... |
28 EncodedImageCallback* post_encode_callback, | 28 EncodedImageCallback* post_encode_callback, |
29 VideoEncoderRateObserver* encoder_rate_observer, | 29 VideoEncoderRateObserver* encoder_rate_observer, |
30 VCMQMSettingsCallback* qm_settings_callback) | 30 VCMQMSettingsCallback* qm_settings_callback) |
31 : clock_(clock), | 31 : clock_(clock), |
32 process_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), | 32 process_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), |
33 _encoder(nullptr), | 33 _encoder(nullptr), |
34 _encodedFrameCallback(post_encode_callback), | 34 _encodedFrameCallback(post_encode_callback), |
35 _nextFrameTypes(1, kVideoFrameDelta), | 35 _nextFrameTypes(1, kVideoFrameDelta), |
36 _mediaOpt(clock_), | 36 _mediaOpt(clock_), |
37 _sendStatsCallback(nullptr), | 37 _sendStatsCallback(nullptr), |
38 _codecDataBase(encoder_rate_observer), | 38 _codecDataBase(encoder_rate_observer, &_encodedFrameCallback), |
39 frame_dropper_enabled_(true), | 39 frame_dropper_enabled_(true), |
40 _sendStatsTimer(1000, clock_), | 40 _sendStatsTimer(1000, clock_), |
41 current_codec_(), | 41 current_codec_(), |
42 qm_settings_callback_(qm_settings_callback), | 42 qm_settings_callback_(qm_settings_callback), |
43 protection_callback_(nullptr), | 43 protection_callback_(nullptr), |
44 encoder_params_({0, 0, 0, 0}) { | 44 encoder_params_({0, 0, 0, 0}) { |
45 // Allow VideoSender to be created on one thread but used on another, post | 45 // Allow VideoSender to be created on one thread but used on another, post |
46 // construction. This is currently how this class is being used by at least | 46 // construction. This is currently how this class is being used by at least |
47 // one external project (diffractor). | 47 // one external project (diffractor). |
48 _mediaOpt.EnableQM(qm_settings_callback_ != nullptr); | 48 _mediaOpt.EnableQM(qm_settings_callback_ != nullptr); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Register the send codec to be used. | 82 // Register the send codec to be used. |
83 int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec, | 83 int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec, |
84 uint32_t numberOfCores, | 84 uint32_t numberOfCores, |
85 uint32_t maxPayloadSize) { | 85 uint32_t maxPayloadSize) { |
86 RTC_DCHECK(main_thread_.CalledOnValidThread()); | 86 RTC_DCHECK(main_thread_.CalledOnValidThread()); |
87 rtc::CritScope lock(&send_crit_); | 87 rtc::CritScope lock(&send_crit_); |
88 if (sendCodec == nullptr) { | 88 if (sendCodec == nullptr) { |
89 return VCM_PARAMETER_ERROR; | 89 return VCM_PARAMETER_ERROR; |
90 } | 90 } |
91 | 91 |
92 bool ret = _codecDataBase.SetSendCodec( | 92 bool ret = |
93 sendCodec, numberOfCores, maxPayloadSize, &_encodedFrameCallback); | 93 _codecDataBase.SetSendCodec(sendCodec, numberOfCores, maxPayloadSize); |
94 | 94 |
95 // Update encoder regardless of result to make sure that we're not holding on | 95 // Update encoder regardless of result to make sure that we're not holding on |
96 // to a deleted instance. | 96 // to a deleted instance. |
97 _encoder = _codecDataBase.GetEncoder(); | 97 _encoder = _codecDataBase.GetEncoder(); |
98 // Cache the current codec here so they can be fetched from this thread | 98 // Cache the current codec here so they can be fetched from this thread |
99 // without requiring the _sendCritSect lock. | 99 // without requiring the _sendCritSect lock. |
100 current_codec_ = *sendCodec; | 100 current_codec_ = *sendCodec; |
101 | 101 |
102 if (!ret) { | 102 if (!ret) { |
103 LOG(LS_ERROR) << "Failed to initialize set encoder with payload name '" | 103 LOG(LS_ERROR) << "Failed to initialize set encoder with payload name '" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 int window_bps = std::max(threshold_bps / 10, 10000); | 367 int window_bps = std::max(threshold_bps / 10, 10000); |
368 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); | 368 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); |
369 } | 369 } |
370 | 370 |
371 bool VideoSender::VideoSuspended() const { | 371 bool VideoSender::VideoSuspended() const { |
372 rtc::CritScope lock(&send_crit_); | 372 rtc::CritScope lock(&send_crit_); |
373 return _mediaOpt.IsVideoSuspended(); | 373 return _mediaOpt.IsVideoSuspended(); |
374 } | 374 } |
375 } // namespace vcm | 375 } // namespace vcm |
376 } // namespace webrtc | 376 } // namespace webrtc |
OLD | NEW |