summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_view.h
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-20 05:02:56 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-20 05:02:56 +0000
commit6f56d48b6d12eb675aeb78c503cc72c100b243f3 (patch)
tree36b0b18addb8543521297401ccd88f69f712f6fd /chrome/renderer/render_view.h
parentf8fae18a398d4925bd59e80e81890c12195146cc (diff)
downloadchromium_src-6f56d48b6d12eb675aeb78c503cc72c100b243f3.zip
chromium_src-6f56d48b6d12eb675aeb78c503cc72c100b243f3.tar.gz
chromium_src-6f56d48b6d12eb675aeb78c503cc72c100b243f3.tar.bz2
Audio related IPC messages and handlers from browser to
renderer 1. Added 4 IPC messages and corresponding handlers for audio: - RequestAudioPacket(int stream_id) Browser process is hungry for audio packet, notify renderer process to provide more. - NotifyAudioStreamCreated(int stream_id, SharedMemoryHandler buffer, int len) Notify stream created event and provide buffer for filling in the future. - NotifyAudioStreamStateChanged(int stream_id, enum state, nt info) The internal state of the audio stream has chagned, notify renderer process of the change. int info provides additional information of the change, e.g. platform specific error code. - NotifyAudioStreamVolume(int stream_id, double left, double right) Notify the current volume for the audio stream. 2. Added methods to RenderView for creating audio streams and delegate audio related requests to browser process with IPC. Now the registration and bookkeeping of AudioRendererImpl happens in RenderView (see audio_renderers_). The reason being that the code is almost just an base::IDMap that doesn't worth creating a new class. Review URL: http://codereview.chromium.org/20410 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10078 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.h')
-rw-r--r--chrome/renderer/render_view.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 59e2fad..9ff7e06 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -11,6 +11,8 @@
#include "base/basictypes.h"
#include "base/gfx/point.h"
#include "base/gfx/rect.h"
+#include "base/id_map.h"
+#include "base/shared_memory.h"
#include "base/timer.h"
#include "base/values.h"
#include "build/build_config.h"
@@ -23,6 +25,7 @@
#include "chrome/renderer/external_host_bindings.h"
#include "chrome/renderer/external_js_object.h"
#include "chrome/renderer/render_widget.h"
+#include "media/audio/audio_output.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
#include "webkit/glue/console_message_level.h"
#include "webkit/glue/dom_serializer_delegate.h"
@@ -38,6 +41,7 @@
#pragma warning(disable: 4250)
#endif
+class AudioRendererImpl;
class DictionaryValue;
class DebugMessageHandler;
class FilePath;
@@ -342,6 +346,19 @@ class RenderView : public RenderWidget,
// the renderer, which processes all IPC, to any I/O should be non-blocking.
MessageLoop* GetMessageLoopForIO();
+ // Register the audio renderer and try to create an audio output stream in the
+ // browser process. Always return a stream id. Audio renderer will then
+ // receive state change notification messages.
+ int32 CreateAudioStream(AudioRendererImpl* renderer,
+ AudioManager::Format format, int channels,
+ int sample_rate, int bits_per_sample,
+ size_t packet_size);
+ void StartAudioStream(int stream_id);
+ void CloseAudioStream(int stream_id);
+ void NotifyAudioPacketReady(int stream_id);
+ void GetAudioVolume(int stream_id);
+ void SetAudioVolume(int stream_id, double left, double right);
+
private:
FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText);
FRIEND_TEST(RenderViewTest, OnNavStateChanged);
@@ -524,6 +541,21 @@ class RenderView : public RenderWidget,
// grouping, and should form our own grouping.
void OnDisassociateFromPopupCount();
+ // Received when browser process wants more audio packet.
+ void OnRequestAudioPacket(int stream_id);
+
+ // Received when browser process has created an audio output stream for us.
+ void OnAudioStreamCreated(int stream_id, base::SharedMemoryHandle handle,
+ int length);
+
+ // Received when internal state of browser process' audio output device has
+ // changed.
+ void OnAudioStreamStateChanged(int stream_id, AudioOutputStream::State state,
+ int info);
+
+ // Notification of volume property of an audio output stream.
+ void OnAudioStreamVolume(int stream_id, double left, double right);
+
// Switches the frame's CSS media type to "print" and calculate the number of
// printed pages that are to be expected. |frame| will be used to calculate
// the number of expected pages for this frame only.
@@ -752,6 +784,9 @@ class RenderView : public RenderWidget,
// change but is overridden by tests.
int delay_seconds_for_form_state_sync_;
+ // A set of audio renderers registered to use IPC for audio output.
+ IDMap<AudioRendererImpl> audio_renderers_;
+
DISALLOW_COPY_AND_ASSIGN(RenderView);
};