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

Unified Diff: media/audio/audio_output_device.cc

Issue 2466463005: Support (E)AC3 passthrough
Patch Set: Improve CastMediaClient::IsSupportedPassthroughAudio() Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_output_device.cc
diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc
index 0dcc76aca062b19bbdfb941088d053c1d1970ad3..b925d84fb4b941bff97d7a17bf7325214112c2fe 100644
--- a/media/audio/audio_output_device.cc
+++ b/media/audio/audio_output_device.cc
@@ -24,6 +24,8 @@
namespace media {
+static const int kMaxFramesPerCompressedAudioBuffer = 4096;
DaleCurtis 2016/11/01 23:05:13 This needs to be a property of the AudioParameters
AndyWu 2016/11/04 18:04:24 Done, thanks for your help.
+
// Takes care of invoking the render callback on the audio thread.
// An instance of this class is created for each capture stream in
// OnStreamCreated().
@@ -476,12 +478,22 @@ void AudioOutputDevice::AudioThreadCallback::Process(uint32_t pending_data) {
<< " frames_delayed(pre-round):" << frames_delayed
<< " frames_skipped:" << frames_skipped;
+ output_bus_->set_is_raw_format(audio_parameters_.IsRawFormat());
+ if (audio_parameters_.IsRawFormat()) {
+ // Reset the data size and frame count.
+ // For compressed audio formats, the data size and frame count will be
+ // updated by |render_callback_|.
+ output_bus_->set_data_size(0);
+ output_bus_->set_frames(kMaxFramesPerCompressedAudioBuffer);
+ }
// Update the audio-delay measurement, inform about the number of skipped
// frames, and ask client to render audio. Since |output_bus_| is wrapping
// the shared memory the Render() call is writing directly into the shared
// memory.
render_callback_->Render(output_bus_.get(), std::round(frames_delayed),
frames_skipped);
+ buffer->params.frames = output_bus_->frames();
+ buffer->params.data_size = output_bus_->data_size();
}
bool AudioOutputDevice::AudioThreadCallback::

Powered by Google App Engine
This is Rietveld 408576698