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

Side by Side Diff: webrtc/video/end_to_end_tests.cc

Issue 2625893004: Signal target bitrate only for screenshare streams (Closed)
Patch Set: Renamed parameter Created 3 years, 11 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
« no previous file with comments | « no previous file | webrtc/video/video_send_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <algorithm> 10 #include <algorithm>
(...skipping 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 2989
2990 // TODO(philipel): Implement statistics for the new video jitter buffer. 2990 // TODO(philipel): Implement statistics for the new video jitter buffer.
2991 if (GetParam() == new_jb_enabled) 2991 if (GetParam() == new_jb_enabled)
2992 return; 2992 return;
2993 2993
2994 RunBaseTest(&test); 2994 RunBaseTest(&test);
2995 } 2995 }
2996 2996
2997 class RtcpXrObserver : public test::EndToEndTest { 2997 class RtcpXrObserver : public test::EndToEndTest {
2998 public: 2998 public:
2999 explicit RtcpXrObserver(bool enable_rrtr) 2999 RtcpXrObserver(bool enable_rrtr, bool enable_target_bitrate)
3000 : EndToEndTest(test::CallTest::kDefaultTimeoutMs), 3000 : EndToEndTest(test::CallTest::kDefaultTimeoutMs),
3001 enable_rrtr_(enable_rrtr), 3001 enable_rrtr_(enable_rrtr),
3002 enable_target_bitrate_(enable_target_bitrate),
3002 sent_rtcp_sr_(0), 3003 sent_rtcp_sr_(0),
3003 sent_rtcp_rr_(0), 3004 sent_rtcp_rr_(0),
3004 sent_rtcp_rrtr_(0), 3005 sent_rtcp_rrtr_(0),
3005 sent_rtcp_target_bitrate_(false), 3006 sent_rtcp_target_bitrate_(false),
3006 sent_rtcp_dlrr_(0) {} 3007 sent_rtcp_dlrr_(0) {}
3007 3008
3008 private: 3009 private:
3009 // Receive stream should send RR packets (and RRTR packets if enabled). 3010 // Receive stream should send RR packets (and RRTR packets if enabled).
3010 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { 3011 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
3011 rtc::CritScope lock(&crit_); 3012 rtc::CritScope lock(&crit_);
(...skipping 22 matching lines...) Expand all
3034 if (parser.xr()->num_packets() > 0) { 3035 if (parser.xr()->num_packets() > 0) {
3035 EXPECT_FALSE(parser.xr()->rrtr()); 3036 EXPECT_FALSE(parser.xr()->rrtr());
3036 if (parser.xr()->dlrr()) 3037 if (parser.xr()->dlrr())
3037 ++sent_rtcp_dlrr_; 3038 ++sent_rtcp_dlrr_;
3038 if (parser.xr()->target_bitrate()) 3039 if (parser.xr()->target_bitrate())
3039 sent_rtcp_target_bitrate_ = true; 3040 sent_rtcp_target_bitrate_ = true;
3040 } 3041 }
3041 3042
3042 if (sent_rtcp_sr_ > kNumRtcpReportPacketsToObserve && 3043 if (sent_rtcp_sr_ > kNumRtcpReportPacketsToObserve &&
3043 sent_rtcp_rr_ > kNumRtcpReportPacketsToObserve && 3044 sent_rtcp_rr_ > kNumRtcpReportPacketsToObserve &&
3044 sent_rtcp_target_bitrate_) { 3045 (sent_rtcp_target_bitrate_ || !enable_target_bitrate_)) {
3045 if (enable_rrtr_) { 3046 if (enable_rrtr_) {
3046 EXPECT_GT(sent_rtcp_rrtr_, 0); 3047 EXPECT_GT(sent_rtcp_rrtr_, 0);
3047 EXPECT_GT(sent_rtcp_dlrr_, 0); 3048 EXPECT_GT(sent_rtcp_dlrr_, 0);
3048 } else { 3049 } else {
3049 EXPECT_EQ(sent_rtcp_rrtr_, 0); 3050 EXPECT_EQ(sent_rtcp_rrtr_, 0);
3050 EXPECT_EQ(sent_rtcp_dlrr_, 0); 3051 EXPECT_EQ(sent_rtcp_dlrr_, 0);
3051 } 3052 }
3053 EXPECT_EQ(enable_target_bitrate_, sent_rtcp_target_bitrate_);
3052 observation_complete_.Set(); 3054 observation_complete_.Set();
3053 } 3055 }
3054 return SEND_PACKET; 3056 return SEND_PACKET;
3055 } 3057 }
3056 3058
3057 void ModifyVideoConfigs( 3059 void ModifyVideoConfigs(
3058 VideoSendStream::Config* send_config, 3060 VideoSendStream::Config* send_config,
3059 std::vector<VideoReceiveStream::Config>* receive_configs, 3061 std::vector<VideoReceiveStream::Config>* receive_configs,
3060 VideoEncoderConfig* encoder_config) override { 3062 VideoEncoderConfig* encoder_config) override {
3063 if (enable_target_bitrate_) {
3064 // TargetBitrate only signaled for screensharing.
3065 encoder_config->content_type = VideoEncoderConfig::ContentType::kScreen;
3066 }
3061 (*receive_configs)[0].rtp.rtcp_mode = RtcpMode::kReducedSize; 3067 (*receive_configs)[0].rtp.rtcp_mode = RtcpMode::kReducedSize;
3062 (*receive_configs)[0].rtp.rtcp_xr.receiver_reference_time_report = 3068 (*receive_configs)[0].rtp.rtcp_xr.receiver_reference_time_report =
3063 enable_rrtr_; 3069 enable_rrtr_;
3064 } 3070 }
3065 3071
3066 void PerformTest() override { 3072 void PerformTest() override {
3067 EXPECT_TRUE(Wait()) 3073 EXPECT_TRUE(Wait())
3068 << "Timed out while waiting for RTCP SR/RR packets to be sent."; 3074 << "Timed out while waiting for RTCP SR/RR packets to be sent.";
3069 } 3075 }
3070 3076
3071 static const int kNumRtcpReportPacketsToObserve = 5; 3077 static const int kNumRtcpReportPacketsToObserve = 5;
3072 3078
3073 rtc::CriticalSection crit_; 3079 rtc::CriticalSection crit_;
3074 bool enable_rrtr_; 3080 const bool enable_rrtr_;
3081 const bool enable_target_bitrate_;
3075 int sent_rtcp_sr_; 3082 int sent_rtcp_sr_;
3076 int sent_rtcp_rr_ GUARDED_BY(&crit_); 3083 int sent_rtcp_rr_ GUARDED_BY(&crit_);
3077 int sent_rtcp_rrtr_ GUARDED_BY(&crit_); 3084 int sent_rtcp_rrtr_ GUARDED_BY(&crit_);
3078 bool sent_rtcp_target_bitrate_ GUARDED_BY(&crit_); 3085 bool sent_rtcp_target_bitrate_ GUARDED_BY(&crit_);
3079 int sent_rtcp_dlrr_; 3086 int sent_rtcp_dlrr_;
3080 }; 3087 };
3081 3088
3082 TEST_P(EndToEndTest, TestExtendedReportsWithRrtr) { 3089 TEST_P(EndToEndTest, TestExtendedReportsWithRrtrWithoutTargetBitrate) {
3083 RtcpXrObserver test(true); 3090 RtcpXrObserver test(true, false);
3084 RunBaseTest(&test); 3091 RunBaseTest(&test);
3085 } 3092 }
3086 3093
3087 TEST_P(EndToEndTest, TestExtendedReportsWithoutRrtr) { 3094 TEST_P(EndToEndTest, TestExtendedReportsWithoutRrtrWithoutTargetBitrate) {
3088 RtcpXrObserver test(false); 3095 RtcpXrObserver test(false, false);
3089 RunBaseTest(&test); 3096 RunBaseTest(&test);
3090 } 3097 }
3091 3098
3099 TEST_P(EndToEndTest, TestExtendedReportsWithRrtrWithTargetBitrate) {
3100 RtcpXrObserver test(true, true);
3101 RunBaseTest(&test);
3102 }
3103
3104 TEST_P(EndToEndTest, TestExtendedReportsWithoutRrtrWithTargetBitrate) {
3105 RtcpXrObserver test(false, true);
3106 RunBaseTest(&test);
3107 }
3108
3092 TEST_P(EndToEndTest, TestReceivedRtpPacketStats) { 3109 TEST_P(EndToEndTest, TestReceivedRtpPacketStats) {
3093 static const size_t kNumRtpPacketsToSend = 5; 3110 static const size_t kNumRtpPacketsToSend = 5;
3094 class ReceivedRtpStatsObserver : public test::EndToEndTest { 3111 class ReceivedRtpStatsObserver : public test::EndToEndTest {
3095 public: 3112 public:
3096 ReceivedRtpStatsObserver() 3113 ReceivedRtpStatsObserver()
3097 : EndToEndTest(kDefaultTimeoutMs), 3114 : EndToEndTest(kDefaultTimeoutMs),
3098 receive_stream_(nullptr), 3115 receive_stream_(nullptr),
3099 sent_rtp_(0) {} 3116 sent_rtp_(0) {}
3100 3117
3101 private: 3118 private:
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
4065 std::unique_ptr<VideoEncoder> encoder_; 4082 std::unique_ptr<VideoEncoder> encoder_;
4066 std::unique_ptr<VideoDecoder> decoder_; 4083 std::unique_ptr<VideoDecoder> decoder_;
4067 rtc::CriticalSection crit_; 4084 rtc::CriticalSection crit_;
4068 int recorded_frames_ GUARDED_BY(crit_); 4085 int recorded_frames_ GUARDED_BY(crit_);
4069 } test(this); 4086 } test(this);
4070 4087
4071 RunBaseTest(&test); 4088 RunBaseTest(&test);
4072 } 4089 }
4073 4090
4074 } // namespace webrtc 4091 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/video_send_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698