summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-11 03:07:27 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-11 03:07:27 +0000
commitf4d27d908bcf7db4efbac97318ecb5d52892823b (patch)
treef5b67f2318bdc653f9c948c4bc6454b574a4f1bd
parentcccbe29c642c47816478b8ba3df9329fcee03728 (diff)
downloadchromium_src-f4d27d908bcf7db4efbac97318ecb5d52892823b.zip
chromium_src-f4d27d908bcf7db4efbac97318ecb5d52892823b.tar.gz
chromium_src-f4d27d908bcf7db4efbac97318ecb5d52892823b.tar.bz2
Construct AudioRendererHost in BrowserRendererProcessHost, also construct
ResourceMessageFilter with pointer to it so we can delegate requests to it from IPC later. Review URL: http://codereview.chromium.org/20131 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9551 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.scons3
-rw-r--r--chrome/browser/renderer_host/audio_renderer_host.cc57
-rw-r--r--chrome/browser/renderer_host/audio_renderer_host.h38
-rw-r--r--chrome/browser/renderer_host/audio_renderer_host_unittest.cc11
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc9
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h4
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc5
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h5
-rw-r--r--chrome/chrome.xcodeproj/project.pbxproj96
-rw-r--r--chrome/test/unit/unit_tests.scons1
-rw-r--r--media/audio/audio_output.h2
-rw-r--r--media/audio/linux/audio_manager_linux.cc10
-rw-r--r--media/audio/mac/audio_manager_mac.cc10
-rw-r--r--media/media.xcodeproj/project.pbxproj12
-rw-r--r--media/media_lib.scons10
15 files changed, 255 insertions, 18 deletions
diff --git a/chrome/browser/browser.scons b/chrome/browser/browser.scons
index d1dcd6a..de44b18 100644
--- a/chrome/browser/browser.scons
+++ b/chrome/browser/browser.scons
@@ -15,6 +15,7 @@ env.SConscript([
'$ICU38_DIR/using_icu38.scons',
'$LIBPNG_DIR/using_libpng.scons',
'$LIBXML_DIR/using_libxml.scons',
+ '$MEDIA_DIR/using_media.scons',
'$NPAPI_DIR/using_npapi.scons',
'$SKIA_DIR/using_skia.scons',
'$ZLIB_DIR/using_zlib.scons',
@@ -508,6 +509,8 @@ input_files = ChromeFileList([
MSVSFilter('Renderer Host', [
'renderer_host/async_resource_handler.cc',
'renderer_host/async_resource_handler.h',
+ 'renderer_host/audio_renderer_host.cc',
+ 'renderer_host/audio_renderer_host.h',
'renderer_host/backing_store.h',
'renderer_host/backing_store.cc',
'renderer_host/backing_store_win.cc',
diff --git a/chrome/browser/renderer_host/audio_renderer_host.cc b/chrome/browser/renderer_host/audio_renderer_host.cc
index 66ee9ff..fd798ac 100644
--- a/chrome/browser/renderer_host/audio_renderer_host.cc
+++ b/chrome/browser/renderer_host/audio_renderer_host.cc
@@ -68,18 +68,21 @@ void AudioRendererHost::IPCAudioSource::NotifyPacketReady() {
AudioRendererHost::AudioRendererHost(MessageLoop* message_loop)
: next_id_(INVALID_ID+1),
- message_loop_(message_loop) {
+ io_loop_(message_loop) {
+ // Make sure we perform actual initialization operations in the thread where
+ // this object should live.
+ io_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &AudioRendererHost::OnInitialized));
}
AudioRendererHost::~AudioRendererHost() {
- DestroyAllStreams();
}
int AudioRendererHost::CreateStream(
IPC::Message::Sender* sender, base::ProcessHandle handle,
AudioManager::Format format, int channels, int sample_rate,
int bits_per_sample, size_t packet_size) {
- DCHECK(MessageLoop::current() == message_loop_);
+ DCHECK(MessageLoop::current() == io_loop_);
// Create the stream in the first place.
AudioOutputStream* stream = AudioManager::GetAudioManager()->MakeAudioStream(
@@ -100,7 +103,7 @@ int AudioRendererHost::CreateStream(
}
bool AudioRendererHost::Start(int stream_id) {
- DCHECK(MessageLoop::current() == message_loop_);
+ DCHECK(MessageLoop::current() == io_loop_);
IPCAudioSource* source = sources_.Lookup(stream_id);
if (source) {
source->stream()->Start(source);
@@ -110,7 +113,7 @@ bool AudioRendererHost::Start(int stream_id) {
}
bool AudioRendererHost::Stop(int stream_id) {
- DCHECK(MessageLoop::current() == message_loop_);
+ DCHECK(MessageLoop::current() == io_loop_);
IPCAudioSource* source = sources_.Lookup(stream_id);
if (source) {
source->stream()->Stop();
@@ -120,7 +123,7 @@ bool AudioRendererHost::Stop(int stream_id) {
}
bool AudioRendererHost::Close(int stream_id) {
- DCHECK(MessageLoop::current() == message_loop_);
+ DCHECK(MessageLoop::current() == io_loop_);
IPCAudioSource* source = sources_.Lookup(stream_id);
if (source) {
source->stream()->Close();
@@ -131,7 +134,7 @@ bool AudioRendererHost::Close(int stream_id) {
bool AudioRendererHost::SetVolume(
int stream_id, double left_channel, double right_channel) {
- DCHECK(MessageLoop::current() == message_loop_);
+ DCHECK(MessageLoop::current() == io_loop_);
IPCAudioSource* source = sources_.Lookup(stream_id);
if (source) {
source->stream()->SetVolume(left_channel, right_channel);
@@ -141,7 +144,7 @@ bool AudioRendererHost::SetVolume(
bool AudioRendererHost::GetVolume(
int stream_id, double* left_channel, double* right_channel) {
- DCHECK(MessageLoop::current() == message_loop_);
+ DCHECK(MessageLoop::current() == io_loop_);
IPCAudioSource* source = sources_.Lookup(stream_id);
if (source) {
source->stream()->GetVolume(left_channel, right_channel);
@@ -151,7 +154,7 @@ bool AudioRendererHost::GetVolume(
}
void AudioRendererHost::NotifyPacketReady(int stream_id) {
- DCHECK(MessageLoop::current() == message_loop_);
+ DCHECK(MessageLoop::current() == io_loop_);
IPCAudioSource* source = sources_.Lookup(stream_id);
if (source) {
source->NotifyPacketReady();
@@ -159,16 +162,48 @@ void AudioRendererHost::NotifyPacketReady(int stream_id) {
}
void AudioRendererHost::DestroyAllStreams() {
- DCHECK(MessageLoop::current() == message_loop_);
+ DCHECK(MessageLoop::current() == io_loop_);
// TODO(hclam): iterate on the map, close and delete every stream, and clear
// the map.
}
void AudioRendererHost::DestroySource(int stream_id) {
- DCHECK(MessageLoop::current() == message_loop_);
+ DCHECK(MessageLoop::current() == io_loop_);
IPCAudioSource* source = sources_.Lookup(stream_id);
if (source) {
sources_.Remove(stream_id);
delete source;
}
}
+
+void AudioRendererHost::Destroy() {
+ // Post a message to the thread where this object should live and do the
+ // actual operations there.
+ io_loop_->PostTask(
+ FROM_HERE, NewRunnableMethod(this, &AudioRendererHost::OnDestroyed));
+}
+
+void AudioRendererHost::OnInitialized() {
+ DCHECK(MessageLoop::current() == io_loop_);
+
+ // Increase the ref count of this object so it is active until we do
+ // Release().
+ AddRef();
+
+ // Also create the AudioManager singleton in this thread.
+ // TODO(hclam): figure out a better location to initialize the AudioManager
+ // singleton.
+ AudioManager::GetAudioManager();
+}
+
+void AudioRendererHost::OnDestroyed() {
+ DCHECK(MessageLoop::current() == io_loop_);
+
+ // Destroy audio streams only in the thread it should happen.
+ // TODO(hclam): make sure we don't call IPC::Message::Sender inside
+ // IPCAudioSource because it is most likely be destroyed.
+ DestroyAllStreams();
+
+ // Decrease the reference to this object, which may lead to self-destruction.
+ Release();
+}
diff --git a/chrome/browser/renderer_host/audio_renderer_host.h b/chrome/browser/renderer_host/audio_renderer_host.h
index 4df24ba..8128d61 100644
--- a/chrome/browser/renderer_host/audio_renderer_host.h
+++ b/chrome/browser/renderer_host/audio_renderer_host.h
@@ -17,11 +17,31 @@
// passing a SharedMemoryHandle for filling the buffer.
// NotifyPacketReady(|stream_id|) would be called when the buffer is filled
// and ready to be consumed.
+//
+// This class is owned by BrowserRenderProcessHost, and instantiated on UI
+// thread, but all other operations and method calls (except Destroy()) happens
+// in IO thread, so we need to be extra careful about the lifetime of this
+// object. AudioManager is a singleton and created in IO thread, audio output
+// streams are also created in the IO thread, so we need to destroy them also
+// in IO thread. After this class is created, a task of OnInitialized() is
+// posted on IO thread in which singleton of AudioManager is created and
+// AddRef() is called to increase one ref count of this object. Owner of this
+// class should call Destroy() before decrementing the ref count to this object,
+// which essentially post a task of OnDestroyed() on IO thread. Inside
+// OnDestroyed(), audio output streams are destroyed and Release() is called
+// which may result in self-destruction.
+//
+// TODO(hclam): Have these things done before having real implementations:
+// 1. Make sure this class has greater or equal lifetime to
+// IPC:Message::Sender, essentially ResourceMessageFilter.
+// 2. Listen to destruction event of the browser and do cleanup in case this
+// class is not destructed nicely during browser close.
#ifndef CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_
#define CHROME_BROWSER_RENDERER_HOST_AUDIO_RENDERER_HOST_H_
#include "base/id_map.h"
+#include "base/ref_counted.h"
#include "base/shared_memory.h"
#include "chrome/common/ipc_message.h"
#include "media/audio/audio_output.h"
@@ -29,7 +49,7 @@
class AudioManager;
class MessageLoop;
-class AudioRendererHost {
+class AudioRendererHost : public base::RefCountedThreadSafe<AudioRendererHost> {
public:
static const int32 INVALID_ID = 0;
@@ -74,14 +94,24 @@ class AudioRendererHost {
// consumed.
void NotifyPacketReady(int32 stream_id);
- // Destroy all audio output streams.
- void DestroyAllStreams();
+ // Called from UI thread from the owner of this object.
+ void Destroy();
// Destroy the stream specified by |stream_id| and remove it from map.
// *DO NOT* call this method other than from IPCAudioSource.
void DestroySource(int32 stream_id);
private:
+ // Methods called on IO thread.
+ // Called on IO thread when this object is created and initialized.
+ void OnInitialized();
+ // Called on IO thread when this object needs to be destroyed and after
+ // Destroy() is called from owner of this class in UI thread.
+ void OnDestroyed();
+
+ // Destroy all audio output streams.
+ void DestroyAllStreams();
+
// The container for AudioOutputStream and serves audio packet for it by IPC.
class IPCAudioSource : public AudioOutputStream::AudioSourceCallback {
public:
@@ -124,7 +154,7 @@ class AudioRendererHost {
// Only used for DCHECKs to make sure all methods calls are from the same
// thread as this object is created.
- MessageLoop* message_loop_;
+ MessageLoop* io_loop_;
DISALLOW_COPY_AND_ASSIGN(AudioRendererHost);
};
diff --git a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc
index 443966b..d7ab831 100644
--- a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc
+++ b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc
@@ -11,10 +11,17 @@
class AudioRendererHostTest : public testing::Test {
protected:
virtual void SetUp() {
- host_.reset(new AudioRendererHost(MessageLoop::current()));
+ // Create a message loop so AudioRendererHost can use it.
+ message_loop_.reset(new MessageLoop(MessageLoop::TYPE_IO));
+ host_ = new AudioRendererHost(MessageLoop::current());
}
- scoped_ptr<AudioRendererHost> host_;
+ virtual void TearDown() {
+ host_->Destroy();
+ }
+
+ scoped_refptr<AudioRendererHost> host_;
+ scoped_ptr<MessageLoop> message_loop_;
};
TEST_F(AudioRendererHostTest, NoTest) {
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index b020feb..24d5f4d 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -155,6 +155,10 @@ BrowserRenderProcessHost::~BrowserRenderProcessHost() {
// We may have some unsent messages at this point, but that's OK.
channel_.reset();
+ // Destroy the AudioRendererHost properly.
+ if (audio_renderer_host_.get())
+ audio_renderer_host_->Destroy();
+
if (process_.handle() && !run_renderer_in_process()) {
ProcessWatcher::EnsureProcessTerminated(process_.handle());
}
@@ -195,8 +199,13 @@ bool BrowserRenderProcessHost::Init() {
// run the IPC channel on the shared IO thread.
base::Thread* io_thread = g_browser_process->io_thread();
+ // Construct the AudioRendererHost with the IO thread.
+ audio_renderer_host_ =
+ new AudioRendererHost(io_thread->message_loop());
+
scoped_refptr<ResourceMessageFilter> resource_message_filter =
new ResourceMessageFilter(g_browser_process->resource_dispatcher_host(),
+ audio_renderer_host_.get(),
PluginService::GetInstance(),
g_browser_process->print_job_manager(),
host_id(),
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index 3e40d50..d089516 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -13,6 +13,7 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/shared_memory.h"
+#include "chrome/browser/renderer_host/audio_renderer_host.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/common/notification_observer.h"
#include "webkit/glue/cache_manager.h"
@@ -136,6 +137,9 @@ class BrowserRenderProcessHost : public RenderProcessHost,
// IO thread.
scoped_refptr<RenderWidgetHelper> widget_helper_;
+ // The host of audio renderers in the renderer process.
+ scoped_refptr<AudioRendererHost> audio_renderer_host_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost);
};
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 2db7124..19f0ad9 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/net/dns_global.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/renderer_host/audio_renderer_host.h"
#include "chrome/browser/renderer_host/browser_render_process_host.h"
#include "chrome/browser/renderer_host/render_widget_helper.h"
#include "chrome/common/chrome_plugin_lib.h"
@@ -92,6 +93,7 @@ class WriteClipboardTask : public Task {
ResourceMessageFilter::ResourceMessageFilter(
ResourceDispatcherHost* resource_dispatcher_host,
+ AudioRendererHost* audio_renderer_host,
PluginService* plugin_service,
printing::PrintJobManager* print_job_manager,
int render_process_host_id,
@@ -108,7 +110,8 @@ ResourceMessageFilter::ResourceMessageFilter(
render_handle_(NULL),
request_context_(profile->GetRequestContext()),
profile_(profile),
- render_widget_helper_(render_widget_helper) {
+ render_widget_helper_(render_widget_helper),
+ audio_renderer_host_(audio_renderer_host) {
DCHECK(request_context_.get());
DCHECK(request_context_->cookie_store());
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index c4d75e3..34d3c3d 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -25,6 +25,7 @@
#include "chrome/common/temp_scaffolding_stubs.h"
#endif
+class AudioRendererHost;
class ClipboardService;
class Profile;
class RenderWidgetHelper;
@@ -57,6 +58,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
// ResourceMessageFilter is 'given' ownership of the spellchecker
// object and must clean it up on exit.
ResourceMessageFilter(ResourceDispatcherHost* resource_dispatcher_host,
+ AudioRendererHost* audio_renderer_host,
PluginService* plugin_service,
printing::PrintJobManager* print_job_manager,
int render_process_host_id,
@@ -239,6 +241,9 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
scoped_refptr<RenderWidgetHelper> render_widget_helper_;
+ // Object that should take care of audio related resource requests.
+ scoped_refptr<AudioRendererHost> audio_renderer_host_;
+
DISALLOW_COPY_AND_ASSIGN(ResourceMessageFilter);
};
diff --git a/chrome/chrome.xcodeproj/project.pbxproj b/chrome/chrome.xcodeproj/project.pbxproj
index 7c80e3a..c1d901b 100644
--- a/chrome/chrome.xcodeproj/project.pbxproj
+++ b/chrome/chrome.xcodeproj/project.pbxproj
@@ -286,6 +286,10 @@
A7C613C10F30D7E4008CEE5D /* mock_render_process_host.cc in Sources */ = {isa = PBXBuildFile; fileRef = A7C613BF0F30D7E4008CEE5D /* mock_render_process_host.cc */; };
A7C6146F0F30DA1D008CEE5D /* ipc_test_sink.cc in Sources */ = {isa = PBXBuildFile; fileRef = A7C6146D0F30DA1D008CEE5D /* ipc_test_sink.cc */; };
A7CBAD390F322A7E00360BF5 /* shell_dialogs_mac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A7CBAD370F322A7E00360BF5 /* shell_dialogs_mac.mm */; };
+ ABFA33770F424E47008FCF5D /* audio_renderer_host.cc in Sources */ = {isa = PBXBuildFile; fileRef = ABFA33740F424E06008FCF5D /* audio_renderer_host.cc */; };
+ ABFA34C50F4255CC008FCF5D /* libmedia.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ABFA33880F424EC5008FCF5D /* libmedia.a */; };
+ ABFA34C70F425637008FCF5D /* libmedia.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ABFA33880F424EC5008FCF5D /* libmedia.a */; };
+ ABFA34C80F425677008FCF5D /* libmedia.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ABFA33880F424EC5008FCF5D /* libmedia.a */; };
B0AC9501DED2809AC208AEEA /* resolve_proxy_msg_helper.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4F9429998AC2703984BAB828 /* resolve_proxy_msg_helper.cc */; };
B502DA280F098056005BE90C /* visit_database_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFA180E9D48F7009A6919 /* visit_database_unittest.cc */; };
B502DA520F098888005BE90C /* l10n_util.cc in Sources */ = {isa = PBXBuildFile; fileRef = 4D7BFBC90E9D4C9F009A6919 /* l10n_util.cc */; };
@@ -1536,6 +1540,41 @@
remoteGlobalIDString = 7BA361A60E8C36E50023C8B9;
remoteInfo = sdch;
};
+ ABFA33870F424EC5008FCF5D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = ABFA33790F424EC5008FCF5D /* media.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = E4BA04540E25613300BE02C6 /* libmedia.a */;
+ remoteInfo = media;
+ };
+ ABFA33890F424EC5008FCF5D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = ABFA33790F424EC5008FCF5D /* media.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = E4AFA6230E523E2900201347 /* media_unittests */;
+ remoteInfo = media_unittests;
+ };
+ ABFA338D0F424F39008FCF5D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = ABFA33790F424EC5008FCF5D /* media.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D /* media */;
+ remoteInfo = media;
+ };
+ ABFA33DA0F4252CD008FCF5D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = ABFA33790F424EC5008FCF5D /* media.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D /* media */;
+ remoteInfo = media;
+ };
+ ABFA34C90F425694008FCF5D /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = ABFA33790F424EC5008FCF5D /* media.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = D2AAC045055464E500DB518D /* media */;
+ remoteInfo = media;
+ };
B503E1010F017BE300547DC6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4D7BF2E90E9D46A4009A6919 /* Project object */;
@@ -2366,6 +2405,10 @@
A7C6146E0F30DA1D008CEE5D /* ipc_test_sink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ipc_test_sink.h; sourceTree = "<group>"; };
A7CBAD370F322A7E00360BF5 /* shell_dialogs_mac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = shell_dialogs_mac.mm; path = cocoa/shell_dialogs_mac.mm; sourceTree = "<group>"; };
A9C335E39D39A7DE087850FC /* url_pattern_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = url_pattern_unittest.cc; path = common/extensions/url_pattern_unittest.cc; sourceTree = SOURCE_ROOT; };
+ ABFA33740F424E06008FCF5D /* audio_renderer_host.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio_renderer_host.cc; path = renderer_host/audio_renderer_host.cc; sourceTree = "<group>"; };
+ ABFA33750F424E06008FCF5D /* audio_renderer_host.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = audio_renderer_host.h; path = renderer_host/audio_renderer_host.h; sourceTree = "<group>"; };
+ ABFA33760F424E06008FCF5D /* audio_renderer_host_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio_renderer_host_unittest.cc; path = renderer_host/audio_renderer_host_unittest.cc; sourceTree = "<group>"; };
+ ABFA33790F424EC5008FCF5D /* media.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = media.xcodeproj; path = media/media.xcodeproj; sourceTree = "<group>"; };
B51F6D110F37C4DC00152D66 /* renderer_main_platform_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = renderer_main_platform_delegate.h; sourceTree = "<group>"; };
B51F6D120F37C4DC00152D66 /* renderer_main_platform_delegate_win.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = renderer_main_platform_delegate_win.cc; sourceTree = "<group>"; };
B51F6D130F37C4DC00152D66 /* renderer_main_platform_delegate_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = renderer_main_platform_delegate_mac.cc; sourceTree = "<group>"; };
@@ -2693,6 +2736,7 @@
4D7BFF3A0E9D5378009A6919 /* libjpeg.a in Frameworks */,
E477F6B70F4095660044ABEB /* libjsbindings.a in Frameworks */,
E477F6B80F4095660044ABEB /* libjscre.a in Frameworks */,
+ ABFA34C80F425677008FCF5D /* libmedia.a in Frameworks */,
4D7B005E0E9D54BB009A6919 /* libmodp_b64.a in Frameworks */,
4D7B00510E9D5473009A6919 /* libnet.a in Frameworks */,
E477F6B90F4095660044ABEB /* libpcre.a in Frameworks */,
@@ -2746,6 +2790,7 @@
331218460F3C024A006CB2B0 /* libjpeg.a in Frameworks */,
E4DCDC9F0F40938D0084059A /* libjsbindings.a in Frameworks */,
E4DCDCA00F40938D0084059A /* libjscre.a in Frameworks */,
+ ABFA34C70F425637008FCF5D /* libmedia.a in Frameworks */,
33121A470F3C037E006CB2B0 /* libmodp_b64.a in Frameworks */,
331218410F3C0208006CB2B0 /* libnet.a in Frameworks */,
E4DCDCA10F40938D0084059A /* libpcre.a in Frameworks */,
@@ -2809,6 +2854,7 @@
E45062AC0EE89154003BE099 /* libicuuc.a in Frameworks */,
E4DCDC910F40929C0084059A /* libjsbindings.a in Frameworks */,
E4DCDC970F4092C10084059A /* libjscre.a in Frameworks */,
+ ABFA34C50F4255CC008FCF5D /* libmedia.a in Frameworks */,
E48B67CB0F262607002E47EC /* libmodp_b64.a in Frameworks */,
E48B66A80F26257E002E47EC /* libnet.a in Frameworks */,
E4DCDC920F40929C0084059A /* libpcre.a in Frameworks */,
@@ -3451,6 +3497,7 @@
4D1F5AB10F2A6EE90040C1E3 /* libpng.xcodeproj */,
4D7BFB0B0E9D4BBF009A6919 /* libxml.xcodeproj */,
826850600F2FCC27009F6555 /* libxslt.xcodeproj */,
+ ABFA33790F424EC5008FCF5D /* media.xcodeproj */,
4D7B00580E9D54AA009A6919 /* modp_b64.xcodeproj */,
4D7B00340E9D5464009A6919 /* net.xcodeproj */,
82684D050F2FB101009F6555 /* sdch.xcodeproj */,
@@ -3856,6 +3903,15 @@
name = debugger;
sourceTree = "<group>";
};
+ ABFA337A0F424EC5008FCF5D /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ ABFA33880F424EC5008FCF5D /* libmedia.a */,
+ ABFA338A0F424EC5008FCF5D /* media_unittests */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
B555B20F0F21503700F751B9 /* metrics */ = {
isa = PBXGroup;
children = (
@@ -4109,6 +4165,9 @@
E45075D80F150A3B003BE099 /* renderer_host */ = {
isa = PBXGroup;
children = (
+ ABFA33740F424E06008FCF5D /* audio_renderer_host.cc */,
+ ABFA33750F424E06008FCF5D /* audio_renderer_host.h */,
+ ABFA33760F424E06008FCF5D /* audio_renderer_host_unittest.cc */,
E45075DA0F150A53003BE099 /* async_resource_handler.cc */,
E45075DB0F150A53003BE099 /* async_resource_handler.h */,
A7C613C40F30D82C008CEE5D /* backing_store.cc */,
@@ -4363,6 +4422,7 @@
4D7BFE780E9D52EB009A6919 /* PBXTargetDependency */,
4D7BFF580E9D53D2009A6919 /* PBXTargetDependency */,
4D7BFF390E9D536D009A6919 /* PBXTargetDependency */,
+ ABFA34CA0F425694008FCF5D /* PBXTargetDependency */,
4D7B00600E9D54BF009A6919 /* PBXTargetDependency */,
4D7B00560E9D5487009A6919 /* PBXTargetDependency */,
B503E1020F017BE300547DC6 /* PBXTargetDependency */,
@@ -4436,6 +4496,7 @@
33121F090F3CF47F006CB2B0 /* PBXTargetDependency */,
33121F0B0F3CF47F006CB2B0 /* PBXTargetDependency */,
33121F0D0F3CF47F006CB2B0 /* PBXTargetDependency */,
+ ABFA338E0F424F39008FCF5D /* PBXTargetDependency */,
33121F0F0F3CF47F006CB2B0 /* PBXTargetDependency */,
33121F110F3CF47F006CB2B0 /* PBXTargetDependency */,
33121F130F3CF47F006CB2B0 /* PBXTargetDependency */,
@@ -4502,6 +4563,7 @@
E45062A00EE8912D003BE099 /* PBXTargetDependency */,
E45062A40EE8912D003BE099 /* PBXTargetDependency */,
E46C4EB10F278A3000B393B8 /* PBXTargetDependency */,
+ ABFA33DB0F4252CD008FCF5D /* PBXTargetDependency */,
E46C4EB50F278A4800B393B8 /* PBXTargetDependency */,
E46C4EB90F278A7100B393B8 /* PBXTargetDependency */,
E450631A0EE990C4003BE099 /* PBXTargetDependency */,
@@ -4584,6 +4646,10 @@
ProjectRef = 826850600F2FCC27009F6555 /* libxslt.xcodeproj */;
},
{
+ ProductGroup = ABFA337A0F424EC5008FCF5D /* Products */;
+ ProjectRef = ABFA33790F424EC5008FCF5D /* media.xcodeproj */;
+ },
+ {
ProductGroup = 4D7B00590E9D54AA009A6919 /* Products */;
ProjectRef = 4D7B00580E9D54AA009A6919 /* modp_b64.xcodeproj */;
},
@@ -4916,6 +4982,20 @@
remoteRef = 826850690F2FCC27009F6555 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
+ ABFA33880F424EC5008FCF5D /* libmedia.a */ = {
+ isa = PBXReferenceProxy;
+ fileType = archive.ar;
+ path = libmedia.a;
+ remoteRef = ABFA33870F424EC5008FCF5D /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ ABFA338A0F424EC5008FCF5D /* media_unittests */ = {
+ isa = PBXReferenceProxy;
+ fileType = "compiled.mach-o.executable";
+ path = media_unittests;
+ remoteRef = ABFA33890F424EC5008FCF5D /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
@@ -5128,6 +5208,7 @@
files = (
4D7BFA1E0E9D48FD009A6919 /* archived_database.cc in Sources */,
E45075DC0F150A53003BE099 /* async_resource_handler.cc in Sources */,
+ ABFA33770F424E47008FCF5D /* audio_renderer_host.cc in Sources */,
6D62D71064BA3204EF0A964A /* autofill_manager.cc in Sources */,
E43A770B0F1660EA00ABD5D1 /* automation_resource_tracker.cc in Sources */,
E434BFD90F3A074300B665C7 /* backing_store.cc in Sources */,
@@ -5946,6 +6027,21 @@
name = sdch;
targetProxy = 8268521A0F2FD197009F6555 /* PBXContainerItemProxy */;
};
+ ABFA338E0F424F39008FCF5D /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = media;
+ targetProxy = ABFA338D0F424F39008FCF5D /* PBXContainerItemProxy */;
+ };
+ ABFA33DB0F4252CD008FCF5D /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = media;
+ targetProxy = ABFA33DA0F4252CD008FCF5D /* PBXContainerItemProxy */;
+ };
+ ABFA34CA0F425694008FCF5D /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = media;
+ targetProxy = ABFA34C90F425694008FCF5D /* PBXContainerItemProxy */;
+ };
B503E1020F017BE300547DC6 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 4D640CEA0EAE86BD00EBCFC0 /* renderer */;
diff --git a/chrome/test/unit/unit_tests.scons b/chrome/test/unit/unit_tests.scons
index 814cea8..2f19de8 100644
--- a/chrome/test/unit/unit_tests.scons
+++ b/chrome/test/unit/unit_tests.scons
@@ -22,6 +22,7 @@ env.SConscript([
'$LIBXML_DIR/using_libxml.scons',
'$LIBXSLT_DIR/using_libxslt.scons',
'$MODP_B64_DIR/using_modp_b64.scons',
+ '$MEDIA_DIR/using_media.scons',
'$NET_DIR/using_net.scons',
'$NPAPI_DIR/using_npapi.scons',
'$SDCH_DIR/using_sdch.scons',
diff --git a/media/audio/audio_output.h b/media/audio/audio_output.h
index b21d653..7d82500 100644
--- a/media/audio/audio_output.h
+++ b/media/audio/audio_output.h
@@ -5,6 +5,8 @@
#ifndef MEDIA_AUDIO_AUDIO_OUTPUT_H_
#define MEDIA_AUDIO_AUDIO_OUTPUT_H_
+#include "base/basictypes.h"
+
// Low-level audio output support. To make sound there are 3 objects involved:
// - AudioSource : produces audio samples on a pull model. Implements
// the AudioSourceCallback interface.
diff --git a/media/audio/linux/audio_manager_linux.cc b/media/audio/linux/audio_manager_linux.cc
new file mode 100644
index 0000000..15a13b2
--- /dev/null
+++ b/media/audio/linux/audio_manager_linux.cc
@@ -0,0 +1,10 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/audio/audio_output.h"
+
+// TODO(hclam): Do something more useful than returning NULL.
+AudioManager* AudioManager::GetAudioManager() {
+ return NULL;
+}
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
new file mode 100644
index 0000000..15a13b2
--- /dev/null
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -0,0 +1,10 @@
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/audio/audio_output.h"
+
+// TODO(hclam): Do something more useful than returning NULL.
+AudioManager* AudioManager::GetAudioManager() {
+ return NULL;
+}
diff --git a/media/media.xcodeproj/project.pbxproj b/media/media.xcodeproj/project.pbxproj
index 488391e..91e425c 100644
--- a/media/media.xcodeproj/project.pbxproj
+++ b/media/media.xcodeproj/project.pbxproj
@@ -46,6 +46,7 @@
8200F2030E5F741E005A3C44 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8200F2020E5F741E005A3C44 /* CoreServices.framework */; };
820706940EB8D9D4005CD9E7 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 820706930EB8D9D4005CD9E7 /* SystemConfiguration.framework */; };
82113A280E84360200E3848F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82113A270E84360200E3848F /* Security.framework */; };
+ ABFA33A30F424FBD008FCF5D /* audio_manager_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = ABFA33A20F424FBD008FCF5D /* audio_manager_mac.cc */; };
DC5E24F40EFC4CE5006AD1A7 /* data_buffer.cc in Sources */ = {isa = PBXBuildFile; fileRef = DC5E24E10EFC4CC8006AD1A7 /* data_buffer.cc */; };
DC5E24F50EFC4CE5006AD1A7 /* media_format.cc in Sources */ = {isa = PBXBuildFile; fileRef = DC5E24E60EFC4CC8006AD1A7 /* media_format.cc */; };
DC5E24F60EFC4CF7006AD1A7 /* data_buffer_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = DC5E24E30EFC4CC8006AD1A7 /* data_buffer_unittest.cc */; };
@@ -225,6 +226,7 @@
8200F2020E5F741E005A3C44 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = "<group>"; };
820706930EB8D9D4005CD9E7 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = "<absolute>"; };
82113A270E84360200E3848F /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = "<group>"; };
+ ABFA33A20F424FBD008FCF5D /* audio_manager_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = audio_manager_mac.cc; path = mac/audio_manager_mac.cc; sourceTree = "<group>"; };
DC5E24DE0EFC4CC8006AD1A7 /* audio_output.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio_output.h; sourceTree = "<group>"; };
DC5E24E00EFC4CC8006AD1A7 /* buffers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffers.h; sourceTree = "<group>"; };
DC5E24E10EFC4CC8006AD1A7 /* data_buffer.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = data_buffer.cc; sourceTree = "<group>"; };
@@ -373,9 +375,18 @@
name = Products;
sourceTree = "<group>";
};
+ ABFA33980F424FAF008FCF5D /* mac */ = {
+ isa = PBXGroup;
+ children = (
+ ABFA33A20F424FBD008FCF5D /* audio_manager_mac.cc */,
+ );
+ name = mac;
+ sourceTree = "<group>";
+ };
DC5E24DD0EFC4CC8006AD1A7 /* audio */ = {
isa = PBXGroup;
children = (
+ ABFA33980F424FAF008FCF5D /* mac */,
DC5E24DE0EFC4CC8006AD1A7 /* audio_output.h */,
);
path = audio;
@@ -620,6 +631,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
+ ABFA33A30F424FBD008FCF5D /* audio_manager_mac.cc in Sources */,
DC5E24F40EFC4CE5006AD1A7 /* data_buffer.cc in Sources */,
DC66E6E30F13FE6A00E13554 /* filter_host_impl.cc in Sources */,
DC5E24F50EFC4CE5006AD1A7 /* media_format.cc in Sources */,
diff --git a/media/media_lib.scons b/media/media_lib.scons
index 0e017b1..51676b1 100644
--- a/media/media_lib.scons
+++ b/media/media_lib.scons
@@ -56,6 +56,16 @@ input_files = ChromeFileList([
]),
])
+if env.Bit('linux'):
+ input_files.Extend([
+ 'audio/linux/audio_manager_linux.cc',
+ ])
+
+if env.Bit('mac'):
+ input_files.Extend([
+ 'audio/mac/audio_manager_mac.cc',
+ ])
+
if not env.Bit('windows'):
# Windows-specific files.
input_files.Remove(