| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Allow VideoSender to be created on one thread but used on another, post | 46 // Allow VideoSender to be created on one thread but used on another, post |
| 47 // construction. This is currently how this class is being used by at least | 47 // construction. This is currently how this class is being used by at least |
| 48 // one external project (diffractor). | 48 // one external project (diffractor). |
| 49 _mediaOpt.EnableQM(qm_settings_callback_ != nullptr); | 49 _mediaOpt.EnableQM(qm_settings_callback_ != nullptr); |
| 50 _mediaOpt.Reset(); | 50 _mediaOpt.Reset(); |
| 51 main_thread_.DetachFromThread(); | 51 main_thread_.DetachFromThread(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 VideoSender::~VideoSender() {} | 54 VideoSender::~VideoSender() {} |
| 55 | 55 |
| 56 void VideoSender::Process() { | 56 int32_t VideoSender::Process() { |
| 57 int32_t returnValue = VCM_OK; |
| 58 |
| 57 if (_sendStatsTimer.TimeUntilProcess() == 0) { | 59 if (_sendStatsTimer.TimeUntilProcess() == 0) { |
| 58 _sendStatsTimer.Processed(); | 60 _sendStatsTimer.Processed(); |
| 59 CriticalSectionScoped cs(process_crit_sect_.get()); | 61 CriticalSectionScoped cs(process_crit_sect_.get()); |
| 60 if (_sendStatsCallback != nullptr) { | 62 if (_sendStatsCallback != nullptr) { |
| 61 uint32_t bitRate = _mediaOpt.SentBitRate(); | 63 uint32_t bitRate = _mediaOpt.SentBitRate(); |
| 62 uint32_t frameRate = _mediaOpt.SentFrameRate(); | 64 uint32_t frameRate = _mediaOpt.SentFrameRate(); |
| 63 _sendStatsCallback->SendStatistics(bitRate, frameRate); | 65 _sendStatsCallback->SendStatistics(bitRate, frameRate); |
| 64 } | 66 } |
| 65 } | 67 } |
| 66 | 68 |
| 67 { | 69 { |
| 68 rtc::CritScope cs(¶ms_crit_); | 70 rtc::CritScope cs(¶ms_crit_); |
| 69 // Force an encoder parameters update, so that incoming frame rate is | 71 // Force an encoder parameters update, so that incoming frame rate is |
| 70 // updated even if bandwidth hasn't changed. | 72 // updated even if bandwidth hasn't changed. |
| 71 encoder_params_.input_frame_rate = _mediaOpt.InputFrameRate(); | 73 encoder_params_.input_frame_rate = _mediaOpt.InputFrameRate(); |
| 72 } | 74 } |
| 75 |
| 76 return returnValue; |
| 73 } | 77 } |
| 74 | 78 |
| 75 int64_t VideoSender::TimeUntilNextProcess() { | 79 int64_t VideoSender::TimeUntilNextProcess() { |
| 76 return _sendStatsTimer.TimeUntilProcess(); | 80 return _sendStatsTimer.TimeUntilProcess(); |
| 77 } | 81 } |
| 78 | 82 |
| 79 // Register the send codec to be used. | 83 // Register the send codec to be used. |
| 80 int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec, | 84 int32_t VideoSender::RegisterSendCodec(const VideoCodec* sendCodec, |
| 81 uint32_t numberOfCores, | 85 uint32_t numberOfCores, |
| 82 uint32_t maxPayloadSize) { | 86 uint32_t maxPayloadSize) { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // 10 kbps. | 373 // 10 kbps. |
| 370 int window_bps = std::max(threshold_bps / 10, 10000); | 374 int window_bps = std::max(threshold_bps / 10, 10000); |
| 371 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); | 375 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); |
| 372 } | 376 } |
| 373 | 377 |
| 374 bool VideoSender::VideoSuspended() const { | 378 bool VideoSender::VideoSuspended() const { |
| 375 return _mediaOpt.IsVideoSuspended(); | 379 return _mediaOpt.IsVideoSuspended(); |
| 376 } | 380 } |
| 377 } // namespace vcm | 381 } // namespace vcm |
| 378 } // namespace webrtc | 382 } // namespace webrtc |
| OLD | NEW |