| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/remote_media_stream_impl.h" | 5 #include "content/renderer/media/remote_media_stream_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 DCHECK(main_thread_->BelongsToCurrentThread()); | 345 DCHECK(main_thread_->BelongsToCurrentThread()); |
| 346 if (media_stream_) | 346 if (media_stream_) |
| 347 media_stream_->OnChanged(audio_tracks.Pass(), video_tracks.Pass()); | 347 media_stream_->OnChanged(audio_tracks.Pass(), video_tracks.Pass()); |
| 348 } | 348 } |
| 349 | 349 |
| 350 // Called on the signaling thread. | 350 // Called on the signaling thread. |
| 351 RemoteMediaStreamImpl::RemoteMediaStreamImpl( | 351 RemoteMediaStreamImpl::RemoteMediaStreamImpl( |
| 352 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, | 352 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, |
| 353 webrtc::MediaStreamInterface* webrtc_stream) | 353 webrtc::MediaStreamInterface* webrtc_stream) |
| 354 : signaling_thread_(base::ThreadTaskRunnerHandle::Get()), | 354 : signaling_thread_(base::ThreadTaskRunnerHandle::Get()), |
| 355 weak_factory_(this), | 355 weak_factory_(this) { |
| 356 observer_(new RemoteMediaStreamImpl::Observer(weak_factory_.GetWeakPtr(), | 356 observer_ = new RemoteMediaStreamImpl::Observer( |
| 357 main_thread, webrtc_stream)) { | 357 weak_factory_.GetWeakPtr(), main_thread, webrtc_stream); |
| 358 CreateAdaptersForTracks(webrtc_stream->GetAudioTracks(), | 358 CreateAdaptersForTracks(webrtc_stream->GetAudioTracks(), |
| 359 &audio_track_observers_, main_thread); | 359 &audio_track_observers_, main_thread); |
| 360 CreateAdaptersForTracks(webrtc_stream->GetVideoTracks(), | 360 CreateAdaptersForTracks(webrtc_stream->GetVideoTracks(), |
| 361 &video_track_observers_, main_thread); | 361 &video_track_observers_, main_thread); |
| 362 | 362 |
| 363 main_thread->PostTask(FROM_HERE, | 363 main_thread->PostTask(FROM_HERE, |
| 364 base::Bind(&RemoteMediaStreamImpl::Observer::InitializeOnMainThread, | 364 base::Bind(&RemoteMediaStreamImpl::Observer::InitializeOnMainThread, |
| 365 observer_, webrtc_stream->label())); | 365 observer_, webrtc_stream->label())); |
| 366 } | 366 } |
| 367 | 367 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 // Unregister all the audio track observers that were not used. | 442 // Unregister all the audio track observers that were not used. |
| 443 // We need to do this before destruction since the observers can't unregister | 443 // We need to do this before destruction since the observers can't unregister |
| 444 // from within the dtor due to a race. | 444 // from within the dtor due to a race. |
| 445 for (auto& track : *audio_tracks.get()) { | 445 for (auto& track : *audio_tracks.get()) { |
| 446 if (track.get()) | 446 if (track.get()) |
| 447 track->Unregister(); | 447 track->Unregister(); |
| 448 } | 448 } |
| 449 } | 449 } |
| 450 | 450 |
| 451 } // namespace content | 451 } // namespace content |
| OLD | NEW |