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

Unified Diff: remoting/protocol/webrtc_video_stream.cc

Issue 2392963003: Add Audio support in Chromoting host when using WebRTC. (Closed)
Patch Set: . Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/webrtc_video_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_video_stream.cc
diff --git a/remoting/protocol/webrtc_video_stream.cc b/remoting/protocol/webrtc_video_stream.cc
index 45fc2adb7a45749f522bb6ab0e6f2e8d65720c2a..c797e89641538c251a523d0013c4b8bceab4e46f 100644
--- a/remoting/protocol/webrtc_video_stream.cc
+++ b/remoting/protocol/webrtc_video_stream.cc
@@ -77,7 +77,7 @@ WebrtcVideoStream::~WebrtcVideoStream() {
encode_task_runner_->DeleteSoon(FROM_HERE, encoder_.release());
}
-bool WebrtcVideoStream::Start(
+void WebrtcVideoStream::Start(
std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer,
WebrtcTransport* webrtc_transport,
scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) {
@@ -112,12 +112,15 @@ bool WebrtcVideoStream::Start(
stream_ = peer_connection_factory->CreateLocalMediaStream(kStreamLabel);
- if (!stream_->AddTrack(video_track.get()) ||
- !peer_connection_->AddStream(stream_.get())) {
- stream_ = nullptr;
- peer_connection_ = nullptr;
- return false;
- }
+ // AddTrack() may fail only if there is another track with the same name,
+ // which is impossible because it's a brand new stream.
+ bool result = stream_->AddTrack(video_track.get());
+ DCHECK(result);
+
+ // AddStream() may fail if there is another stream with the same name or when
+ // the PeerConnection is closed, neither is expected.
+ result = peer_connection_->AddStream(stream_.get());
+ DCHECK(result);
// Register for PLI requests.
webrtc_transport_->video_encoder_factory()->SetKeyFrameRequestCallback(
@@ -137,8 +140,6 @@ bool WebrtcVideoStream::Start(
this);
scheduler_.reset(new WebrtcFrameSchedulerSimple());
-
- return true;
}
void WebrtcVideoStream::Pause(bool pause) {
« no previous file with comments | « remoting/protocol/webrtc_video_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698