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

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

Issue 11359196: Associate audio streams with their source/destination RenderView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Plus, removed CalledOnValidThread DCHECK from sampleRate() call since nothing mutates. Created 8 years 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.h
diff --git a/content/renderer/media/audio_message_filter.h b/content/renderer/media/audio_message_filter.h
index 3e3c9c9b067e9f6ba1a97dc3ef368960446ea9ff..de746d5d31cd7767ee20ff4cdcf787dbf9603fbf 100644
--- a/content/renderer/media/audio_message_filter.h
+++ b/content/renderer/media/audio_message_filter.h
@@ -11,9 +11,10 @@
#define CONTENT_RENDERER_MEDIA_AUDIO_MESSAGE_FILTER_H_
#include "base/gtest_prod_util.h"
-#include "base/id_map.h"
+#include "base/hash_tables.h"
#include "base/shared_memory.h"
#include "base/sync_socket.h"
+#include "base/synchronization/lock.h"
#include "content/common/content_export.h"
#include "ipc/ipc_channel_proxy.h"
#include "media/audio/audio_buffers_state.h"
@@ -30,7 +31,10 @@ class CONTENT_EXPORT AudioMessageFilter
// Getter for the one AudioMessageFilter object.
static AudioMessageFilter* Get();
- // media::AudioOutputIPCDelegate implementation.
+ // Associates |render_view_id| as the source of audio rendered for a stream.
+ void AssociateStreamWithProducer(int stream_id, int render_view_id);
+
+ // media::AudioOutputIPC implementation.
virtual int AddDelegate(media::AudioOutputIPCDelegate* delegate) OVERRIDE;
virtual void RemoveDelegate(int id) OVERRIDE;
virtual void CreateStream(int stream_id,
@@ -74,8 +78,16 @@ class CONTENT_EXPORT AudioMessageFilter
// The singleton instance for this filter.
static AudioMessageFilter* filter_;
+ // Guards delegates_ since AddDelegate() and RemoveDelegate() are called from
+ // threads other than the IO thread.
+ base::Lock delegates_lock_;
+
// A map of stream ids to delegates.
- IDMap<media::AudioOutputIPCDelegate> delegates_;
+ typedef base::hash_map<int, media::AudioOutputIPCDelegate*> DelegateMap;
+ DelegateMap delegates_;
+
+ // Unique ID to use for next added delegate.
+ int next_stream_id_;
IPC::Channel* channel_;
« no previous file with comments | « content/renderer/media/audio_input_message_filter.cc ('k') | content/renderer/media/audio_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698