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

Side by Side Diff: talk/app/webrtc/videosource_unittest.cc

Issue 1664773002: Added VideoTrackInterface::GetSink method, for use by VideoRtpReceiver. Get rid of FrameInput. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Delete FrameInput method and FrameInputWrapper class. Created 4 years, 10 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 * libjingle 2 * libjingle
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 source_->Restart(); 199 source_->Restart();
200 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), 200 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
201 kMaxWaitMs); 201 kMaxWaitMs);
202 202
203 ASSERT_TRUE(capturer_->CaptureFrame()); 203 ASSERT_TRUE(capturer_->CaptureFrame());
204 EXPECT_EQ(2, renderer_.num_rendered_frames()); 204 EXPECT_EQ(2, renderer_.num_rendered_frames());
205 205
206 source_->Stop(); 206 source_->Stop();
207 } 207 }
208 208
209 #if 0
209 // Test start stop with a remote VideoSource - the video source that has a 210 // Test start stop with a remote VideoSource - the video source that has a
210 // RemoteVideoCapturer and takes video frames from FrameInput. 211 // RemoteVideoCapturer and takes video frames from FrameInput.
211 TEST_F(VideoSourceTest, StartStopRemote) { 212 TEST_F(VideoSourceTest, StartStopRemote) {
212 source_ = VideoSource::Create(channel_manager_.get(), 213 source_ = VideoSource::Create(channel_manager_.get(),
213 new webrtc::RemoteVideoCapturer(), NULL, true); 214 new webrtc::RemoteVideoCapturer(), NULL, true);
214 215
215 ASSERT_TRUE(source_.get() != NULL); 216 ASSERT_TRUE(source_.get() != NULL);
216 EXPECT_TRUE(NULL != source_->GetVideoCapturer()); 217 EXPECT_TRUE(NULL != source_->GetVideoCapturer());
217 218
218 state_observer_.reset(new StateObserver(source_)); 219 state_observer_.reset(new StateObserver(source_));
219 source_->RegisterObserver(state_observer_.get()); 220 source_->RegisterObserver(state_observer_.get());
220 source_->AddSink(&renderer_); 221 source_->AddSink(&renderer_);
221 222
222 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), 223 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
223 kMaxWaitMs); 224 kMaxWaitMs);
224 225
225 cricket::VideoRenderer* frameinput = source_->FrameInput(); 226 cricket::VideoRenderer* frameinput = source_->FrameInput();
226 cricket::WebRtcVideoFrame test_frame; 227 cricket::WebRtcVideoFrame test_frame;
227 frameinput->RenderFrame(&test_frame); 228 frameinput->RenderFrame(&test_frame);
228 EXPECT_EQ(1, renderer_.num_rendered_frames()); 229 EXPECT_EQ(1, renderer_.num_rendered_frames());
229 230
230 source_->GetVideoCapturer()->Stop(); 231 source_->GetVideoCapturer()->Stop();
231 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), 232 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
232 kMaxWaitMs); 233 kMaxWaitMs);
233 } 234 }
235 #endif
234 236
235 // Test that a VideoSource transition to kEnded if the capture device 237 // Test that a VideoSource transition to kEnded if the capture device
236 // fails. 238 // fails.
237 TEST_F(VideoSourceTest, CameraFailed) { 239 TEST_F(VideoSourceTest, CameraFailed) {
238 CreateVideoSource(); 240 CreateVideoSource();
239 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), 241 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
240 kMaxWaitMs); 242 kMaxWaitMs);
241 243
242 capturer_->SignalStateChange(capturer_, cricket::CS_FAILED); 244 capturer_->SignalStateChange(capturer_, cricket::CS_FAILED);
243 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(), 245 EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 FakeConstraints constraints; 544 FakeConstraints constraints;
543 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); 545 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5);
544 546
545 CreateVideoSource(&constraints); 547 CreateVideoSource(&constraints);
546 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), 548 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
547 kMaxWaitMs); 549 kMaxWaitMs);
548 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); 550 const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
549 ASSERT_TRUE(format != NULL); 551 ASSERT_TRUE(format != NULL);
550 EXPECT_EQ(30, format->framerate()); 552 EXPECT_EQ(30, format->framerate());
551 } 553 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698