OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 2872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2883 stats.substreams[11].height = 90; | 2883 stats.substreams[11].height = 90; |
2884 stream->SetStats(stats); | 2884 stream->SetStats(stats); |
2885 | 2885 |
2886 cricket::VideoMediaInfo info; | 2886 cricket::VideoMediaInfo info; |
2887 ASSERT_TRUE(channel_->GetStats(&info)); | 2887 ASSERT_TRUE(channel_->GetStats(&info)); |
2888 ASSERT_EQ(1u, info.senders.size()); | 2888 ASSERT_EQ(1u, info.senders.size()); |
2889 EXPECT_EQ(123, info.senders[0].send_frame_width); | 2889 EXPECT_EQ(123, info.senders[0].send_frame_width); |
2890 EXPECT_EQ(90, info.senders[0].send_frame_height); | 2890 EXPECT_EQ(90, info.senders[0].send_frame_height); |
2891 } | 2891 } |
2892 | 2892 |
| 2893 TEST_F(WebRtcVideoChannel2Test, GetStatsReportsPreferredBitrate) { |
| 2894 FakeVideoSendStream* stream = AddSendStream(); |
| 2895 webrtc::VideoSendStream::Stats stats; |
| 2896 stats.preferred_media_bitrate_bps = 5; |
| 2897 stream->SetStats(stats); |
| 2898 |
| 2899 cricket::VideoMediaInfo info; |
| 2900 ASSERT_TRUE(channel_->GetStats(&info)); |
| 2901 ASSERT_EQ(1u, info.senders.size()); |
| 2902 EXPECT_EQ(5, info.senders[0].preferred_bitrate); |
| 2903 } |
| 2904 |
2893 TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) { | 2905 TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) { |
2894 AddSendStream(cricket::CreateSimStreamParams("cname", MAKE_VECTOR(kSsrcs3))); | 2906 AddSendStream(cricket::CreateSimStreamParams("cname", MAKE_VECTOR(kSsrcs3))); |
2895 | 2907 |
2896 // Capture format VGA. | 2908 // Capture format VGA. |
2897 cricket::FakeVideoCapturer video_capturer_vga; | 2909 cricket::FakeVideoCapturer video_capturer_vga; |
2898 const std::vector<cricket::VideoFormat>* formats = | 2910 const std::vector<cricket::VideoFormat>* formats = |
2899 video_capturer_vga.GetSupportedFormats(); | 2911 video_capturer_vga.GetSupportedFormats(); |
2900 cricket::VideoFormat capture_format_vga = (*formats)[1]; | 2912 cricket::VideoFormat capture_format_vga = (*formats)[1]; |
2901 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); | 2913 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); |
2902 EXPECT_TRUE( | 2914 EXPECT_TRUE( |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3761 EXPECT_FALSE(expected_streams[i].temporal_layer_thresholds_bps.empty()); | 3773 EXPECT_FALSE(expected_streams[i].temporal_layer_thresholds_bps.empty()); |
3762 EXPECT_EQ(expected_streams[i].temporal_layer_thresholds_bps, | 3774 EXPECT_EQ(expected_streams[i].temporal_layer_thresholds_bps, |
3763 video_streams[i].temporal_layer_thresholds_bps); | 3775 video_streams[i].temporal_layer_thresholds_bps); |
3764 | 3776 |
3765 if (i == num_streams - 1) { | 3777 if (i == num_streams - 1) { |
3766 total_max_bitrate_bps += video_streams[i].max_bitrate_bps; | 3778 total_max_bitrate_bps += video_streams[i].max_bitrate_bps; |
3767 } else { | 3779 } else { |
3768 total_max_bitrate_bps += video_streams[i].target_bitrate_bps; | 3780 total_max_bitrate_bps += video_streams[i].target_bitrate_bps; |
3769 } | 3781 } |
3770 } | 3782 } |
3771 cricket::VideoMediaInfo info; | |
3772 ASSERT_TRUE(channel_->GetStats(&info)); | |
3773 ASSERT_EQ(1u, info.senders.size()); | |
3774 EXPECT_EQ(total_max_bitrate_bps, info.senders[0].preferred_bitrate); | |
3775 | 3783 |
3776 EXPECT_TRUE(channel_->SetVideoSend(ssrcs.front(), true, nullptr, nullptr)); | 3784 EXPECT_TRUE(channel_->SetVideoSend(ssrcs.front(), true, nullptr, nullptr)); |
3777 } | 3785 } |
3778 | 3786 |
3779 FakeVideoSendStream* AddSendStream() { | 3787 FakeVideoSendStream* AddSendStream() { |
3780 return AddSendStream(StreamParams::CreateLegacy(last_ssrc_++)); | 3788 return AddSendStream(StreamParams::CreateLegacy(last_ssrc_++)); |
3781 } | 3789 } |
3782 | 3790 |
3783 FakeVideoSendStream* AddSendStream(const StreamParams& sp) { | 3791 FakeVideoSendStream* AddSendStream(const StreamParams& sp) { |
3784 size_t num_streams = | 3792 size_t num_streams = |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3823 } | 3831 } |
3824 | 3832 |
3825 // Test that we normalize send codec format size in simulcast. | 3833 // Test that we normalize send codec format size in simulcast. |
3826 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3834 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
3827 cricket::VideoCodec codec(kVp8Codec270p); | 3835 cricket::VideoCodec codec(kVp8Codec270p); |
3828 codec.width += 1; | 3836 codec.width += 1; |
3829 codec.height += 1; | 3837 codec.height += 1; |
3830 VerifySimulcastSettings(codec, 2, 2); | 3838 VerifySimulcastSettings(codec, 2, 2); |
3831 } | 3839 } |
3832 } // namespace cricket | 3840 } // namespace cricket |
OLD | NEW |