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

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

Issue 7631033: Very early implementation for HTMLMediaElement / Web Audio API integration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « content/renderer/media/audio_device.h ('k') | content/renderer/media/audio_renderer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/audio_renderer_impl.h
===================================================================
--- content/renderer/media/audio_renderer_impl.h (revision 97713)
+++ content/renderer/media/audio_renderer_impl.h (working copy)
@@ -44,34 +44,24 @@
#include "base/shared_memory.h"
#include "base/synchronization/lock.h"
#include "base/threading/simple_thread.h"
-#include "content/renderer/media/audio_message_filter.h"
+#include "content/renderer/media/audio_device.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_manager.h"
#include "media/base/filters.h"
#include "media/filters/audio_renderer_base.h"
+#include "media/filters/audio_renderer_sink.h"
class AudioMessageFilter;
class AudioRendererImpl
: public media::AudioRendererBase,
- public AudioMessageFilter::Delegate,
- public base::DelegateSimpleThread::Delegate,
+ public media::AudioRendererSink::RenderCallback,
public MessageLoop::DestructionObserver {
public:
// Methods called on Render thread ------------------------------------------
- explicit AudioRendererImpl();
+ explicit AudioRendererImpl(MessageLoop* render_loop);
virtual ~AudioRendererImpl();
- // Methods called on IO thread ----------------------------------------------
- // AudioMessageFilter::Delegate methods, called by AudioMessageFilter.
- virtual void OnRequestPacket(AudioBuffersState buffers_state);
- virtual void OnStateChanged(AudioStreamState state);
- virtual void OnCreated(base::SharedMemoryHandle handle, uint32 length);
- virtual void OnLowLatencyCreated(base::SharedMemoryHandle handle,
- base::SyncSocket::Handle socket_handle,
- uint32 length);
- virtual void OnVolume(double volume);
-
// Methods called on pipeline thread ----------------------------------------
// media::Filter implementation.
virtual void SetPlaybackRate(float rate);
@@ -82,6 +72,12 @@
// media::AudioRenderer implementation.
virtual void SetVolume(float volume);
+ // AudioRendererSink::RenderCallback implementation.
+ virtual void Render(const std::vector<float*>& audio_data,
+ size_t number_of_frames,
+ size_t audio_delay_milliseconds);
+ virtual void SetAudioRendererSink(media::AudioRendererSink* audio_sink);
+
protected:
// Methods called on audio renderer thread ----------------------------------
// These methods are called from AudioRendererBase.
@@ -90,16 +86,8 @@
// Called when the decoder completes a Read().
virtual void ConsumeAudioSamples(scoped_refptr<media::Buffer> buffer_in);
-
+
private:
- // We are using either low- or high-latency code path.
- enum LatencyType {
- kUninitializedLatency = 0,
- kLowLatency,
- kHighLatency
- };
- static LatencyType latency_type_;
-
// For access to constructor and IO thread methods.
friend class AudioRendererImplTest;
friend class DelegateCaller;
@@ -115,7 +103,7 @@
// The following methods are tasks posted on the IO thread that needs to
// be executed on that thread. They interact with AudioMessageFilter and
// sends IPC messages on that thread.
- void CreateStreamTask(const AudioParameters& params);
+ void InitializeTask(const AudioParameters& params);
void PlayTask();
void PauseTask();
void SeekTask();
@@ -126,45 +114,9 @@
// Called on IO thread when message loop is dying.
virtual void WillDestroyCurrentMessageLoop();
- // DelegateSimpleThread::Delegate implementation.
- virtual void Run();
-
- // (Re-)starts playback.
- void NotifyDataAvailableIfNecessary();
-
- // Creates socket. Virtual so tests can override.
- virtual void CreateSocket(base::SyncSocket::Handle socket_handle);
-
- // Launching audio thread. Virtual so tests can override.
- virtual void CreateAudioThread();
-
- // Accessors used by tests.
- LatencyType latency_type() {
- return latency_type_;
- }
-
- // Should be called before any class instance is created.
- static void set_latency_type(LatencyType latency_type);
-
- // Helper method for IPC send calls.
- void Send(IPC::Message* message);
-
// Used to calculate audio delay given bytes.
uint32 bytes_per_second_;
- // ID of the stream created in the browser process.
- int32 stream_id_;
-
- // Memory shared by the browser process for audio buffer.
- scoped_ptr<base::SharedMemory> shared_memory_;
- uint32 shared_memory_size_;
-
- // Cached audio message filter (lives on the main render thread).
- scoped_refptr<AudioMessageFilter> filter_;
-
- // Low latency IPC stuff.
- scoped_ptr<base::SyncSocket> socket_;
-
// That thread waits for audio input.
scoped_ptr<base::DelegateSimpleThread> audio_thread_;
@@ -189,6 +141,10 @@
// Remaining bytes for prerolling to complete.
uint32 preroll_bytes_;
+ media::AudioRendererSink* audio_device_;
+ MessageLoop* render_loop_;
+ int bytes_per_frame_;
+
DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
};
« no previous file with comments | « content/renderer/media/audio_device.h ('k') | content/renderer/media/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698