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

Side by Side Diff: content/renderer/media/webrtc/mock_peer_connection_dependency_factory.cc

Issue 1729683002: Remove old-style constraints from Chrome internals (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Complete the interface change Created 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory. h" 5 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory. h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 MockVideoRenderer::MockVideoRenderer() 160 MockVideoRenderer::MockVideoRenderer()
161 : num_(0) {} 161 : num_(0) {}
162 162
163 MockVideoRenderer::~MockVideoRenderer() {} 163 MockVideoRenderer::~MockVideoRenderer() {}
164 164
165 bool MockVideoRenderer::RenderFrame(const cricket::VideoFrame* frame) { 165 bool MockVideoRenderer::RenderFrame(const cricket::VideoFrame* frame) {
166 ++num_; 166 ++num_;
167 return true; 167 return true;
168 } 168 }
169 169
170 MockAudioSource::MockAudioSource( 170 MockAudioSource::MockAudioSource(const cricket::AudioOptions& options,
171 const webrtc::MediaConstraintsInterface* constraints, bool remote) 171 bool remote)
172 : remote_(remote), state_(MediaSourceInterface::kLive), 172 : remote_(remote), state_(MediaSourceInterface::kLive) {}
173 optional_constraints_(constraints->GetOptional()),
174 mandatory_constraints_(constraints->GetMandatory()) {
175 }
176 173
177 MockAudioSource::~MockAudioSource() {} 174 MockAudioSource::~MockAudioSource() {}
178 175
179 void MockAudioSource::RegisterObserver(webrtc::ObserverInterface* observer) { 176 void MockAudioSource::RegisterObserver(webrtc::ObserverInterface* observer) {
180 DCHECK(observers_.find(observer) == observers_.end()); 177 DCHECK(observers_.find(observer) == observers_.end());
181 observers_.insert(observer); 178 observers_.insert(observer);
182 } 179 }
183 180
184 void MockAudioSource::UnregisterObserver(webrtc::ObserverInterface* observer) { 181 void MockAudioSource::UnregisterObserver(webrtc::ObserverInterface* observer) {
185 DCHECK(observers_.find(observer) != observers_.end()); 182 DCHECK(observers_.find(observer) != observers_.end());
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 MockPeerConnectionDependencyFactory::MockPeerConnectionDependencyFactory() 330 MockPeerConnectionDependencyFactory::MockPeerConnectionDependencyFactory()
334 : PeerConnectionDependencyFactory(NULL), 331 : PeerConnectionDependencyFactory(NULL),
335 fail_to_create_next_audio_capturer_(false) { 332 fail_to_create_next_audio_capturer_(false) {
336 } 333 }
337 334
338 MockPeerConnectionDependencyFactory::~MockPeerConnectionDependencyFactory() {} 335 MockPeerConnectionDependencyFactory::~MockPeerConnectionDependencyFactory() {}
339 336
340 scoped_refptr<webrtc::PeerConnectionInterface> 337 scoped_refptr<webrtc::PeerConnectionInterface>
341 MockPeerConnectionDependencyFactory::CreatePeerConnection( 338 MockPeerConnectionDependencyFactory::CreatePeerConnection(
342 const webrtc::PeerConnectionInterface::RTCConfiguration& config, 339 const webrtc::PeerConnectionInterface::RTCConfiguration& config,
343 const webrtc::MediaConstraintsInterface* constraints,
344 blink::WebFrame* frame, 340 blink::WebFrame* frame,
345 webrtc::PeerConnectionObserver* observer) { 341 webrtc::PeerConnectionObserver* observer) {
346 return new rtc::RefCountedObject<MockPeerConnectionImpl>(this, observer); 342 return new rtc::RefCountedObject<MockPeerConnectionImpl>(this, observer);
347 } 343 }
348 344
349 scoped_refptr<webrtc::AudioSourceInterface> 345 scoped_refptr<webrtc::AudioSourceInterface>
350 MockPeerConnectionDependencyFactory::CreateLocalAudioSource( 346 MockPeerConnectionDependencyFactory::CreateLocalAudioSource(
351 const webrtc::MediaConstraintsInterface* constraints) { 347 const cricket::AudioOptions& options) {
352 last_audio_source_ = 348 last_audio_source_ =
353 new rtc::RefCountedObject<MockAudioSource>(constraints, false); 349 new rtc::RefCountedObject<MockAudioSource>(options, false);
354 return last_audio_source_; 350 return last_audio_source_;
355 } 351 }
356 352
357 WebRtcVideoCapturerAdapter* 353 WebRtcVideoCapturerAdapter*
358 MockPeerConnectionDependencyFactory::CreateVideoCapturer( 354 MockPeerConnectionDependencyFactory::CreateVideoCapturer(
359 bool is_screen_capture) { 355 bool is_screen_capture) {
360 return new MockRtcVideoCapturer(is_screen_capture); 356 return new MockRtcVideoCapturer(is_screen_capture);
361 } 357 }
362 358
363 scoped_refptr<webrtc::VideoTrackSourceInterface> 359 scoped_refptr<webrtc::VideoTrackSourceInterface>
364 MockPeerConnectionDependencyFactory::CreateVideoSource( 360 MockPeerConnectionDependencyFactory::CreateVideoSource(
365 cricket::VideoCapturer* capturer, 361 cricket::VideoCapturer* capturer) {
366 const blink::WebMediaConstraints& constraints) {
367 // Video source normally take ownership of |capturer|. 362 // Video source normally take ownership of |capturer|.
368 delete capturer; 363 delete capturer;
369 NOTIMPLEMENTED(); 364 NOTIMPLEMENTED();
370 return nullptr; 365 return nullptr;
371 } 366 }
372 367
373 void MockPeerConnectionDependencyFactory::CreateWebAudioSource( 368 void MockPeerConnectionDependencyFactory::CreateWebAudioSource(
374 blink::WebMediaStreamSource* source) {} 369 blink::WebMediaStreamSource* source) {}
375 370
376 scoped_refptr<webrtc::MediaStreamInterface> 371 scoped_refptr<webrtc::MediaStreamInterface>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 if (fail_to_create_next_audio_capturer_) { 416 if (fail_to_create_next_audio_capturer_) {
422 fail_to_create_next_audio_capturer_ = false; 417 fail_to_create_next_audio_capturer_ = false;
423 return NULL; 418 return NULL;
424 } 419 }
425 DCHECK(audio_source); 420 DCHECK(audio_source);
426 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, constraints, NULL, 421 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, constraints, NULL,
427 audio_source); 422 audio_source);
428 } 423 }
429 424
430 } // namespace content 425 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698