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

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

Issue 1522903002: Add a 'remote' property to MediaSourceInterface. Also adding an implementation to the relevant sour… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address comments Created 5 years 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
« no previous file with comments | « talk/app/webrtc/videosource.cc ('k') | talk/app/webrtc/videosourceproxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ASSERT_TRUE(channel_manager_->Init()); 137 ASSERT_TRUE(channel_manager_->Init());
138 } 138 }
139 139
140 void CreateVideoSource() { 140 void CreateVideoSource() {
141 CreateVideoSource(NULL); 141 CreateVideoSource(NULL);
142 } 142 }
143 143
144 void CreateVideoSource( 144 void CreateVideoSource(
145 const webrtc::MediaConstraintsInterface* constraints) { 145 const webrtc::MediaConstraintsInterface* constraints) {
146 // VideoSource take ownership of |capturer_| 146 // VideoSource take ownership of |capturer_|
147 source_ = VideoSource::Create(channel_manager_.get(), 147 source_ =
148 capturer_cleanup_.release(), 148 VideoSource::Create(channel_manager_.get(), capturer_cleanup_.release(),
149 constraints); 149 constraints, false);
150 150
151 ASSERT_TRUE(source_.get() != NULL); 151 ASSERT_TRUE(source_.get() != NULL);
152 EXPECT_EQ(capturer_, source_->GetVideoCapturer()); 152 EXPECT_EQ(capturer_, source_->GetVideoCapturer());
153 153
154 state_observer_.reset(new StateObserver(source_)); 154 state_observer_.reset(new StateObserver(source_));
155 source_->RegisterObserver(state_observer_.get()); 155 source_->RegisterObserver(state_observer_.get());
156 source_->AddSink(&renderer_); 156 source_->AddSink(&renderer_);
157 } 157 }
158 158
159 rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_; 159 rtc::scoped_ptr<TestVideoCapturer> capturer_cleanup_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Test start stop with a remote VideoSource - the video source that has a 209 // Test start stop with a remote VideoSource - the video source that has a
210 // RemoteVideoCapturer and takes video frames from FrameInput. 210 // RemoteVideoCapturer and takes video frames from FrameInput.
211 TEST_F(VideoSourceTest, StartStopRemote) { 211 TEST_F(VideoSourceTest, StartStopRemote) {
212 source_ = VideoSource::Create(channel_manager_.get(), 212 source_ = VideoSource::Create(channel_manager_.get(),
213 new webrtc::RemoteVideoCapturer(), 213 new webrtc::RemoteVideoCapturer(), NULL, true);
214 NULL);
215 214
216 ASSERT_TRUE(source_.get() != NULL); 215 ASSERT_TRUE(source_.get() != NULL);
217 EXPECT_TRUE(NULL != source_->GetVideoCapturer()); 216 EXPECT_TRUE(NULL != source_->GetVideoCapturer());
218 217
219 state_observer_.reset(new StateObserver(source_)); 218 state_observer_.reset(new StateObserver(source_));
220 source_->RegisterObserver(state_observer_.get()); 219 source_->RegisterObserver(state_observer_.get());
221 source_->AddSink(&renderer_); 220 source_->AddSink(&renderer_);
222 221
223 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), 222 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
224 kMaxWaitMs); 223 kMaxWaitMs);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5); 544 constraints.AddOptional(MediaConstraintsInterface::kMaxFrameRate, 0.5);
546 545
547 CreateVideoSource(&constraints); 546 CreateVideoSource(&constraints);
548 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(), 547 EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
549 kMaxWaitMs); 548 kMaxWaitMs);
550 const cricket::VideoFormat* format = capturer_->GetCaptureFormat(); 549 const cricket::VideoFormat* format = capturer_->GetCaptureFormat();
551 ASSERT_TRUE(format != NULL); 550 ASSERT_TRUE(format != NULL);
552 EXPECT_EQ(30, format->framerate()); 551 EXPECT_EQ(30, format->framerate());
553 } 552 }
554 553
OLDNEW
« no previous file with comments | « talk/app/webrtc/videosource.cc ('k') | talk/app/webrtc/videosourceproxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698