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

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

Issue 2911193002: Implement timing frames. (Closed)
Patch Set: Implement Asapersson@ comments and foolproof generic encoder to be used in tests Created 3 years, 6 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> // max 10 #include <algorithm> // max
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 void PerformTest() override { 330 void PerformTest() override {
331 EXPECT_TRUE(Wait()) << "Timed out while waiting for single RTP packet."; 331 EXPECT_TRUE(Wait()) << "Timed out while waiting for single RTP packet.";
332 } 332 }
333 } test; 333 } test;
334 334
335 test::ScopedFieldTrials override_field_trials( 335 test::ScopedFieldTrials override_field_trials(
336 "WebRTC-VideoContentTypeExtension/Enabled/"); 336 "WebRTC-VideoContentTypeExtension/Enabled/");
337 RunBaseTest(&test); 337 RunBaseTest(&test);
338 } 338 }
339 339
340 TEST_F(VideoSendStreamTest, SupportsVideoTimingFrames) {
341 class VideoRotationObserver : public test::SendTest {
342 public:
343 VideoRotationObserver()
344 : SendTest(kDefaultTimeoutMs) {
345 EXPECT_TRUE(parser_->RegisterRtpHeaderExtension(
346 kRtpExtensionVideoTiming, test::kVideoTimingExtensionId));
347 }
348
349 Action OnSendRtp(const uint8_t* packet, size_t length) override {
350 RTPHeader header;
351 EXPECT_TRUE(parser_->Parse(packet, length, &header));
352 if (header.extension.hasVideoTiming) {
353 observation_complete_.Set();
354 }
355 return SEND_PACKET;
356 }
357
358 void ModifyVideoConfigs(
359 VideoSendStream::Config* send_config,
360 std::vector<VideoReceiveStream::Config>* receive_configs,
361 VideoEncoderConfig* encoder_config) override {
362 send_config->rtp.extensions.clear();
363 send_config->rtp.extensions.push_back(RtpExtension(
364 RtpExtension::kVideoTimingUri, test::kVideoTimingExtensionId));
365 }
366
367 void PerformTest() override {
368 EXPECT_TRUE(Wait()) << "Timed out while waiting for timing frames.";
369 }
370 } test;
371
372 RunBaseTest(&test);
373 }
374
340 class FakeReceiveStatistics : public NullReceiveStatistics { 375 class FakeReceiveStatistics : public NullReceiveStatistics {
341 public: 376 public:
342 FakeReceiveStatistics(uint32_t send_ssrc, 377 FakeReceiveStatistics(uint32_t send_ssrc,
343 uint32_t last_sequence_number, 378 uint32_t last_sequence_number,
344 uint32_t cumulative_lost, 379 uint32_t cumulative_lost,
345 uint8_t fraction_lost) 380 uint8_t fraction_lost)
346 : lossy_stats_(new LossyStatistician(last_sequence_number, 381 : lossy_stats_(new LossyStatistician(last_sequence_number,
347 cumulative_lost, 382 cumulative_lost,
348 fraction_lost)) { 383 fraction_lost)) {
349 stats_map_[send_ssrc] = lossy_stats_.get(); 384 stats_map_[send_ssrc] = lossy_stats_.get();
(...skipping 2984 matching lines...) Expand 10 before | Expand all | Expand 10 after
3334 rtc::CriticalSection crit_; 3369 rtc::CriticalSection crit_;
3335 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); 3370 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_);
3336 bool first_packet_sent_ GUARDED_BY(&crit_); 3371 bool first_packet_sent_ GUARDED_BY(&crit_);
3337 rtc::Event bitrate_changed_event_; 3372 rtc::Event bitrate_changed_event_;
3338 } test; 3373 } test;
3339 3374
3340 RunBaseTest(&test); 3375 RunBaseTest(&test);
3341 } 3376 }
3342 3377
3343 } // namespace webrtc 3378 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698