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 const media::AudioParameters& WebRtcLocalAudioTrack::GetOutputFormat() const { | |
44 if (webaudio_source_.get()) { | |
45 static const media::AudioParameters empty_params; | |
dmichael (off chromium)
2015/01/20 17:07:03
ditto... it's almost always better to just return
DaleCurtis
2015/01/20 18:46:56
+1, just return media::AudioParameters().
Anand Mistry (off Chromium)
2015/01/27 02:12:10
Done. I just figured returning const reference was
dmichael (off chromium)
2015/01/27 18:24:10
Copying a small-ish object that doesn't do any hea
| |
46 return empty_params; | |
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 |