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

Side by Side Diff: webrtc/examples/peerconnection/client/conductor.cc

Issue 1715883002: Remove DeviceManager and DeviceInfo. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase 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 /* 1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/examples/peerconnection/client/conductor.h" 11 #include "webrtc/examples/peerconnection/client/conductor.h"
12 12
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/api/videosourceinterface.h" 16 #include "webrtc/api/videosourceinterface.h"
17 #include "webrtc/api/test/fakeconstraints.h" 17 #include "webrtc/api/test/fakeconstraints.h"
18 #include "webrtc/base/common.h" 18 #include "webrtc/base/common.h"
19 #include "webrtc/base/json.h" 19 #include "webrtc/base/json.h"
20 #include "webrtc/base/logging.h" 20 #include "webrtc/base/logging.h"
21 #include "webrtc/examples/peerconnection/client/defaults.h" 21 #include "webrtc/examples/peerconnection/client/defaults.h"
22 #include "webrtc/media/devices/devicemanager.h"
23 22
24 // Names used for a IceCandidate JSON object. 23 // Names used for a IceCandidate JSON object.
25 const char kCandidateSdpMidName[] = "sdpMid"; 24 const char kCandidateSdpMidName[] = "sdpMid";
26 const char kCandidateSdpMlineIndexName[] = "sdpMLineIndex"; 25 const char kCandidateSdpMlineIndexName[] = "sdpMLineIndex";
27 const char kCandidateSdpName[] = "candidate"; 26 const char kCandidateSdpName[] = "candidate";
28 27
29 // Names used for a SessionDescription JSON object. 28 // Names used for a SessionDescription JSON object.
30 const char kSessionDescriptionTypeName[] = "type"; 29 const char kSessionDescriptionTypeName[] = "type";
31 const char kSessionDescriptionSdpName[] = "sdp"; 30 const char kSessionDescriptionSdpName[] = "sdp";
32 31
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 361
363 if (InitializePeerConnection()) { 362 if (InitializePeerConnection()) {
364 peer_id_ = peer_id; 363 peer_id_ = peer_id;
365 peer_connection_->CreateOffer(this, NULL); 364 peer_connection_->CreateOffer(this, NULL);
366 } else { 365 } else {
367 main_wnd_->MessageBox("Error", "Failed to initialize PeerConnection", true); 366 main_wnd_->MessageBox("Error", "Failed to initialize PeerConnection", true);
368 } 367 }
369 } 368 }
370 369
371 cricket::VideoCapturer* Conductor::OpenVideoCaptureDevice() { 370 cricket::VideoCapturer* Conductor::OpenVideoCaptureDevice() {
372 rtc::scoped_ptr<cricket::DeviceManagerInterface> dev_manager( 371 return nullptr;
373 cricket::DeviceManagerFactory::Create());
374 if (!dev_manager->Init()) {
375 LOG(LS_ERROR) << "Can't create device manager";
376 return NULL;
377 }
378 std::vector<cricket::Device> devs;
379 if (!dev_manager->GetVideoCaptureDevices(&devs)) {
380 LOG(LS_ERROR) << "Can't enumerate video devices";
381 return NULL;
382 }
383 std::vector<cricket::Device>::iterator dev_it = devs.begin();
384 cricket::VideoCapturer* capturer = NULL;
385 for (; dev_it != devs.end(); ++dev_it) {
386 capturer = dev_manager->CreateVideoCapturer(*dev_it);
387 if (capturer != NULL)
388 break;
389 }
390 return capturer;
391 } 372 }
392 373
393 void Conductor::AddStreams() { 374 void Conductor::AddStreams() {
394 if (active_streams_.find(kStreamLabel) != active_streams_.end()) 375 if (active_streams_.find(kStreamLabel) != active_streams_.end())
395 return; // Already added. 376 return; // Already added.
396 377
397 rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track( 378 rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
398 peer_connection_factory_->CreateAudioTrack( 379 peer_connection_factory_->CreateAudioTrack(
399 kAudioLabel, peer_connection_factory_->CreateAudioSource(NULL))); 380 kAudioLabel, peer_connection_factory_->CreateAudioSource(NULL)));
400 381
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 512 }
532 513
533 void Conductor::OnFailure(const std::string& error) { 514 void Conductor::OnFailure(const std::string& error) {
534 LOG(LERROR) << error; 515 LOG(LERROR) << error;
535 } 516 }
536 517
537 void Conductor::SendMessage(const std::string& json_object) { 518 void Conductor::SendMessage(const std::string& json_object) {
538 std::string* msg = new std::string(json_object); 519 std::string* msg = new std::string(json_object);
539 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg); 520 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg);
540 } 521 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698