summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-28 21:22:30 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-28 21:22:30 +0000
commitc0cf2f1c473b39e48fa88782416081fe8a3a8f16 (patch)
treef7c4514ce65956e34d08ffb01a68834819fd5429 /content
parent90b53bef6fd248d428c0c19194dbcebb3c70df5c (diff)
downloadchromium_src-c0cf2f1c473b39e48fa88782416081fe8a3a8f16.zip
chromium_src-c0cf2f1c473b39e48fa88782416081fe8a3a8f16.tar.gz
chromium_src-c0cf2f1c473b39e48fa88782416081fe8a3a8f16.tar.bz2
Get rid of PluginDelegate::PlatformAudioOutputClient and PluginDelegate::PlatformAudioOutput abstractions now that pepper plugin code is in content.
BUG=263054 R=scottmg@chromium.org Review URL: https://codereview.chromium.org/20484003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/content_renderer.gypi4
-rw-r--r--content/renderer/pepper/audio_helper.cc2
-rw-r--r--content/renderer/pepper/audio_helper.h11
-rw-r--r--content/renderer/pepper/mock_plugin_delegate.cc7
-rw-r--r--content/renderer/pepper/mock_plugin_delegate.h4
-rw-r--r--content/renderer/pepper/pepper_broker_impl.h1
-rw-r--r--content/renderer/pepper/pepper_platform_audio_output.cc (renamed from content/renderer/pepper/pepper_platform_audio_output_impl.cc)57
-rw-r--r--content/renderer/pepper/pepper_platform_audio_output.h (renamed from content/renderer/pepper/pepper_platform_audio_output_impl.h)54
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.cc11
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.h4
-rw-r--r--content/renderer/pepper/pepper_plugin_instance_impl.h1
-rw-r--r--content/renderer/pepper/plugin_delegate.h36
-rw-r--r--content/renderer/pepper/ppb_audio_impl.cc23
-rw-r--r--content/renderer/pepper/ppb_audio_impl.h4
14 files changed, 86 insertions, 133 deletions
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 068e147..b321852 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -313,8 +313,8 @@
'renderer/pepper/pepper_media_device_manager.h',
'renderer/pepper/pepper_platform_audio_input.cc',
'renderer/pepper/pepper_platform_audio_input.h',
- 'renderer/pepper/pepper_platform_audio_output_impl.cc',
- 'renderer/pepper/pepper_platform_audio_output_impl.h',
+ 'renderer/pepper/pepper_platform_audio_output.cc',
+ 'renderer/pepper/pepper_platform_audio_output.h',
'renderer/pepper/pepper_platform_context_3d.cc',
'renderer/pepper/pepper_platform_context_3d.h',
'renderer/pepper/pepper_platform_video_capture.cc',
diff --git a/content/renderer/pepper/audio_helper.cc b/content/renderer/pepper/audio_helper.cc
index 8197d7a..32b1057 100644
--- a/content/renderer/pepper/audio_helper.cc
+++ b/content/renderer/pepper/audio_helper.cc
@@ -4,9 +4,11 @@
#include "content/renderer/pepper/audio_helper.h"
+#include "base/logging.h"
#include "content/renderer/pepper/common.h"
#include "content/renderer/pepper/resource_helper.h"
#include "ppapi/c/pp_completion_callback.h"
+#include "ppapi/c/pp_errors.h"
using ppapi::TrackedCallback;
diff --git a/content/renderer/pepper/audio_helper.h b/content/renderer/pepper/audio_helper.h
index 7ffeb24..8b04c84 100644
--- a/content/renderer/pepper/audio_helper.h
+++ b/content/renderer/pepper/audio_helper.h
@@ -9,7 +9,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/sync_socket.h"
-#include "content/renderer/pepper/plugin_delegate.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/scoped_pp_resource.h"
@@ -17,15 +16,15 @@
namespace content {
-class AudioHelper : public PluginDelegate::PlatformAudioOutputClient {
+class AudioHelper {
public:
AudioHelper();
virtual ~AudioHelper();
- // |PluginDelegate::PlatformAudioOutputClient| implementation.
- virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle,
- size_t shared_memory_size_,
- base::SyncSocket::Handle socket) OVERRIDE;
+ // Called when the stream is created.
+ void StreamCreated(base::SharedMemoryHandle shared_memory_handle,
+ size_t shared_memory_size_,
+ base::SyncSocket::Handle socket);
void SetCreateCallback(
scoped_refptr< ::ppapi::TrackedCallback> create_callback);
diff --git a/content/renderer/pepper/mock_plugin_delegate.cc b/content/renderer/pepper/mock_plugin_delegate.cc
index e56c375..6dadb53 100644
--- a/content/renderer/pepper/mock_plugin_delegate.cc
+++ b/content/renderer/pepper/mock_plugin_delegate.cc
@@ -92,13 +92,6 @@ uint32_t MockPluginDelegate::GetAudioHardwareOutputBufferSize() {
return 0;
}
-MockPluginDelegate::PlatformAudioOutput* MockPluginDelegate::CreateAudioOutput(
- uint32_t sample_rate,
- uint32_t sample_count,
- PlatformAudioOutputClient* client) {
- return NULL;
-}
-
MockPluginDelegate::Broker* MockPluginDelegate::ConnectToBroker(
PPB_Broker_Impl* client) {
return NULL;
diff --git a/content/renderer/pepper/mock_plugin_delegate.h b/content/renderer/pepper/mock_plugin_delegate.h
index e8d531d..d2f2239 100644
--- a/content/renderer/pepper/mock_plugin_delegate.h
+++ b/content/renderer/pepper/mock_plugin_delegate.h
@@ -47,10 +47,6 @@ class MockPluginDelegate : public PluginDelegate {
int32 command_buffer_route_id) OVERRIDE;
virtual uint32_t GetAudioHardwareOutputSampleRate() OVERRIDE;
virtual uint32_t GetAudioHardwareOutputBufferSize() OVERRIDE;
- virtual PlatformAudioOutput* CreateAudioOutput(
- uint32_t sample_rate,
- uint32_t sample_count,
- PlatformAudioOutputClient* client) OVERRIDE;
virtual Broker* ConnectToBroker(PPB_Broker_Impl* client) OVERRIDE;
virtual void NumberOfFindResultsChanged(int identifier,
int total,
diff --git a/content/renderer/pepper/pepper_broker_impl.h b/content/renderer/pepper/pepper_broker_impl.h
index a9c1411..8d83620 100644
--- a/content/renderer/pepper/pepper_broker_impl.h
+++ b/content/renderer/pepper/pepper_broker_impl.h
@@ -7,6 +7,7 @@
#include "base/memory/ref_counted.h"
#include "base/process/process.h"
+#include "base/sync_socket.h"
#include "content/common/content_export.h"
#include "content/renderer/pepper/plugin_delegate.h"
#include "content/renderer/pepper/ppb_broker_impl.h"
diff --git a/content/renderer/pepper/pepper_platform_audio_output_impl.cc b/content/renderer/pepper/pepper_platform_audio_output.cc
index 320d211..e6930d7 100644
--- a/content/renderer/pepper/pepper_platform_audio_output_impl.cc
+++ b/content/renderer/pepper/pepper_platform_audio_output.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/renderer/pepper/pepper_platform_audio_output_impl.h"
+#include "content/renderer/pepper/pepper_platform_audio_output.h"
#include "base/bind.h"
#include "base/logging.h"
@@ -11,65 +11,64 @@
#include "content/child/child_process.h"
#include "content/common/media/audio_messages.h"
#include "content/renderer/media/audio_message_filter.h"
+#include "content/renderer/pepper/audio_helper.h"
#include "content/renderer/render_thread_impl.h"
#include "media/base/audio_hardware_config.h"
namespace content {
// static
-PepperPlatformAudioOutputImpl* PepperPlatformAudioOutputImpl::Create(
+PepperPlatformAudioOutput* PepperPlatformAudioOutput::Create(
int sample_rate,
int frames_per_buffer,
int source_render_view_id,
- PluginDelegate::PlatformAudioOutputClient* client) {
- scoped_refptr<PepperPlatformAudioOutputImpl> audio_output(
- new PepperPlatformAudioOutputImpl());
+ AudioHelper* client) {
+ scoped_refptr<PepperPlatformAudioOutput> audio_output(
+ new PepperPlatformAudioOutput());
if (audio_output->Initialize(sample_rate, frames_per_buffer,
source_render_view_id, client)) {
// Balanced by Release invoked in
- // PepperPlatformAudioOutputImpl::ShutDownOnIOThread().
+ // PepperPlatformAudioOutput::ShutDownOnIOThread().
audio_output->AddRef();
return audio_output.get();
}
return NULL;
}
-bool PepperPlatformAudioOutputImpl::StartPlayback() {
+bool PepperPlatformAudioOutput::StartPlayback() {
if (ipc_) {
io_message_loop_proxy_->PostTask(
FROM_HERE,
- base::Bind(&PepperPlatformAudioOutputImpl::StartPlaybackOnIOThread,
- this));
+ base::Bind(&PepperPlatformAudioOutput::StartPlaybackOnIOThread, this));
return true;
}
return false;
}
-bool PepperPlatformAudioOutputImpl::StopPlayback() {
+bool PepperPlatformAudioOutput::StopPlayback() {
if (ipc_) {
io_message_loop_proxy_->PostTask(
FROM_HERE,
- base::Bind(&PepperPlatformAudioOutputImpl::StopPlaybackOnIOThread,
- this));
+ base::Bind(&PepperPlatformAudioOutput::StopPlaybackOnIOThread, this));
return true;
}
return false;
}
-void PepperPlatformAudioOutputImpl::ShutDown() {
+void PepperPlatformAudioOutput::ShutDown() {
// Called on the main thread to stop all audio callbacks. We must only change
// the client on the main thread, and the delegates from the I/O thread.
client_ = NULL;
io_message_loop_proxy_->PostTask(
FROM_HERE,
- base::Bind(&PepperPlatformAudioOutputImpl::ShutDownOnIOThread, this));
+ base::Bind(&PepperPlatformAudioOutput::ShutDownOnIOThread, this));
}
-void PepperPlatformAudioOutputImpl::OnStateChanged(
+void PepperPlatformAudioOutput::OnStateChanged(
media::AudioOutputIPCDelegate::State state) {
}
-void PepperPlatformAudioOutputImpl::OnStreamCreated(
+void PepperPlatformAudioOutput::OnStreamCreated(
base::SharedMemoryHandle handle,
base::SyncSocket::Handle socket_handle,
int length) {
@@ -90,33 +89,33 @@ void PepperPlatformAudioOutputImpl::OnStreamCreated(
client_->StreamCreated(handle, length, socket_handle);
} else {
main_message_loop_proxy_->PostTask(FROM_HERE,
- base::Bind(&PepperPlatformAudioOutputImpl::OnStreamCreated, this,
- handle, socket_handle, length));
+ base::Bind(&PepperPlatformAudioOutput::OnStreamCreated, this, handle,
+ socket_handle, length));
}
}
-void PepperPlatformAudioOutputImpl::OnIPCClosed() {
+void PepperPlatformAudioOutput::OnIPCClosed() {
ipc_.reset();
}
-PepperPlatformAudioOutputImpl::~PepperPlatformAudioOutputImpl() {
+PepperPlatformAudioOutput::~PepperPlatformAudioOutput() {
// Make sure we have been shut down. Warning: this will usually happen on
// the I/O thread!
DCHECK(!ipc_);
DCHECK(!client_);
}
-PepperPlatformAudioOutputImpl::PepperPlatformAudioOutputImpl()
+PepperPlatformAudioOutput::PepperPlatformAudioOutput()
: client_(NULL),
main_message_loop_proxy_(base::MessageLoopProxy::current()),
io_message_loop_proxy_(ChildProcess::current()->io_message_loop_proxy()) {
}
-bool PepperPlatformAudioOutputImpl::Initialize(
+bool PepperPlatformAudioOutput::Initialize(
int sample_rate,
int frames_per_buffer,
int source_render_view_id,
- PluginDelegate::PlatformAudioOutputClient* client) {
+ AudioHelper* client) {
DCHECK(client);
client_ = client;
@@ -131,12 +130,12 @@ bool PepperPlatformAudioOutputImpl::Initialize(
io_message_loop_proxy_->PostTask(
FROM_HERE,
- base::Bind(&PepperPlatformAudioOutputImpl::InitializeOnIOThread,
- this, params));
+ base::Bind(&PepperPlatformAudioOutput::InitializeOnIOThread, this,
+ params));
return true;
}
-void PepperPlatformAudioOutputImpl::InitializeOnIOThread(
+void PepperPlatformAudioOutput::InitializeOnIOThread(
const media::AudioParameters& params) {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
const int kSessionId = 0;
@@ -144,19 +143,19 @@ void PepperPlatformAudioOutputImpl::InitializeOnIOThread(
ipc_->CreateStream(this, params, kSessionId);
}
-void PepperPlatformAudioOutputImpl::StartPlaybackOnIOThread() {
+void PepperPlatformAudioOutput::StartPlaybackOnIOThread() {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
if (ipc_)
ipc_->PlayStream();
}
-void PepperPlatformAudioOutputImpl::StopPlaybackOnIOThread() {
+void PepperPlatformAudioOutput::StopPlaybackOnIOThread() {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
if (ipc_)
ipc_->PauseStream();
}
-void PepperPlatformAudioOutputImpl::ShutDownOnIOThread() {
+void PepperPlatformAudioOutput::ShutDownOnIOThread() {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
// Make sure we don't call shutdown more than once.
diff --git a/content/renderer/pepper/pepper_platform_audio_output_impl.h b/content/renderer/pepper/pepper_platform_audio_output.h
index af94e02..775309b 100644
--- a/content/renderer/pepper/pepper_platform_audio_output_impl.h
+++ b/content/renderer/pepper/pepper_platform_audio_output.h
@@ -8,7 +8,6 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "content/renderer/pepper/plugin_delegate.h"
#include "media/audio/audio_output_ipc.h"
namespace media {
@@ -20,24 +19,32 @@ class MessageLoopProxy;
}
namespace content {
+class AudioHelper;
-class PepperPlatformAudioOutputImpl
- : public PluginDelegate::PlatformAudioOutput,
- public media::AudioOutputIPCDelegate,
- public base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl> {
+class PepperPlatformAudioOutput
+ : public media::AudioOutputIPCDelegate,
+ public base::RefCountedThreadSafe<PepperPlatformAudioOutput> {
public:
// Factory function, returns NULL on failure. StreamCreated() will be called
// when the stream is created.
- static PepperPlatformAudioOutputImpl* Create(
- int sample_rate,
- int frames_per_buffer,
- int source_render_view_id,
- PluginDelegate::PlatformAudioOutputClient* client);
+ static PepperPlatformAudioOutput* Create(int sample_rate,
+ int frames_per_buffer,
+ int source_render_view_id,
+ AudioHelper* client);
- // PlatformAudioOutput implementation (called on main thread).
- virtual bool StartPlayback() OVERRIDE;
- virtual bool StopPlayback() OVERRIDE;
- virtual void ShutDown() OVERRIDE;
+ // The following three methods are all called on main thread.
+
+ // Starts the playback. Returns false on error or if called before the
+ // stream is created or after the stream is closed.
+ bool StartPlayback();
+
+ // Stops the playback. Returns false on error or if called before the stream
+ // is created or after the stream is closed.
+ bool StopPlayback();
+
+ // Closes the stream. Make sure to call this before the object is
+ // destructed.
+ void ShutDown();
// media::AudioOutputIPCDelegate implementation.
virtual void OnStateChanged(
@@ -48,18 +55,17 @@ class PepperPlatformAudioOutputImpl
virtual void OnIPCClosed() OVERRIDE;
protected:
- virtual ~PepperPlatformAudioOutputImpl();
+ virtual ~PepperPlatformAudioOutput();
private:
- friend class base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl>;
+ friend class base::RefCountedThreadSafe<PepperPlatformAudioOutput>;
- PepperPlatformAudioOutputImpl();
+ PepperPlatformAudioOutput();
- bool Initialize(
- int sample_rate,
- int frames_per_buffer,
- int source_render_view_id,
- PluginDelegate::PlatformAudioOutputClient* client);
+ bool Initialize(int sample_rate,
+ int frames_per_buffer,
+ int source_render_view_id,
+ AudioHelper* client);
// I/O thread backends to above functions.
void InitializeOnIOThread(const media::AudioParameters& params);
@@ -69,7 +75,7 @@ class PepperPlatformAudioOutputImpl
// The client to notify when the stream is created. THIS MUST ONLY BE
// ACCESSED ON THE MAIN THREAD.
- PluginDelegate::PlatformAudioOutputClient* client_;
+ AudioHelper* client_;
// Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE
// I/O thread except to send messages and get the message loop.
@@ -78,7 +84,7 @@ class PepperPlatformAudioOutputImpl
scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_;
scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
- DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioOutputImpl);
+ DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioOutput);
};
} // namespace content
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index d6fbb33..e58ec84 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -48,7 +48,6 @@
#include "content/renderer/pepper/pepper_hung_plugin_filter.h"
#include "content/renderer/pepper/pepper_in_process_resource_creation.h"
#include "content/renderer/pepper/pepper_in_process_router.h"
-#include "content/renderer/pepper/pepper_platform_audio_output_impl.h"
#include "content/renderer/pepper/pepper_plugin_instance_impl.h"
#include "content/renderer/pepper/pepper_plugin_registry.h"
#include "content/renderer/pepper/pepper_url_loader_host.h"
@@ -655,16 +654,6 @@ uint32_t PepperPluginDelegateImpl::GetAudioHardwareOutputBufferSize() {
return thread->GetAudioHardwareConfig()->GetOutputBufferSize();
}
-PluginDelegate::PlatformAudioOutput*
- PepperPluginDelegateImpl::CreateAudioOutput(
- uint32_t sample_rate,
- uint32_t sample_count,
- PluginDelegate::PlatformAudioOutputClient* client) {
- return PepperPlatformAudioOutputImpl::Create(
- static_cast<int>(sample_rate), static_cast<int>(sample_count),
- GetRoutingID(), client);
-}
-
// If a broker has not already been created for this plugin, creates one.
PluginDelegate::Broker* PepperPluginDelegateImpl::ConnectToBroker(
PPB_Broker_Impl* client) {
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h
index 0c1a8e0..36dbb58 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h
@@ -141,10 +141,6 @@ class PepperPluginDelegateImpl
const base::FilePath& file_path) OVERRIDE;
virtual uint32_t GetAudioHardwareOutputSampleRate() OVERRIDE;
virtual uint32_t GetAudioHardwareOutputBufferSize() OVERRIDE;
- virtual PlatformAudioOutput* CreateAudioOutput(
- uint32_t sample_rate,
- uint32_t sample_count,
- PlatformAudioOutputClient* client) OVERRIDE;
virtual PlatformVideoDecoder* CreateVideoDecoder(
media::VideoDecodeAccelerator::Client* client,
int32 command_buffer_route_id) OVERRIDE;
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h
index f951cf4..d7a061b 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.h
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_
#define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_
+#include <list>
#include <set>
#include <string>
#include <vector>
diff --git a/content/renderer/pepper/plugin_delegate.h b/content/renderer/pepper/plugin_delegate.h
index 0c65e2d..44f571a 100644
--- a/content/renderer/pepper/plugin_delegate.h
+++ b/content/renderer/pepper/plugin_delegate.h
@@ -14,7 +14,6 @@
#include "base/message_loop/message_loop_proxy.h"
#include "base/platform_file.h"
#include "base/process/process.h"
-#include "base/sync_socket.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
#include "ipc/ipc_platform_file.h"
@@ -108,34 +107,6 @@ class PPB_TCPSocket_Private_Impl;
// PPAPI plugins.
class PluginDelegate {
public:
- class PlatformAudioOutputClient {
- public:
- virtual ~PlatformAudioOutputClient() {}
-
- // Called when the stream is created.
- virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle,
- size_t shared_memory_size,
- base::SyncSocket::Handle socket) = 0;
- };
-
- class PlatformAudioOutput {
- public:
- // Starts the playback. Returns false on error or if called before the
- // stream is created or after the stream is closed.
- virtual bool StartPlayback() = 0;
-
- // Stops the playback. Returns false on error or if called before the stream
- // is created or after the stream is closed.
- virtual bool StopPlayback() = 0;
-
- // Closes the stream. Make sure to call this before the object is
- // destructed.
- virtual void ShutDown() = 0;
-
- protected:
- virtual ~PlatformAudioOutput() {}
- };
-
// Interface for PlatformVideoDecoder is directly inherited from general media
// VideoDecodeAccelerator interface.
class PlatformVideoDecoder : public media::VideoDecodeAccelerator {
@@ -215,13 +186,6 @@ class PluginDelegate {
// Get audio hardware output buffer size.
virtual uint32_t GetAudioHardwareOutputBufferSize() = 0;
- // The caller is responsible for calling Shutdown() on the returned pointer
- // to clean up the corresponding resources allocated during this call.
- virtual PlatformAudioOutput* CreateAudioOutput(
- uint32_t sample_rate,
- uint32_t sample_count,
- PlatformAudioOutputClient* client) = 0;
-
// A pointer is returned immediately, but it is not ready to be used until
// BrokerConnected has been called.
// The caller is responsible for calling Disconnect() on the returned pointer
diff --git a/content/renderer/pepper/ppb_audio_impl.cc b/content/renderer/pepper/ppb_audio_impl.cc
index d971888..ba9a836 100644
--- a/content/renderer/pepper/ppb_audio_impl.cc
+++ b/content/renderer/pepper/ppb_audio_impl.cc
@@ -6,7 +6,10 @@
#include "base/logging.h"
#include "content/renderer/pepper/common.h"
+#include "content/renderer/pepper/pepper_platform_audio_output.h"
+#include "content/renderer/pepper/pepper_plugin_instance_impl.h"
#include "content/renderer/pepper/resource_helper.h"
+#include "content/renderer/render_view_impl.h"
#include "media/audio/audio_output_controller.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/ppb_audio.h"
@@ -71,14 +74,16 @@ bool PPB_Audio_Impl::Init(PP_Resource config,
return false;
SetCallback(callback, user_data);
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
- if (!plugin_delegate)
+ PepperPluginInstanceImpl* instance = ResourceHelper::GetPluginInstance(this);
+ if (!instance)
return false;
// When the stream is created, we'll get called back on StreamCreated().
CHECK(!audio_);
- audio_ = plugin_delegate->CreateAudioOutput(
- enter.object()->GetSampleRate(), enter.object()->GetSampleFrameCount(),
+ audio_ = PepperPlatformAudioOutput::Create(
+ static_cast<int>(enter.object()->GetSampleRate()),
+ static_cast<int>(enter.object()->GetSampleFrameCount()),
+ instance->GetRenderView()->GetRoutingID(),
this);
sample_frame_count_ = enter.object()->GetSampleFrameCount();
return audio_ != NULL;
@@ -119,14 +124,16 @@ int32_t PPB_Audio_Impl::Open(
return PP_ERROR_FAILED;
config_ = config;
- PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
- if (!plugin_delegate)
+ PepperPluginInstanceImpl* instance = ResourceHelper::GetPluginInstance(this);
+ if (!instance)
return PP_ERROR_FAILED;
// When the stream is created, we'll get called back on StreamCreated().
DCHECK(!audio_);
- audio_ = plugin_delegate->CreateAudioOutput(
- enter.object()->GetSampleRate(), enter.object()->GetSampleFrameCount(),
+ audio_ = PepperPlatformAudioOutput::Create(
+ static_cast<int>(enter.object()->GetSampleRate()),
+ static_cast<int>(enter.object()->GetSampleFrameCount()),
+ instance->GetRenderView()->GetRoutingID(),
this);
if (!audio_)
return PP_ERROR_FAILED;
diff --git a/content/renderer/pepper/ppb_audio_impl.h b/content/renderer/pepper/ppb_audio_impl.h
index 4c30974..62a4dd2 100644
--- a/content/renderer/pepper/ppb_audio_impl.h
+++ b/content/renderer/pepper/ppb_audio_impl.h
@@ -10,7 +10,6 @@
#include "base/memory/shared_memory.h"
#include "base/sync_socket.h"
#include "content/renderer/pepper/audio_helper.h"
-#include "content/renderer/pepper/plugin_delegate.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/ppb_audio.h"
#include "ppapi/c/ppb_audio_config.h"
@@ -20,6 +19,7 @@
#include "ppapi/shared_impl/scoped_pp_resource.h"
namespace content {
+class PepperPlatformAudioOutput;
// Some of the backend functionality of this class is implemented by the
// PPB_Audio_Shared so it can be shared with the proxy.
@@ -71,7 +71,7 @@ class PPB_Audio_Impl : public ::ppapi::Resource,
// PluginDelegate audio object that we delegate audio IPC through. We don't
// own this pointer but are responsible for calling Shutdown on it.
- PluginDelegate::PlatformAudioOutput* audio_;
+ PepperPlatformAudioOutput* audio_;
// Track frame count for passing on to PPB_Audio_Shared::SetStreamInfo().
int sample_frame_count_;