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

Side by Side Diff: remoting/protocol/connection_unittest.cc

Issue 2757923004: Fix failed capture handling in WebrtcVideoStream (Closed)
Patch Set: . Created 3 years, 9 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 Connect(); 628 Connect();
629 629
630 std::unique_ptr<AudioStream> audio_stream = 630 std::unique_ptr<AudioStream> audio_stream =
631 host_connection_->StartAudioStream(base::MakeUnique<TestAudioSource>()); 631 host_connection_->StartAudioStream(base::MakeUnique<TestAudioSource>());
632 632
633 // Wait for 1 second worth of audio samples. 633 // Wait for 1 second worth of audio samples.
634 client_audio_player_.WaitForSamples(kAudioSampleRate * 2); 634 client_audio_player_.WaitForSamples(kAudioSampleRate * 2);
635 client_audio_player_.Verify(); 635 client_audio_player_.Verify();
636 } 636 }
637 637
638 #if !defined(MEMORY_SANITIZER)
639 // Test fails under msan, https://crbug.com/697178
640 TEST_P(ConnectionTest, FirstCaptureFailed) { 638 TEST_P(ConnectionTest, FirstCaptureFailed) {
641 Connect(); 639 Connect();
642 640
643 base::TimeTicks event_timestamp = base::TimeTicks::FromInternalValue(42);
644
645 scoped_refptr<InputEventTimestampsSourceImpl> input_event_timestamps_source =
646 new InputEventTimestampsSourceImpl();
647 input_event_timestamps_source->OnEventReceived(
648 InputEventTimestamps{event_timestamp, base::TimeTicks::Now()});
649
650 auto capturer = base::MakeUnique<TestScreenCapturer>(); 641 auto capturer = base::MakeUnique<TestScreenCapturer>();
651 capturer->FailNthFrame(0); 642 capturer->FailNthFrame(0);
652 auto video_stream = host_connection_->StartVideoStream(std::move(capturer)); 643 auto video_stream = host_connection_->StartVideoStream(std::move(capturer));
653 video_stream->SetEventTimestampsSource(input_event_timestamps_source);
654 644
655 WaitNextVideoFrame(); 645 WaitNextVideoFrame();
656
657 // Currently stats work in this test only for WebRTC because for ICE
658 // connections stats are reported by SoftwareVideoRenderer which is not used
659 // in this test.
660 // TODO(sergeyu): Fix this.
661 if (is_using_webrtc()) {
662 WaitFirstFrameStats();
663
664 // Verify that the event timestamp received before the first frame gets used
665 // for the second frame.
666 const FrameStats& stats = client_video_renderer_.GetFrameStatsConsumer()
667 ->received_stats()
668 .front();
669 EXPECT_EQ(event_timestamp, stats.host_stats.latest_event_timestamp);
670 }
671 } 646 }
672 #endif
673 647
674 TEST_P(ConnectionTest, SecondCaptureFailed) { 648 TEST_P(ConnectionTest, SecondCaptureFailed) {
675 Connect(); 649 Connect();
676 650
677 auto capturer = base::MakeUnique<TestScreenCapturer>(); 651 auto capturer = base::MakeUnique<TestScreenCapturer>();
678 capturer->FailNthFrame(1); 652 capturer->FailNthFrame(1);
679 auto video_stream = host_connection_->StartVideoStream(std::move(capturer)); 653 auto video_stream = host_connection_->StartVideoStream(std::move(capturer));
680 654
681 WaitNextVideoFrame(); 655 WaitNextVideoFrame();
682 WaitNextVideoFrame(); 656 WaitNextVideoFrame();
683 } 657 }
684 658
685 } // namespace protocol 659 } // namespace protocol
686 } // namespace remoting 660 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/protocol/webrtc_frame_scheduler_simple.h » ('j') | remoting/protocol/webrtc_frame_scheduler_simple.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698