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 d60c80cc3458acbc496d3a3d658398b1c55e757b..38deb80e3ab66836f1d93c8dd80dc620fe46b097 100644 |
--- a/content/renderer/media/audio_message_filter.h |
+++ b/content/renderer/media/audio_message_filter.h |
@@ -7,6 +7,7 @@ |
#include "base/gtest_prod_util.h" |
#include "base/id_map.h" |
+#include "base/memory/scoped_ptr.h" |
#include "base/shared_memory.h" |
#include "base/sync_socket.h" |
#include "base/synchronization/lock.h" |
@@ -26,8 +27,7 @@ namespace content { |
// IO thread (secondary thread of render process) it intercepts audio messages |
// and process them on IO thread since these messages are time critical. |
class CONTENT_EXPORT AudioMessageFilter |
- : public IPC::ChannelProxy::MessageFilter, |
- public NON_EXPORTED_BASE(media::AudioOutputIPC) { |
+ : public IPC::ChannelProxy::MessageFilter { |
public: |
explicit AudioMessageFilter( |
const scoped_refptr<base::MessageLoopProxy>& io_message_loop); |
@@ -35,26 +35,12 @@ class CONTENT_EXPORT AudioMessageFilter |
// Getter for the one AudioMessageFilter object. |
static AudioMessageFilter* Get(); |
- // 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; |
- |
- // Methods below must be called on the provided |io_message_loop|. |
- virtual void CreateStream(int stream_id, |
- const media::AudioParameters& params) OVERRIDE; |
- virtual void PlayStream(int stream_id) OVERRIDE; |
- virtual void PauseStream(int stream_id) OVERRIDE; |
- virtual void CloseStream(int stream_id) OVERRIDE; |
- virtual void SetVolume(int stream_id, double volume) OVERRIDE; |
- |
- // IPC::ChannelProxy::MessageFilter override. Called on |io_message_loop|. |
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
- virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; |
- virtual void OnFilterRemoved() OVERRIDE; |
- virtual void OnChannelClosing() OVERRIDE; |
+ // Create an AudioOutputIPC to be owned by one delegate. |render_view_id| is |
+ // the render view containing the entity producing the audio. |
+ // |
+ // The returned object is not thread-safe, and must be used on |
+ // |io_message_loop|. |
+ scoped_ptr<media::AudioOutputIPC> CreateAudioOutputIPC(int render_view_id); |
// When set, AudioMessageFilter will update the AudioHardwareConfig with new |
// configuration values as recieved by OnOutputDeviceChanged(). The provided |
@@ -73,9 +59,19 @@ class CONTENT_EXPORT AudioMessageFilter |
FRIEND_TEST_ALL_PREFIXES(AudioMessageFilterTest, Basic); |
FRIEND_TEST_ALL_PREFIXES(AudioMessageFilterTest, Delegates); |
+ // Implementation of media::AudioOutputIPC which augments IPC calls with |
+ // stream_id and the source render_view_id. |
+ class AudioOutputIPCImpl; |
+ |
// Sends an IPC message using |channel_|. |
void Send(IPC::Message* message); |
+ // IPC::ChannelProxy::MessageFilter override. Called on |io_message_loop|. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; |
+ virtual void OnFilterRemoved() OVERRIDE; |
+ virtual void OnChannelClosing() OVERRIDE; |
+ |
// Received when browser process has created an audio output stream. |
void OnStreamCreated(int stream_id, base::SharedMemoryHandle handle, |
#if defined(OS_WIN) |
@@ -94,9 +90,6 @@ class CONTENT_EXPORT AudioMessageFilter |
void OnOutputDeviceChanged(int stream_id, int new_buffer_size, |
int new_sample_rate); |
- // The singleton instance for this filter. |
- static AudioMessageFilter* filter_; |
- |
// IPC channel for Send(); must only be accesed on |io_message_loop_|. |
IPC::Channel* channel_; |
@@ -112,6 +105,9 @@ class CONTENT_EXPORT AudioMessageFilter |
// Message loop on which IPC calls are driven. |
const scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
+ // The singleton instance for this filter. |
+ static AudioMessageFilter* g_filter; |
+ |
DISALLOW_COPY_AND_ASSIGN(AudioMessageFilter); |
}; |