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 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 } | 344 } |
345 | 345 |
346 uint32_t MediaOptimization::SentBitRate() { | 346 uint32_t MediaOptimization::SentBitRate() { |
347 CriticalSectionScoped lock(crit_sect_.get()); | 347 CriticalSectionScoped lock(crit_sect_.get()); |
348 const int64_t now_ms = clock_->TimeInMilliseconds(); | 348 const int64_t now_ms = clock_->TimeInMilliseconds(); |
349 PurgeOldFrameSamples(now_ms); | 349 PurgeOldFrameSamples(now_ms); |
350 UpdateSentBitrate(now_ms); | 350 UpdateSentBitrate(now_ms); |
351 return avg_sent_bit_rate_bps_; | 351 return avg_sent_bit_rate_bps_; |
352 } | 352 } |
353 | 353 |
354 VCMFrameCount MediaOptimization::SentFrameCount() { | |
355 CriticalSectionScoped lock(crit_sect_.get()); | |
356 VCMFrameCount count; | |
357 count.numDeltaFrames = delta_frame_cnt_; | |
358 count.numKeyFrames = key_frame_cnt_; | |
359 return count; | |
360 } | |
361 | |
362 int32_t MediaOptimization::UpdateWithEncodedData( | 354 int32_t MediaOptimization::UpdateWithEncodedData( |
363 const EncodedImage& encoded_image) { | 355 const EncodedImage& encoded_image) { |
364 size_t encoded_length = encoded_image._length; | 356 size_t encoded_length = encoded_image._length; |
365 uint32_t timestamp = encoded_image._timeStamp; | 357 uint32_t timestamp = encoded_image._timeStamp; |
366 CriticalSectionScoped lock(crit_sect_.get()); | 358 CriticalSectionScoped lock(crit_sect_.get()); |
367 const int64_t now_ms = clock_->TimeInMilliseconds(); | 359 const int64_t now_ms = clock_->TimeInMilliseconds(); |
368 PurgeOldFrameSamples(now_ms); | 360 PurgeOldFrameSamples(now_ms); |
369 if (encoded_frame_samples_.size() > 0 && | 361 if (encoded_frame_samples_.size() > 0 && |
370 encoded_frame_samples_.back().timestamp == timestamp) { | 362 encoded_frame_samples_.back().timestamp == timestamp) { |
371 // Frames having the same timestamp are generated from the same input | 363 // Frames having the same timestamp are generated from the same input |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 if (target_bit_rate_ > | 641 if (target_bit_rate_ > |
650 suspension_threshold_bps_ + suspension_window_bps_) { | 642 suspension_threshold_bps_ + suspension_window_bps_) { |
651 video_suspended_ = false; | 643 video_suspended_ = false; |
652 } | 644 } |
653 } | 645 } |
654 } | 646 } |
655 } | 647 } |
656 | 648 |
657 } // namespace media_optimization | 649 } // namespace media_optimization |
658 } // namespace webrtc | 650 } // namespace webrtc |
OLD | NEW |