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

Side by Side Diff: remoting/host/cast_extension_session.cc

Issue 1472703006: Move and rename host/cast_video_capture_adapter to protocol/webrtc_video_capture_adapter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | remoting/host/cast_video_capturer_adapter.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 // 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 "remoting/host/cast_extension_session.h" 5 #include "remoting/host/cast_extension_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "net/url_request/url_request_context_getter.h" 12 #include "net/url_request/url_request_context_getter.h"
13 #include "remoting/host/cast_video_capturer_adapter.h"
14 #include "remoting/host/client_session.h" 13 #include "remoting/host/client_session.h"
15 #include "remoting/proto/control.pb.h" 14 #include "remoting/proto/control.pb.h"
16 #include "remoting/protocol/chromium_port_allocator_factory.h" 15 #include "remoting/protocol/chromium_port_allocator_factory.h"
17 #include "remoting/protocol/client_stub.h" 16 #include "remoting/protocol/client_stub.h"
17 #include "remoting/protocol/webrtc_video_capturer_adapter.h"
18 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" 18 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
19 #include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h" 19 #include "third_party/libjingle/source/talk/app/webrtc/test/fakeconstraints.h"
20 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" 20 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h"
21 21
22 namespace remoting { 22 namespace remoting {
23 23
24 // Used as the type attribute of all Cast protocol::ExtensionMessages. 24 // Used as the type attribute of all Cast protocol::ExtensionMessages.
25 const char kExtensionMessageType[] = "cast_message"; 25 const char kExtensionMessageType[] = "cast_message";
26 26
27 // Top-level keys used in all extension messages between host and client. 27 // Top-level keys used in all extension messages between host and client.
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 bool CastExtensionSession::SetupVideoStream( 528 bool CastExtensionSession::SetupVideoStream(
529 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) { 529 scoped_ptr<webrtc::DesktopCapturer> desktop_capturer) {
530 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 530 DCHECK(caller_task_runner_->BelongsToCurrentThread());
531 DCHECK(desktop_capturer); 531 DCHECK(desktop_capturer);
532 532
533 if (stream_) { 533 if (stream_) {
534 VLOG(1) << "Already added MediaStream. Aborting Setup."; 534 VLOG(1) << "Already added MediaStream. Aborting Setup.";
535 return false; 535 return false;
536 } 536 }
537 537
538 scoped_ptr<CastVideoCapturerAdapter> cast_video_capturer_adapter( 538 scoped_ptr<WebrtcVideoCapturerAdapter> video_capturer_adapter(
539 new CastVideoCapturerAdapter(desktop_capturer.Pass())); 539 new WebrtcVideoCapturerAdapter(desktop_capturer.Pass()));
540 540
541 // Set video stream constraints. 541 // Set video stream constraints.
542 webrtc::FakeConstraints video_constraints; 542 webrtc::FakeConstraints video_constraints;
543 video_constraints.AddMandatory( 543 video_constraints.AddMandatory(
544 webrtc::MediaConstraintsInterface::kMinFrameRate, kMinFramesPerSecond); 544 webrtc::MediaConstraintsInterface::kMinFrameRate, kMinFramesPerSecond);
545 545
546 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track = 546 rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track =
547 peer_conn_factory_->CreateVideoTrack( 547 peer_conn_factory_->CreateVideoTrack(
548 kVideoLabel, 548 kVideoLabel,
549 peer_conn_factory_->CreateVideoSource( 549 peer_conn_factory_->CreateVideoSource(
550 cast_video_capturer_adapter.release(), &video_constraints)); 550 video_capturer_adapter.release(), &video_constraints));
551 551
552 stream_ = peer_conn_factory_->CreateLocalMediaStream(kStreamLabel); 552 stream_ = peer_conn_factory_->CreateLocalMediaStream(kStreamLabel);
553 553
554 if (!stream_->AddTrack(video_track) || 554 if (!stream_->AddTrack(video_track) ||
555 !peer_connection_->AddStream(stream_)) { 555 !peer_connection_->AddStream(stream_)) {
556 return false; 556 return false;
557 } 557 }
558 558
559 VLOG(1) << "Setup video stream successfully."; 559 VLOG(1) << "Setup video stream successfully.";
560 560
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 json.SetString(kWebRtcCandidate, candidate_str); 653 json.SetString(kWebRtcCandidate, candidate_str);
654 std::string json_str; 654 std::string json_str;
655 if (!base::JSONWriter::Write(json, &json_str)) { 655 if (!base::JSONWriter::Write(json, &json_str)) {
656 LOG(ERROR) << "Failed to serialize candidate message."; 656 LOG(ERROR) << "Failed to serialize candidate message.";
657 return; 657 return;
658 } 658 }
659 SendMessageToClient(kSubjectNewCandidate, json_str); 659 SendMessageToClient(kSubjectNewCandidate, json_str);
660 } 660 }
661 661
662 } // namespace remoting 662 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/cast_video_capturer_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698