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

Side by Side Diff: content/renderer/media/webrtc_audio_device_impl.cc

Issue 328493003: Pass the elapsed time from VoE to WebRtcAudioRenderer as the current time for the audio/video eleme… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/webrtc_audio_device_impl.h" 5 #include "content/renderer/media/webrtc_audio_device_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return new_volume; 119 return new_volume;
120 } 120 }
121 121
122 void WebRtcAudioDeviceImpl::OnSetFormat( 122 void WebRtcAudioDeviceImpl::OnSetFormat(
123 const media::AudioParameters& params) { 123 const media::AudioParameters& params) {
124 DVLOG(1) << "WebRtcAudioDeviceImpl::OnSetFormat()"; 124 DVLOG(1) << "WebRtcAudioDeviceImpl::OnSetFormat()";
125 } 125 }
126 126
127 void WebRtcAudioDeviceImpl::RenderData(media::AudioBus* audio_bus, 127 void WebRtcAudioDeviceImpl::RenderData(media::AudioBus* audio_bus,
128 int sample_rate, 128 int sample_rate,
129 int audio_delay_milliseconds) { 129 int audio_delay_milliseconds,
130 base::TimeDelta* current_time) {
130 render_buffer_.resize(audio_bus->frames() * audio_bus->channels()); 131 render_buffer_.resize(audio_bus->frames() * audio_bus->channels());
131 132
132 { 133 {
133 base::AutoLock auto_lock(lock_); 134 base::AutoLock auto_lock(lock_);
134 DCHECK(audio_transport_callback_); 135 DCHECK(audio_transport_callback_);
135 // Store the reported audio delay locally. 136 // Store the reported audio delay locally.
136 output_delay_ms_ = audio_delay_milliseconds; 137 output_delay_ms_ = audio_delay_milliseconds;
137 } 138 }
138 139
139 int frames_per_10_ms = (sample_rate / 100); 140 int frames_per_10_ms = (sample_rate / 100);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 audio_transport_callback_->NeedMorePlayData(frames_per_10_ms, 173 audio_transport_callback_->NeedMorePlayData(frames_per_10_ms,
173 bytes_per_sample, 174 bytes_per_sample,
174 audio_bus->channels(), 175 audio_bus->channels(),
175 sample_rate, 176 sample_rate,
176 audio_data, 177 audio_data,
177 num_audio_frames, 178 num_audio_frames,
178 &elapsed_time_ms, 179 &elapsed_time_ms,
179 &ntp_time_ms); 180 &ntp_time_ms);
180 accumulated_audio_frames += num_audio_frames; 181 accumulated_audio_frames += num_audio_frames;
181 } 182 }
182 183 if (elapsed_time_ms >= 0) {
184 *current_time = base::TimeDelta::FromMilliseconds(elapsed_time_ms);
185 }
183 audio_data += bytes_per_10_ms; 186 audio_data += bytes_per_10_ms;
184 } 187 }
185 188
186 // De-interleave each channel and convert to 32-bit floating-point 189 // De-interleave each channel and convert to 32-bit floating-point
187 // with nominal range -1.0 -> +1.0 to match the callback format. 190 // with nominal range -1.0 -> +1.0 to match the callback format.
188 audio_bus->FromInterleaved(&render_buffer_[0], 191 audio_bus->FromInterleaved(&render_buffer_[0],
189 audio_bus->frames(), 192 audio_bus->frames(),
190 bytes_per_sample); 193 bytes_per_sample);
191 194
192 // Pass the render data to the playout sinks. 195 // Pass the render data to the playout sinks.
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 562
560 // Start the Aec dump on the current default capturer. 563 // Start the Aec dump on the current default capturer.
561 scoped_refptr<WebRtcAudioCapturer> default_capturer(GetDefaultCapturer()); 564 scoped_refptr<WebRtcAudioCapturer> default_capturer(GetDefaultCapturer());
562 if (!default_capturer) 565 if (!default_capturer)
563 return; 566 return;
564 567
565 default_capturer->StartAecDump(aec_dump_file_.Pass()); 568 default_capturer->StartAecDump(aec_dump_file_.Pass());
566 } 569 }
567 570
568 } // namespace content 571 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_device_impl.h ('k') | content/renderer/media/webrtc_audio_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698