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

Unified Diff: media/audio/mac/audio_auhal_mac.cc

Issue 1973503003: (Relanding) Restores larger output buffer size when output stream requiring smaller size is closed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improved comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/mac/audio_auhal_mac.cc
diff --git a/media/audio/mac/audio_auhal_mac.cc b/media/audio/mac/audio_auhal_mac.cc
index d71673fd12ae517dd61f0fdedabda64d2e7e4077..174eb4518f0ceff5199f2475e53d300c93096875 100644
--- a/media/audio/mac/audio_auhal_mac.cc
+++ b/media/audio/mac/audio_auhal_mac.cc
@@ -122,6 +122,11 @@ void AUHALStream::Close() {
DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(1) << "Close";
CloseAudioUnit();
+ // Notify the audio manager about an upcoming call to ReleaseOutputStream()
+ // and also provide the device ID of the utilized audio device. This is a
+ // trick to ensure that the audio manager only tries to increase the native
+ // I/O buffer size for real audio streams and not for e.g. fake streams.
+ manager_->PrepareForAttemptToIncreaseIOBufferSize(device_);
o1ka 2016/05/12 11:30:17 Ah ok, I see what you mean. Could we simplify it a
o1ka 2016/05/12 12:04:15 (Actually, it should be named differently, because
henrika (OOO until Aug 14) 2016/05/12 13:02:08 Well, that does not seem that strict but OK I can
henrika (OOO until Aug 14) 2016/05/12 13:02:08 Good idea. Done.
// Inform the audio manager that we have been closed. This will cause our
// destruction.
manager_->ReleaseOutputStream(this);
@@ -175,6 +180,7 @@ void AUHALStream::Stop() {
if (stopped_)
return;
DVLOG(1) << "Stop";
+ DVLOG(2) << "number_of_frames: " << number_of_frames_;
OSStatus result = AudioOutputUnitStop(audio_unit_);
OSSTATUS_DLOG_IF(ERROR, result != noErr, result)
<< "AudioOutputUnitStop() failed.";
@@ -218,8 +224,7 @@ OSStatus AUHALStream::Render(
// changes reflected in UMA stats.
number_of_frames_requested_ = number_of_frames;
DVLOG(1) << "Audio frame size changed from " << number_of_frames_
- << " to " << number_of_frames
- << "; adding FIFO to compensate.";
+ << " to " << number_of_frames << " adding FIFO to compensate.";
audio_fifo_.reset(new AudioPullFifo(
output_channels_,
number_of_frames_,

Powered by Google App Engine
This is Rietveld 408576698