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

Unified Diff: media/audio/win/audio_low_latency_input_win.cc

Issue 367923004: Turn audio ducking on by default on Windows again. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 5 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/win/audio_low_latency_input_win.cc
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc
index c43ed22977c648af8e92245bd436a8cb5f58c0b0..d29d1b42c6a433e9aeee2a6e9ea787650918b723 100644
--- a/media/audio/win/audio_low_latency_input_win.cc
+++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -9,6 +9,7 @@
#include "base/strings/utf_string_conversions.h"
#include "media/audio/win/audio_manager_win.h"
#include "media/audio/win/avrt_wrapper_win.h"
+#include "media/audio/win/core_audio_util_win.h"
#include "media/base/audio_bus.h"
using base::win::ScopedComPtr;
@@ -97,7 +98,9 @@ WASAPIAudioInputStream::WASAPIAudioInputStream(AudioManagerWin* manager,
}
}
-WASAPIAudioInputStream::~WASAPIAudioInputStream() {}
+WASAPIAudioInputStream::~WASAPIAudioInputStream() {
+ DCHECK(CalledOnValidThread());
+}
bool WASAPIAudioInputStream::Open() {
DCHECK(CalledOnValidThread());
@@ -512,6 +515,11 @@ HRESULT WASAPIAudioInputStream::SetCaptureDevice() {
base::WideToUTF8(static_cast<WCHAR*>(communications_id))) {
DLOG(WARNING) << "Ducking has been requested for a non-default device."
"Not supported.";
+ // We can't honor the requested effect flag, so turn it off and
+ // continue. We'll check this flag later to see if we've actually
+ // opened up the communications device, so it's important that it
+ // reflects the active state.
+ effects_ &= ~AudioParameters::DUCKING;
endpoint_device_.Release(); // Fall back on code below.
}
}
@@ -639,12 +647,14 @@ HRESULT WASAPIAudioInputStream::InitializeAudioEngine() {
// buffer is never smaller than the minimum buffer size needed to ensure
// that glitches do not occur between the periodic processing passes.
// This setting should lead to lowest possible latency.
- HRESULT hr = audio_client_->Initialize(AUDCLNT_SHAREMODE_SHARED,
- flags,
- 0, // hnsBufferDuration
- 0,
- &format_,
- NULL);
+ HRESULT hr = audio_client_->Initialize(
+ AUDCLNT_SHAREMODE_SHARED,
+ flags,
+ 0, // hnsBufferDuration
+ 0,
+ &format_,
+ (effects_ & AudioParameters::DUCKING) ? &kCommunicationsSessionId : NULL);
+
if (FAILED(hr))
return hr;

Powered by Google App Engine
This is Rietveld 408576698