| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "content/public/renderer/media_stream_audio_sink.h" | 9 #include "content/public/renderer/media_stream_audio_sink.h" |
| 10 #include "content/renderer/media/media_stream_audio_level_calculator.h" | 10 #include "content/renderer/media/media_stream_audio_level_calculator.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 DVLOG(1) << "WebRtcLocalAudioTrack::WebRtcLocalAudioTrack()"; | 33 DVLOG(1) << "WebRtcLocalAudioTrack::WebRtcLocalAudioTrack()"; |
| 34 } | 34 } |
| 35 | 35 |
| 36 WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack() { | 36 WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack() { |
| 37 DCHECK(main_render_thread_checker_.CalledOnValidThread()); | 37 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 38 DVLOG(1) << "WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack()"; | 38 DVLOG(1) << "WebRtcLocalAudioTrack::~WebRtcLocalAudioTrack()"; |
| 39 // Users might not call Stop() on the track. | 39 // Users might not call Stop() on the track. |
| 40 Stop(); | 40 Stop(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 media::AudioParameters WebRtcLocalAudioTrack::GetOutputFormat() const { |
| 44 DCHECK(main_render_thread_checker_.CalledOnValidThread()); |
| 45 if (webaudio_source_.get()) { |
| 46 return media::AudioParameters(); |
| 47 } else { |
| 48 return capturer_->GetOutputFormat(); |
| 49 } |
| 50 } |
| 51 |
| 43 void WebRtcLocalAudioTrack::Capture(const media::AudioBus& audio_bus, | 52 void WebRtcLocalAudioTrack::Capture(const media::AudioBus& audio_bus, |
| 44 base::TimeTicks estimated_capture_time, | 53 base::TimeTicks estimated_capture_time, |
| 45 bool force_report_nonzero_energy) { | 54 bool force_report_nonzero_energy) { |
| 46 DCHECK(capture_thread_checker_.CalledOnValidThread()); | 55 DCHECK(capture_thread_checker_.CalledOnValidThread()); |
| 47 DCHECK(!estimated_capture_time.is_null()); | 56 DCHECK(!estimated_capture_time.is_null()); |
| 48 | 57 |
| 49 // Calculate the signal level regardless of whether the track is disabled or | 58 // Calculate the signal level regardless of whether the track is disabled or |
| 50 // enabled. If |force_report_nonzero_energy| is true, |audio_bus| contains | 59 // enabled. If |force_report_nonzero_energy| is true, |audio_bus| contains |
| 51 // post-processed data that may be all zeros even though the signal contained | 60 // post-processed data that may be all zeros even though the signal contained |
| 52 // energy before the processing. In this case, report nonzero energy even if | 61 // energy before the processing. In this case, report nonzero energy even if |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 (*it)->Reset(); | 230 (*it)->Reset(); |
| 222 } | 231 } |
| 223 } | 232 } |
| 224 | 233 |
| 225 webrtc::AudioTrackInterface* WebRtcLocalAudioTrack::GetAudioAdapter() { | 234 webrtc::AudioTrackInterface* WebRtcLocalAudioTrack::GetAudioAdapter() { |
| 226 DCHECK(thread_checker_.CalledOnValidThread()); | 235 DCHECK(thread_checker_.CalledOnValidThread()); |
| 227 return adapter_.get(); | 236 return adapter_.get(); |
| 228 } | 237 } |
| 229 | 238 |
| 230 } // namespace content | 239 } // namespace content |
| OLD | NEW |