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

Side by Side Diff: webrtc/api/rtpsender.cc

Issue 1770003002: Renamed VideoSourceInterface to VideoTrackSourceInterface. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased 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 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Attach to new track. 261 // Attach to new track.
262 bool prev_can_send_track = can_send_track(); 262 bool prev_can_send_track = can_send_track();
263 track_ = video_track; 263 track_ = video_track;
264 if (track_) { 264 if (track_) {
265 cached_track_enabled_ = track_->enabled(); 265 cached_track_enabled_ = track_->enabled();
266 track_->RegisterObserver(this); 266 track_->RegisterObserver(this);
267 } 267 }
268 268
269 // Update video provider. 269 // Update video provider.
270 if (can_send_track()) { 270 if (can_send_track()) {
271 VideoSourceInterface* source = track_->GetSource(); 271 VideoTrackSourceInterface* source = track_->GetSource();
272 // TODO(deadbeef): If SetTrack is called with a disabled track, and the 272 // TODO(deadbeef): If SetTrack is called with a disabled track, and the
273 // previous track was enabled, this could cause a frame from the new track 273 // previous track was enabled, this could cause a frame from the new track
274 // to slip out. Really, what we need is for SetCaptureDevice and 274 // to slip out. Really, what we need is for SetCaptureDevice and
275 // SetVideoSend 275 // SetVideoSend
276 // to be combined into one atomic operation, all the way down to 276 // to be combined into one atomic operation, all the way down to
277 // WebRtcVideoSendStream. 277 // WebRtcVideoSendStream.
278 provider_->SetCaptureDevice(ssrc_, 278 provider_->SetCaptureDevice(ssrc_,
279 source ? source->GetVideoCapturer() : nullptr); 279 source ? source->GetVideoCapturer() : nullptr);
280 SetVideoSend(); 280 SetVideoSend();
281 } else if (prev_can_send_track) { 281 } else if (prev_can_send_track) {
282 provider_->SetCaptureDevice(ssrc_, nullptr); 282 provider_->SetCaptureDevice(ssrc_, nullptr);
283 provider_->SetVideoSend(ssrc_, false, nullptr); 283 provider_->SetVideoSend(ssrc_, false, nullptr);
284 } 284 }
285 return true; 285 return true;
286 } 286 }
287 287
288 void VideoRtpSender::SetSsrc(uint32_t ssrc) { 288 void VideoRtpSender::SetSsrc(uint32_t ssrc) {
289 if (stopped_ || ssrc == ssrc_) { 289 if (stopped_ || ssrc == ssrc_) {
290 return; 290 return;
291 } 291 }
292 // If we are already sending with a particular SSRC, stop sending. 292 // If we are already sending with a particular SSRC, stop sending.
293 if (can_send_track()) { 293 if (can_send_track()) {
294 provider_->SetCaptureDevice(ssrc_, nullptr); 294 provider_->SetCaptureDevice(ssrc_, nullptr);
295 provider_->SetVideoSend(ssrc_, false, nullptr); 295 provider_->SetVideoSend(ssrc_, false, nullptr);
296 } 296 }
297 ssrc_ = ssrc; 297 ssrc_ = ssrc;
298 if (can_send_track()) { 298 if (can_send_track()) {
299 VideoSourceInterface* source = track_->GetSource(); 299 VideoTrackSourceInterface* source = track_->GetSource();
300 provider_->SetCaptureDevice(ssrc_, 300 provider_->SetCaptureDevice(ssrc_,
301 source ? source->GetVideoCapturer() : nullptr); 301 source ? source->GetVideoCapturer() : nullptr);
302 SetVideoSend(); 302 SetVideoSend();
303 } 303 }
304 } 304 }
305 305
306 void VideoRtpSender::Stop() { 306 void VideoRtpSender::Stop() {
307 // TODO(deadbeef): Need to do more here to fully stop sending packets. 307 // TODO(deadbeef): Need to do more here to fully stop sending packets.
308 if (stopped_) { 308 if (stopped_) {
309 return; 309 return;
310 } 310 }
311 if (track_) { 311 if (track_) {
312 track_->UnregisterObserver(this); 312 track_->UnregisterObserver(this);
313 } 313 }
314 if (can_send_track()) { 314 if (can_send_track()) {
315 provider_->SetCaptureDevice(ssrc_, nullptr); 315 provider_->SetCaptureDevice(ssrc_, nullptr);
316 provider_->SetVideoSend(ssrc_, false, nullptr); 316 provider_->SetVideoSend(ssrc_, false, nullptr);
317 } 317 }
318 stopped_ = true; 318 stopped_ = true;
319 } 319 }
320 320
321 void VideoRtpSender::SetVideoSend() { 321 void VideoRtpSender::SetVideoSend() {
322 RTC_DCHECK(!stopped_ && can_send_track()); 322 RTC_DCHECK(!stopped_ && can_send_track());
323 const cricket::VideoOptions* options = nullptr; 323 const cricket::VideoOptions* options = nullptr;
324 VideoSourceInterface* source = track_->GetSource(); 324 VideoTrackSourceInterface* source = track_->GetSource();
325 if (track_->enabled() && source) { 325 if (track_->enabled() && source) {
326 options = source->options(); 326 options = source->options();
327 } 327 }
328 provider_->SetVideoSend(ssrc_, track_->enabled(), options); 328 provider_->SetVideoSend(ssrc_, track_->enabled(), options);
329 } 329 }
330 330
331 } // namespace webrtc 331 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698