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

Unified Diff: content/renderer/media/audio_message_filter.cc

Issue 11880009: Introduce AudioHardwareConfig for renderer side audio device info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Plumb. Created 7 years, 11 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: content/renderer/media/audio_message_filter.cc
diff --git a/content/renderer/media/audio_message_filter.cc b/content/renderer/media/audio_message_filter.cc
index 22915c521c53264ededd36610bf119e14089c95c..3c2c964619789c2a0281e7b98a6f504cc365510d 100644
--- a/content/renderer/media/audio_message_filter.cc
+++ b/content/renderer/media/audio_message_filter.cc
@@ -8,7 +8,9 @@
#include "base/message_loop.h"
#include "base/time.h"
#include "content/common/child_process.h"
+#include "content/common/child_thread.h"
#include "content/common/media/audio_messages.h"
+#include "content/renderer/media/renderer_audio_hardware_config.h"
#include "content/renderer/render_thread_impl.h"
#include "ipc/ipc_logging.h"
@@ -96,6 +98,7 @@ bool AudioMessageFilter::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(AudioMessageFilter, message)
IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamCreated, OnStreamCreated)
IPC_MESSAGE_HANDLER(AudioMsg_NotifyStreamStateChanged, OnStreamStateChanged)
+ IPC_MESSAGE_HANDLER(AudioMsg_NotifyDeviceChanged, OnOutputDeviceChanged)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -177,4 +180,23 @@ void AudioMessageFilter::OnStreamStateChanged(
it->second->OnStateChanged(state);
}
+void AudioMessageFilter::OnOutputDeviceChanged(int stream_id,
+ int new_buffer_size,
+ int new_sample_rate) {
+ if (MessageLoop::current() != ChildThread::current()->message_loop()) {
henrika (OOO until Aug 14) 2013/01/29 10:46:49 Please add add a comment on why this part is neede
DaleCurtis 2013/01/29 19:36:00 Yeah, I don't really like the way this is currentl
DaleCurtis 2013/01/30 01:31:06 Removed all this in favor of having RenderThreadIm
+ ChildThread::current()->message_loop()->PostTask(FROM_HERE, base::Bind(
+ &AudioMessageFilter::OnOutputDeviceChanged, this,
+ stream_id, new_buffer_size, new_sample_rate));
+ return;
+ }
+
+ DelegateMap::const_iterator it = delegates_.find(stream_id);
miu 2013/01/29 04:55:43 Need to use delegates_lock_ here for thread-safety
DaleCurtis 2013/01/30 01:31:06 Removed since this function doesn't really need th
+ DLOG_IF(WARNING, it == delegates_.end())
+ << "No delegate found for device change. ";
+ if (it != delegates_.end()) {
+ RenderThreadImpl::current()->GetAudioHardwareConfig()->UpdateOutputConfig(
henrika (OOO until Aug 14) 2013/01/29 10:46:49 I always use DCHECK in these types of situations.
DaleCurtis 2013/01/30 01:31:06 Removed.
+ new_buffer_size, new_sample_rate);
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698