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

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

Issue 2911193002: Implement timing frames. (Closed)
Patch Set: Implement Asapersson@ comments 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), timing_frame_observed_(false) {
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 timing_frame_observed_ = true;
sprang_webrtc 2017/06/13 14:14:14 Do you need this variable?
ilnik 2017/06/13 14:55:44 You are right, it's not needed, because if observa
355 }
356 return SEND_PACKET;
357 }
358
359 void ModifyVideoConfigs(
360 VideoSendStream::Config* send_config,
361 std::vector<VideoReceiveStream::Config>* receive_configs,
362 VideoEncoderConfig* encoder_config) override {
363 send_config->rtp.extensions.clear();
364 send_config->rtp.extensions.push_back(RtpExtension(
365 RtpExtension::kVideoTimingUri, test::kVideoTimingExtensionId));
366 }
367
368 void PerformTest() override {
369 EXPECT_TRUE(Wait()) << "Timed out while waiting for timing frames.";
370 }
371
372 bool timing_frame_observed_;
373 } test;
374
375 RunBaseTest(&test);
376 EXPECT_TRUE(test.timing_frame_observed_);
377 }
378
340 class FakeReceiveStatistics : public NullReceiveStatistics { 379 class FakeReceiveStatistics : public NullReceiveStatistics {
341 public: 380 public:
342 FakeReceiveStatistics(uint32_t send_ssrc, 381 FakeReceiveStatistics(uint32_t send_ssrc,
343 uint32_t last_sequence_number, 382 uint32_t last_sequence_number,
344 uint32_t cumulative_lost, 383 uint32_t cumulative_lost,
345 uint8_t fraction_lost) 384 uint8_t fraction_lost)
346 : lossy_stats_(new LossyStatistician(last_sequence_number, 385 : lossy_stats_(new LossyStatistician(last_sequence_number,
347 cumulative_lost, 386 cumulative_lost,
348 fraction_lost)) { 387 fraction_lost)) {
349 stats_map_[send_ssrc] = lossy_stats_.get(); 388 stats_map_[send_ssrc] = lossy_stats_.get();
(...skipping 2984 matching lines...) Expand 10 before | Expand all | Expand 10 after
3334 rtc::CriticalSection crit_; 3373 rtc::CriticalSection crit_;
3335 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_); 3374 uint32_t max_bitrate_bps_ GUARDED_BY(&crit_);
3336 bool first_packet_sent_ GUARDED_BY(&crit_); 3375 bool first_packet_sent_ GUARDED_BY(&crit_);
3337 rtc::Event bitrate_changed_event_; 3376 rtc::Event bitrate_changed_event_;
3338 } test; 3377 } test;
3339 3378
3340 RunBaseTest(&test); 3379 RunBaseTest(&test);
3341 } 3380 }
3342 3381
3343 } // namespace webrtc 3382 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698