| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 VideoSender::~VideoSender() {} | 49 VideoSender::~VideoSender() {} |
| 50 | 50 |
| 51 void VideoSender::Process() { | 51 void VideoSender::Process() { |
| 52 if (_sendStatsTimer.TimeUntilProcess() == 0) { | 52 if (_sendStatsTimer.TimeUntilProcess() == 0) { |
| 53 // |_sendStatsTimer.Processed()| must be called. Otherwise | 53 // |_sendStatsTimer.Processed()| must be called. Otherwise |
| 54 // VideoSender::Process() will be called in an infinite loop. | 54 // VideoSender::Process() will be called in an infinite loop. |
| 55 _sendStatsTimer.Processed(); | 55 _sendStatsTimer.Processed(); |
| 56 if (send_stats_callback_) { | 56 if (send_stats_callback_) { |
| 57 uint32_t bitRate = _mediaOpt.SentBitRate(); | 57 uint32_t bitRate = _mediaOpt.SentBitRate(); |
| 58 uint32_t frameRate = _mediaOpt.SentFrameRate(); | 58 uint32_t frameRate = _mediaOpt.SentFrameRate(); |
| 59 std::string encoder_name; | 59 send_stats_callback_->SendStatistics(bitRate, frameRate); |
| 60 { | |
| 61 rtc::CritScope cs(¶ms_crit_); | |
| 62 // Copy the string here so that we don't hold |params_crit_| in the CB. | |
| 63 encoder_name = encoder_name_; | |
| 64 } | |
| 65 send_stats_callback_->SendStatistics(bitRate, frameRate, encoder_name); | |
| 66 } | 60 } |
| 67 } | 61 } |
| 68 | 62 |
| 69 { | 63 { |
| 70 rtc::CritScope cs(¶ms_crit_); | 64 rtc::CritScope cs(¶ms_crit_); |
| 71 // Force an encoder parameters update, so that incoming frame rate is | 65 // Force an encoder parameters update, so that incoming frame rate is |
| 72 // updated even if bandwidth hasn't changed. | 66 // updated even if bandwidth hasn't changed. |
| 73 encoder_params_.input_frame_rate = _mediaOpt.InputFrameRate(); | 67 encoder_params_.input_frame_rate = _mediaOpt.InputFrameRate(); |
| 74 } | 68 } |
| 75 } | 69 } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 301 } |
| 308 int32_t ret = | 302 int32_t ret = |
| 309 _encoder->Encode(converted_frame, codecSpecificInfo, next_frame_types); | 303 _encoder->Encode(converted_frame, codecSpecificInfo, next_frame_types); |
| 310 if (ret < 0) { | 304 if (ret < 0) { |
| 311 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; | 305 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; |
| 312 return ret; | 306 return ret; |
| 313 } | 307 } |
| 314 | 308 |
| 315 { | 309 { |
| 316 rtc::CritScope lock(¶ms_crit_); | 310 rtc::CritScope lock(¶ms_crit_); |
| 317 encoder_name_ = _encoder->ImplementationName(); | |
| 318 | |
| 319 // Change all keyframe requests to encode delta frames the next time. | 311 // Change all keyframe requests to encode delta frames the next time. |
| 320 for (size_t i = 0; i < next_frame_types_.size(); ++i) { | 312 for (size_t i = 0; i < next_frame_types_.size(); ++i) { |
| 321 // Check for equality (same requested as before encoding) to not | 313 // Check for equality (same requested as before encoding) to not |
| 322 // accidentally drop a keyframe request while encoding. | 314 // accidentally drop a keyframe request while encoding. |
| 323 if (next_frame_types[i] == next_frame_types_[i]) | 315 if (next_frame_types[i] == next_frame_types_[i]) |
| 324 next_frame_types_[i] = kVideoFrameDelta; | 316 next_frame_types_[i] = kVideoFrameDelta; |
| 325 } | 317 } |
| 326 } | 318 } |
| 327 return VCM_OK; | 319 return VCM_OK; |
| 328 } | 320 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 358 } | 350 } |
| 359 | 351 |
| 360 int32_t VideoSender::EnableFrameDropper(bool enable) { | 352 int32_t VideoSender::EnableFrameDropper(bool enable) { |
| 361 rtc::CritScope lock(&encoder_crit_); | 353 rtc::CritScope lock(&encoder_crit_); |
| 362 frame_dropper_enabled_ = enable; | 354 frame_dropper_enabled_ = enable; |
| 363 _mediaOpt.EnableFrameDropper(enable); | 355 _mediaOpt.EnableFrameDropper(enable); |
| 364 return VCM_OK; | 356 return VCM_OK; |
| 365 } | 357 } |
| 366 } // namespace vcm | 358 } // namespace vcm |
| 367 } // namespace webrtc | 359 } // namespace webrtc |
| OLD | NEW |