Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 2368223002: Add VideoSendStream::Stats::prefered_media_bitrate_bps (Closed)
Patch Set: Use SimulcastRateAllocator Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 stats.substreams[11].height = 90; 2887 stats.substreams[11].height = 90;
2888 stream->SetStats(stats); 2888 stream->SetStats(stats);
2889 2889
2890 cricket::VideoMediaInfo info; 2890 cricket::VideoMediaInfo info;
2891 ASSERT_TRUE(channel_->GetStats(&info)); 2891 ASSERT_TRUE(channel_->GetStats(&info));
2892 ASSERT_EQ(1u, info.senders.size()); 2892 ASSERT_EQ(1u, info.senders.size());
2893 EXPECT_EQ(123, info.senders[0].send_frame_width); 2893 EXPECT_EQ(123, info.senders[0].send_frame_width);
2894 EXPECT_EQ(90, info.senders[0].send_frame_height); 2894 EXPECT_EQ(90, info.senders[0].send_frame_height);
2895 } 2895 }
2896 2896
2897 TEST_F(WebRtcVideoChannel2Test, GetStatsReportsPreferredBitrate) {
2898 FakeVideoSendStream* stream = AddSendStream();
2899 webrtc::VideoSendStream::Stats stats;
2900 stats.preferred_media_bitrate_bps = 5;
2901 stream->SetStats(stats);
2902
2903 cricket::VideoMediaInfo info;
2904 ASSERT_TRUE(channel_->GetStats(&info));
2905 ASSERT_EQ(1u, info.senders.size());
2906 EXPECT_EQ(5, info.senders[0].preferred_bitrate);
2907 }
2908
2897 TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) { 2909 TEST_F(WebRtcVideoChannel2Test, GetStatsTracksAdaptationStats) {
2898 AddSendStream(cricket::CreateSimStreamParams("cname", MAKE_VECTOR(kSsrcs3))); 2910 AddSendStream(cricket::CreateSimStreamParams("cname", MAKE_VECTOR(kSsrcs3)));
2899 2911
2900 // Capture format VGA. 2912 // Capture format VGA.
2901 cricket::FakeVideoCapturer video_capturer_vga; 2913 cricket::FakeVideoCapturer video_capturer_vga;
2902 const std::vector<cricket::VideoFormat>* formats = 2914 const std::vector<cricket::VideoFormat>* formats =
2903 video_capturer_vga.GetSupportedFormats(); 2915 video_capturer_vga.GetSupportedFormats();
2904 cricket::VideoFormat capture_format_vga = (*formats)[1]; 2916 cricket::VideoFormat capture_format_vga = (*formats)[1];
2905 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga)); 2917 EXPECT_EQ(cricket::CS_RUNNING, video_capturer_vga.Start(capture_format_vga));
2906 EXPECT_TRUE( 2918 EXPECT_TRUE(
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
3765 EXPECT_FALSE(expected_streams[i].temporal_layer_thresholds_bps.empty()); 3777 EXPECT_FALSE(expected_streams[i].temporal_layer_thresholds_bps.empty());
3766 EXPECT_EQ(expected_streams[i].temporal_layer_thresholds_bps, 3778 EXPECT_EQ(expected_streams[i].temporal_layer_thresholds_bps,
3767 video_streams[i].temporal_layer_thresholds_bps); 3779 video_streams[i].temporal_layer_thresholds_bps);
3768 3780
3769 if (i == num_streams - 1) { 3781 if (i == num_streams - 1) {
3770 total_max_bitrate_bps += video_streams[i].max_bitrate_bps; 3782 total_max_bitrate_bps += video_streams[i].max_bitrate_bps;
3771 } else { 3783 } else {
3772 total_max_bitrate_bps += video_streams[i].target_bitrate_bps; 3784 total_max_bitrate_bps += video_streams[i].target_bitrate_bps;
3773 } 3785 }
3774 } 3786 }
3775 cricket::VideoMediaInfo info;
3776 ASSERT_TRUE(channel_->GetStats(&info));
3777 ASSERT_EQ(1u, info.senders.size());
3778 EXPECT_EQ(total_max_bitrate_bps, info.senders[0].preferred_bitrate);
3779 3787
3780 EXPECT_TRUE(channel_->SetVideoSend(ssrcs.front(), true, nullptr, nullptr)); 3788 EXPECT_TRUE(channel_->SetVideoSend(ssrcs.front(), true, nullptr, nullptr));
3781 } 3789 }
3782 3790
3783 FakeVideoSendStream* AddSendStream() { 3791 FakeVideoSendStream* AddSendStream() {
3784 return AddSendStream(StreamParams::CreateLegacy(last_ssrc_++)); 3792 return AddSendStream(StreamParams::CreateLegacy(last_ssrc_++));
3785 } 3793 }
3786 3794
3787 FakeVideoSendStream* AddSendStream(const StreamParams& sp) { 3795 FakeVideoSendStream* AddSendStream(const StreamParams& sp) {
3788 size_t num_streams = 3796 size_t num_streams =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3827 } 3835 }
3828 3836
3829 // Test that we normalize send codec format size in simulcast. 3837 // Test that we normalize send codec format size in simulcast.
3830 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3838 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3831 cricket::VideoCodec codec(kVp8Codec270p); 3839 cricket::VideoCodec codec(kVp8Codec270p);
3832 codec.width += 1; 3840 codec.width += 1;
3833 codec.height += 1; 3841 codec.height += 1;
3834 VerifySimulcastSettings(codec, 2, 2); 3842 VerifySimulcastSettings(codec, 2, 2);
3835 } 3843 }
3836 } // namespace cricket 3844 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698