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

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

Issue 7253003: Change audio renderer to communicate with host using low latency codepath. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 5 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/common/content_switches.cc ('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 91508)
+++ content/renderer/media/audio_renderer_impl.h (working copy)
@@ -43,6 +43,7 @@
#include "base/message_loop.h"
#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 "media/audio/audio_io.h"
#include "media/audio/audio_manager.h"
@@ -53,6 +54,7 @@
class AudioRendererImpl : public media::AudioRendererBase,
public AudioMessageFilter::Delegate,
+ public base::DelegateSimpleThread::Delegate,
public MessageLoop::DestructionObserver {
public:
// Methods called on Render thread ------------------------------------------
@@ -89,6 +91,14 @@
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_TEST_ALL_PREFIXES(AudioRendererImplTest, Stop);
@@ -114,6 +124,26 @@
// 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);
+
// Used to calculate audio delay given bytes.
uint32 bytes_per_second_;
@@ -126,6 +156,12 @@
scoped_ptr<base::SharedMemory> shared_memory_;
uint32 shared_memory_size_;
+ // Low latency IPC stuff.
+ scoped_ptr<base::SyncSocket> socket_;
+
+ // That thread waits for audio input.
+ scoped_ptr<base::DelegateSimpleThread> audio_thread_;
+
// Message loop for the IO thread.
MessageLoop* io_loop_;
« no previous file with comments | « content/common/content_switches.cc ('k') | content/renderer/media/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698