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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 | 758 |
759 AdaptiveVideoSource::AdaptiveVideoSource(int flow_id, | 759 AdaptiveVideoSource::AdaptiveVideoSource(int flow_id, |
760 float fps, | 760 float fps, |
761 uint32_t kbps, | 761 uint32_t kbps, |
762 uint32_t ssrc, | 762 uint32_t ssrc, |
763 int64_t first_frame_offset_ms) | 763 int64_t first_frame_offset_ms) |
764 : VideoSource(flow_id, fps, kbps, ssrc, first_frame_offset_ms) { | 764 : VideoSource(flow_id, fps, kbps, ssrc, first_frame_offset_ms) { |
765 } | 765 } |
766 | 766 |
767 void AdaptiveVideoSource::SetBitrateBps(int bitrate_bps) { | 767 void AdaptiveVideoSource::SetBitrateBps(int bitrate_bps) { |
768 bits_per_second_ = std::min(bitrate_bps, 2500000); | 768 bits_per_second_ = bitrate_bps; |
769 frame_size_bytes_ = (bits_per_second_ / 8 * frame_period_ms_ + 500) / 1000; | 769 frame_size_bytes_ = (bits_per_second_ / 8 * frame_period_ms_ + 500) / 1000; |
770 } | 770 } |
771 | 771 |
772 PeriodicKeyFrameSource::PeriodicKeyFrameSource(int flow_id, | 772 PeriodicKeyFrameSource::PeriodicKeyFrameSource(int flow_id, |
773 float fps, | 773 float fps, |
774 uint32_t kbps, | 774 uint32_t kbps, |
775 uint32_t ssrc, | 775 uint32_t ssrc, |
776 int64_t first_frame_offset_ms, | 776 int64_t first_frame_offset_ms, |
777 int key_frame_interval) | 777 int key_frame_interval) |
778 : AdaptiveVideoSource(flow_id, fps, kbps, ssrc, first_frame_offset_ms), | 778 : AdaptiveVideoSource(flow_id, fps, kbps, ssrc, first_frame_offset_ms), |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, | 812 uint32_t PeriodicKeyFrameSource::NextPacketSize(uint32_t frame_size, |
813 uint32_t remaining_payload) { | 813 uint32_t remaining_payload) { |
814 uint32_t fragments = | 814 uint32_t fragments = |
815 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; | 815 (frame_size + (kMaxPayloadSizeBytes - 1)) / kMaxPayloadSizeBytes; |
816 uint32_t avg_size = (frame_size + fragments - 1) / fragments; | 816 uint32_t avg_size = (frame_size + fragments - 1) / fragments; |
817 return std::min(avg_size, remaining_payload); | 817 return std::min(avg_size, remaining_payload); |
818 } | 818 } |
819 } // namespace bwe | 819 } // namespace bwe |
820 } // namespace testing | 820 } // namespace testing |
821 } // namespace webrtc | 821 } // namespace webrtc |
OLD | NEW |