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

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

Issue 12383016: Merge AssociateStreamWithProducer message into CreateStream message for both audio output and input. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 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.h
diff --git a/content/renderer/media/audio_message_filter.h b/content/renderer/media/audio_message_filter.h
index 7c352d626df66f992000d39fae1b7b1a31b33467..42adb66b13fb071f7458afd0533d859d45f1e365 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,27 +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 FlushStream(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
@@ -74,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)
@@ -95,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_;

Powered by Google App Engine
This is Rietveld 408576698