OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_local_audio_track.h" | 5 #include "content/renderer/media/webrtc_local_audio_track.h" |
6 | 6 |
7 #include "content/renderer/media/webrtc_audio_capturer.h" | 7 #include "content/renderer/media/webrtc_audio_capturer.h" |
8 #include "content/renderer/media/webrtc_audio_capturer_sink_owner.h" | 8 #include "content/renderer/media/webrtc_audio_capturer_sink_owner.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 10 matching lines...) Expand all Loading... |
21 return track; | 21 return track; |
22 } | 22 } |
23 | 23 |
24 WebRtcLocalAudioTrack::WebRtcLocalAudioTrack( | 24 WebRtcLocalAudioTrack::WebRtcLocalAudioTrack( |
25 const std::string& label, | 25 const std::string& label, |
26 const scoped_refptr<WebRtcAudioCapturer>& capturer, | 26 const scoped_refptr<WebRtcAudioCapturer>& capturer, |
27 webrtc::AudioSourceInterface* track_source) | 27 webrtc::AudioSourceInterface* track_source) |
28 : webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>(label), | 28 : webrtc::MediaStreamTrack<webrtc::AudioTrackInterface>(label), |
29 capturer_(capturer), | 29 capturer_(capturer), |
30 track_source_(track_source) { | 30 track_source_(track_source) { |
31 DCHECK(capturer); | 31 DCHECK(capturer.get()); |
32 capturer_->AddSink(this); | 32 capturer_->AddSink(this); |
33 DVLOG(1) << "WebRtcLocalAudioTrack::WebRtcLocalAudioTrack()"; | 33 DVLOG(1) << "WebRtcLocalAudioTrack::WebRtcLocalAudioTrack()"; |
34 } | 34 } |
35 | 35 |
36 WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack() { | 36 WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack() { |
37 DCHECK(thread_checker_.CalledOnValidThread()); | 37 DCHECK(thread_checker_.CalledOnValidThread()); |
38 DCHECK(sinks_.empty()); | 38 DCHECK(sinks_.empty()); |
39 capturer_->RemoveSink(this); | 39 capturer_->RemoveSink(this); |
40 DVLOG(1) << "WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack()"; | 40 DVLOG(1) << "WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack()"; |
41 } | 41 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (it != sinks_.end()) { | 118 if (it != sinks_.end()) { |
119 // Clear the delegate to ensure that no more capture callbacks will | 119 // Clear the delegate to ensure that no more capture callbacks will |
120 // be sent to this sink. Also avoids a possible crash which can happen | 120 // be sent to this sink. Also avoids a possible crash which can happen |
121 // if this method is called while capturing is active. | 121 // if this method is called while capturing is active. |
122 (*it)->Reset(); | 122 (*it)->Reset(); |
123 sinks_.erase(it); | 123 sinks_.erase(it); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 } // namespace content | 127 } // namespace content |
OLD | NEW |