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

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

Issue 503683003: Remove implicit conversions from scoped_refptr to T* in content/renderer/media/webrtc* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc » ('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 "content/renderer/media/webrtc/media_stream_remote_video_source.h" 5 #include "content/renderer/media/webrtc/media_stream_remote_video_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 media::VideoCaptureFormats formats; 144 media::VideoCaptureFormats formats;
145 // Since the remote end is free to change the resolution at any point in time 145 // Since the remote end is free to change the resolution at any point in time
146 // the supported formats are unknown. 146 // the supported formats are unknown.
147 callback.Run(formats); 147 callback.Run(formats);
148 } 148 }
149 149
150 void MediaStreamRemoteVideoSource::StartSourceImpl( 150 void MediaStreamRemoteVideoSource::StartSourceImpl(
151 const media::VideoCaptureParams& params, 151 const media::VideoCaptureParams& params,
152 const VideoCaptureDeliverFrameCB& frame_callback) { 152 const VideoCaptureDeliverFrameCB& frame_callback) {
153 DCHECK(thread_checker_.CalledOnValidThread()); 153 DCHECK(thread_checker_.CalledOnValidThread());
154 DCHECK(!delegate_); 154 DCHECK(!delegate_.get());
155 delegate_ = new RemoteVideoSourceDelegate(io_message_loop(), frame_callback); 155 delegate_ = new RemoteVideoSourceDelegate(io_message_loop(), frame_callback);
156 remote_track_->AddRenderer(delegate_); 156 remote_track_->AddRenderer(delegate_.get());
157 OnStartDone(MEDIA_DEVICE_OK); 157 OnStartDone(MEDIA_DEVICE_OK);
158 } 158 }
159 159
160 void MediaStreamRemoteVideoSource::StopSourceImpl() { 160 void MediaStreamRemoteVideoSource::StopSourceImpl() {
161 DCHECK(thread_checker_.CalledOnValidThread()); 161 DCHECK(thread_checker_.CalledOnValidThread());
162 DCHECK(state() != MediaStreamVideoSource::ENDED); 162 DCHECK(state() != MediaStreamVideoSource::ENDED);
163 remote_track_->RemoveRenderer(delegate_); 163 remote_track_->RemoveRenderer(delegate_.get());
164 } 164 }
165 165
166 webrtc::VideoRendererInterface* 166 webrtc::VideoRendererInterface*
167 MediaStreamRemoteVideoSource::RenderInterfaceForTest() { 167 MediaStreamRemoteVideoSource::RenderInterfaceForTest() {
168 return delegate_; 168 return delegate_.get();
169 } 169 }
170 170
171 void MediaStreamRemoteVideoSource::OnChanged() { 171 void MediaStreamRemoteVideoSource::OnChanged() {
172 DCHECK(thread_checker_.CalledOnValidThread()); 172 DCHECK(thread_checker_.CalledOnValidThread());
173 webrtc::MediaStreamTrackInterface::TrackState state = remote_track_->state(); 173 webrtc::MediaStreamTrackInterface::TrackState state = remote_track_->state();
174 if (state != last_state_) { 174 if (state != last_state_) {
175 last_state_ = state; 175 last_state_ = state;
176 switch (state) { 176 switch (state) {
177 case webrtc::MediaStreamTrackInterface::kInitializing: 177 case webrtc::MediaStreamTrackInterface::kInitializing:
178 // Ignore the kInitializing state since there is no match in 178 // Ignore the kInitializing state since there is no match in
179 // WebMediaStreamSource::ReadyState. 179 // WebMediaStreamSource::ReadyState.
180 break; 180 break;
181 case webrtc::MediaStreamTrackInterface::kLive: 181 case webrtc::MediaStreamTrackInterface::kLive:
182 SetReadyState(blink::WebMediaStreamSource::ReadyStateLive); 182 SetReadyState(blink::WebMediaStreamSource::ReadyStateLive);
183 break; 183 break;
184 case webrtc::MediaStreamTrackInterface::kEnded: 184 case webrtc::MediaStreamTrackInterface::kEnded:
185 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); 185 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded);
186 break; 186 break;
187 default: 187 default:
188 NOTREACHED(); 188 NOTREACHED();
189 break; 189 break;
190 } 190 }
191 } 191 }
192 } 192 }
193 193
194 } // namespace content 194 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698