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

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

Issue 2853503002: Dont request keyframes if the stream is inactive or if we are currently receiving a keyframe. (Closed)
Patch Set: Added EndToEndTest. Created 3 years, 7 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) 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 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 test::PacketTransport* receive_transport_; 2222 test::PacketTransport* receive_transport_;
2223 rtc::Event stop_event_; 2223 rtc::Event stop_event_;
2224 rtc::PlatformThread poller_thread_; 2224 rtc::PlatformThread poller_thread_;
2225 TestState state_; 2225 TestState state_;
2226 RateLimiter retransmission_rate_limiter_; 2226 RateLimiter retransmission_rate_limiter_;
2227 } test; 2227 } test;
2228 2228
2229 RunBaseTest(&test); 2229 RunBaseTest(&test);
2230 } 2230 }
2231 2231
2232 TEST_F(EndToEndTest, StopSendingKeyframeRequestsForInactiveStream) {
2233 class KeyframeRequestObserver : public test::EndToEndTest {
2234 public:
2235 KeyframeRequestObserver() {}
2236
2237 void OnVideoStreamsCreated(
2238 VideoSendStream* send_stream,
2239 const std::vector<VideoReceiveStream*>& receive_streams) override {
2240 RTC_DCHECK_EQ(1, receive_streams.size());
2241 send_stream_ = send_stream;
2242 receive_stream_ = receive_streams[0];
2243 }
2244
2245 void PerformTest() override {
2246 bool frame_decoded = false;
2247 for (int i = 0; i < 50; ++i) {
stefan-webrtc 2017/05/17 06:32:11 Change this to a while loop checking the time sinc
philipel 2017/05/18 09:23:40 Done.
2248 if (receive_stream_->GetStats().frames_decoded > 0) {
2249 frame_decoded = true;
2250 break;
2251 }
2252 SleepMs(100);
2253 }
2254 ASSERT_TRUE(frame_decoded);
2255 send_stream_->Stop();
2256 SleepMs(10000);
2257 ASSERT_EQ(
2258 1U, receive_stream_->GetStats().rtcp_packet_type_counts.pli_packets);
2259 }
2260
2261 private:
2262 VideoSendStream* send_stream_;
2263 VideoReceiveStream* receive_stream_;
2264 } test;
2265
2266 RunBaseTest(&test);
2267 }
2268
2232 class ProbingTest : public test::EndToEndTest { 2269 class ProbingTest : public test::EndToEndTest {
2233 public: 2270 public:
2234 explicit ProbingTest(int start_bitrate_bps) 2271 explicit ProbingTest(int start_bitrate_bps)
2235 : clock_(Clock::GetRealTimeClock()), 2272 : clock_(Clock::GetRealTimeClock()),
2236 start_bitrate_bps_(start_bitrate_bps), 2273 start_bitrate_bps_(start_bitrate_bps),
2237 state_(0), 2274 state_(0),
2238 sender_call_(nullptr) {} 2275 sender_call_(nullptr) {}
2239 2276
2240 ~ProbingTest() {} 2277 ~ProbingTest() {}
2241 2278
(...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after
4470 std::unique_ptr<VideoEncoder> encoder_; 4507 std::unique_ptr<VideoEncoder> encoder_;
4471 std::unique_ptr<VideoDecoder> decoder_; 4508 std::unique_ptr<VideoDecoder> decoder_;
4472 rtc::CriticalSection crit_; 4509 rtc::CriticalSection crit_;
4473 int recorded_frames_ GUARDED_BY(crit_); 4510 int recorded_frames_ GUARDED_BY(crit_);
4474 } test(this); 4511 } test(this);
4475 4512
4476 RunBaseTest(&test); 4513 RunBaseTest(&test);
4477 } 4514 }
4478 4515
4479 } // namespace webrtc 4516 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698