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

Unified Diff: remoting/protocol/connection_unittest.cc

Issue 2035803002: Fix WebRtcFrameScheduler to wait for first key frame request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/protocol/fake_session.h » ('j') | remoting/protocol/webrtc_frame_scheduler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/connection_unittest.cc
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc
index 6e96e3bcb46d32d061601908f2a992f13ba6a795..e4aadcb48ad0673d6dd944b3d03852d766f73b0e 100644
--- a/remoting/protocol/connection_unittest.cc
+++ b/remoting/protocol/connection_unittest.cc
@@ -75,13 +75,17 @@ class TestScreenCapturer : public webrtc::DesktopCapturer {
std::unique_ptr<webrtc::DesktopFrame> frame(
new webrtc::BasicDesktopFrame(webrtc::DesktopSize(100, 100)));
memset(frame->data(), 0, frame->stride() * frame->size().height());
- frame->mutable_updated_region()->SetRect(
- webrtc::DesktopRect::MakeSize(frame->size()));
+ if (!first_frame_sent_) {
+ first_frame_sent_ = true;
Irfan 2016/06/02 19:06:00 Can you please explain what this does ?
Sergey Ulanov 2016/06/03 06:01:23 added a comment.
+ frame->mutable_updated_region()->SetRect(
+ webrtc::DesktopRect::MakeSize(frame->size()));
+ }
callback_->OnCaptureCompleted(frame.release());
}
private:
Callback* callback_ = nullptr;
+ bool first_frame_sent_ = false;
};
} // namespace
@@ -188,6 +192,36 @@ class ConnectionTest : public testing::Test,
run_loop_->Quit();
}
+ void WaitFirstVideoFrame() {
+ base::RunLoop run_loop;
+
+ // Expect frames to be passed to FrameConsumer when WebRTC is used, or to
+ // VideoStub otherwise.
+ if (is_using_webrtc()) {
+ client_video_renderer_.GetFrameConsumer()->set_on_frame_callback(
+ base::Bind(&base::RunLoop::Quit, base::Unretained(&run_loop)));
+ } else {
+ client_video_renderer_.GetVideoStub()->set_on_frame_callback(
+ base::Bind(&base::RunLoop::Quit, base::Unretained(&run_loop)));
+ }
+
+ run_loop.Run();
+
+ if (is_using_webrtc()) {
+ EXPECT_EQ(
+ client_video_renderer_.GetFrameConsumer()->received_frames().size(),
+ 1U);
+ EXPECT_EQ(
+ client_video_renderer_.GetVideoStub()->received_packets().size(), 0U);
+ } else {
+ EXPECT_EQ(
+ client_video_renderer_.GetFrameConsumer()->received_frames().size(),
+ 0U);
+ EXPECT_EQ(
+ client_video_renderer_.GetVideoStub()->received_packets().size(), 1U);
+ }
+ }
+
base::MessageLoopForIO message_loop_;
std::unique_ptr<base::RunLoop> run_loop_;
@@ -285,34 +319,21 @@ TEST_P(ConnectionTest, Video) {
host_connection_->StartVideoStream(
base::WrapUnique(new TestScreenCapturer()));
- base::RunLoop run_loop;
+ WaitFirstVideoFrame();
+}
- // Expect frames to be passed to FrameConsumer when WebRTC is used, or to
- // VideoStub otherwise.
- if (is_using_webrtc()) {
- client_video_renderer_.GetFrameConsumer()->set_on_frame_callback(
- base::Bind(&base::RunLoop::Quit, base::Unretained(&run_loop)));
- } else {
- client_video_renderer_.GetVideoStub()->set_on_frame_callback(
- base::Bind(&base::RunLoop::Quit, base::Unretained(&run_loop)));
- }
+TEST_P(ConnectionTest, VideoAfterIceDelay) {
+ // Add signaling delay to slow down ICE.
+ host_session_->set_signaling_delay(base::TimeDelta::FromMilliseconds(200));
Irfan 2016/06/02 19:06:00 Comment seems to indicate this is ICE specific, bu
Sergey Ulanov 2016/06/03 06:01:23 ICE is used internally it WebRTC too. But this com
+ client_session_->set_signaling_delay(base::TimeDelta::FromMilliseconds(200));
- run_loop.Run();
+ Connect();
- if (is_using_webrtc()) {
- EXPECT_EQ(
- client_video_renderer_.GetFrameConsumer()->received_frames().size(),
- 1U);
- EXPECT_EQ(client_video_renderer_.GetVideoStub()->received_packets().size(),
- 0U);
- } else {
- EXPECT_EQ(
- client_video_renderer_.GetFrameConsumer()->received_frames().size(),
- 0U);
- EXPECT_EQ(client_video_renderer_.GetVideoStub()->received_packets().size(),
- 1U);
- }
+ std::unique_ptr<VideoStream> video_stream =
+ host_connection_->StartVideoStream(
+ base::WrapUnique(new TestScreenCapturer()));
+ WaitFirstVideoFrame();
}
} // namespace protocol
« no previous file with comments | « no previous file | remoting/protocol/fake_session.h » ('j') | remoting/protocol/webrtc_frame_scheduler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698