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

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

Issue 1972793003: Use scoped_refptr for On(Add|Remove)Stream and OnDataChannel. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding "deprecated" comments. Created 4 years, 7 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
« no previous file with comments | « webrtc/examples/peerconnection/client/conductor.h ('k') | no next file » | 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 * 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
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (main_wnd_->current_ui() != MainWindow::STREAMING) 149 if (main_wnd_->current_ui() != MainWindow::STREAMING)
150 main_wnd_->SwitchToStreamingUI(); 150 main_wnd_->SwitchToStreamingUI();
151 } 151 }
152 } 152 }
153 153
154 // 154 //
155 // PeerConnectionObserver implementation. 155 // PeerConnectionObserver implementation.
156 // 156 //
157 157
158 // Called when a remote stream is added 158 // Called when a remote stream is added
159 void Conductor::OnAddStream(webrtc::MediaStreamInterface* stream) { 159 void Conductor::OnAddStream(
160 rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
160 LOG(INFO) << __FUNCTION__ << " " << stream->label(); 161 LOG(INFO) << __FUNCTION__ << " " << stream->label();
161 162 main_wnd_->QueueUIThreadCallback(NEW_STREAM_ADDED, stream.release());
tkchin_webrtc 2016/05/12 17:50:22 I haven't seen scoped_refptr used like this before
Taylor Brandstetter 2016/05/12 17:52:34 Yep; ".release()" is basically what you want to do
162 stream->AddRef();
163 main_wnd_->QueueUIThreadCallback(NEW_STREAM_ADDED,
164 stream);
165 } 163 }
166 164
167 void Conductor::OnRemoveStream(webrtc::MediaStreamInterface* stream) { 165 void Conductor::OnRemoveStream(
166 rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
168 LOG(INFO) << __FUNCTION__ << " " << stream->label(); 167 LOG(INFO) << __FUNCTION__ << " " << stream->label();
169 stream->AddRef(); 168 main_wnd_->QueueUIThreadCallback(STREAM_REMOVED, stream.release());
170 main_wnd_->QueueUIThreadCallback(STREAM_REMOVED,
171 stream);
172 } 169 }
173 170
174 void Conductor::OnIceCandidate(const webrtc::IceCandidateInterface* candidate) { 171 void Conductor::OnIceCandidate(const webrtc::IceCandidateInterface* candidate) {
175 LOG(INFO) << __FUNCTION__ << " " << candidate->sdp_mline_index(); 172 LOG(INFO) << __FUNCTION__ << " " << candidate->sdp_mline_index();
176 // For loopback test. To save some connecting delay. 173 // For loopback test. To save some connecting delay.
177 if (loopback_) { 174 if (loopback_) {
178 if (!peer_connection_->AddIceCandidate(candidate)) { 175 if (!peer_connection_->AddIceCandidate(candidate)) {
179 LOG(WARNING) << "Failed to apply the received candidate"; 176 LOG(WARNING) << "Failed to apply the received candidate";
180 } 177 }
181 return; 178 return;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 } 537 }
541 538
542 void Conductor::OnFailure(const std::string& error) { 539 void Conductor::OnFailure(const std::string& error) {
543 LOG(LERROR) << error; 540 LOG(LERROR) << error;
544 } 541 }
545 542
546 void Conductor::SendMessage(const std::string& json_object) { 543 void Conductor::SendMessage(const std::string& json_object) {
547 std::string* msg = new std::string(json_object); 544 std::string* msg = new std::string(json_object);
548 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg); 545 main_wnd_->QueueUIThreadCallback(SEND_MESSAGE_TO_PEER, msg);
549 } 546 }
OLDNEW
« no previous file with comments | « webrtc/examples/peerconnection/client/conductor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698