summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/renderer/pepper_platform_video_decoder_impl.cc126
-rw-r--r--content/renderer/pepper_platform_video_decoder_impl.h63
-rw-r--r--content/renderer/render_audiosourceprovider.cc148
-rw-r--r--content/renderer/render_audiosourceprovider.h88
-rw-r--r--content/renderer/renderer_gpu_video_decoder_factories.cc121
-rw-r--r--content/renderer/renderer_gpu_video_decoder_factories.h76
-rw-r--r--content/renderer/renderer_webaudiodevice_impl.cc57
-rw-r--r--content/renderer/renderer_webaudiodevice_impl.h45
8 files changed, 0 insertions, 724 deletions
diff --git a/content/renderer/pepper_platform_video_decoder_impl.cc b/content/renderer/pepper_platform_video_decoder_impl.cc
deleted file mode 100644
index d815399..0000000
--- a/content/renderer/pepper_platform_video_decoder_impl.cc
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) 2012 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 "content/renderer/pepper_platform_video_decoder_impl.h"
-
-#include <vector>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "content/common/child_process.h"
-#include "content/renderer/gpu/gpu_channel_host.h"
-#include "content/renderer/render_thread_impl.h"
-
-using media::BitstreamBuffer;
-
-PlatformVideoDecoderImpl::PlatformVideoDecoderImpl(
- VideoDecodeAccelerator::Client* client,
- int32 command_buffer_route_id)
- : client_(client),
- command_buffer_route_id_(command_buffer_route_id) {
- DCHECK(client);
-}
-
-PlatformVideoDecoderImpl::~PlatformVideoDecoderImpl() {}
-
-bool PlatformVideoDecoderImpl::Initialize(Profile profile) {
- // TODO(vrk): Support multiple decoders.
- if (decoder_)
- return true;
-
- RenderThreadImpl* render_thread = RenderThreadImpl::current();
-
- // This is not synchronous, but subsequent IPC messages will be buffered, so
- // it is okay to immediately send IPC messages through the returned channel.
- GpuChannelHost* channel =
- render_thread->EstablishGpuChannelSync(
- content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE);
-
- if (!channel)
- return false;
-
- DCHECK_EQ(channel->state(), GpuChannelHost::kConnected);
-
- // Send IPC message to initialize decoder in GPU process.
- decoder_ = channel->CreateVideoDecoder(
- command_buffer_route_id_, profile, this);
- return decoder_.get() != NULL;
-}
-
-void PlatformVideoDecoderImpl::Decode(const BitstreamBuffer& bitstream_buffer) {
- DCHECK(decoder_);
- decoder_->Decode(bitstream_buffer);
-}
-
-void PlatformVideoDecoderImpl::AssignPictureBuffers(
- const std::vector<media::PictureBuffer>& buffers) {
- DCHECK(decoder_);
- decoder_->AssignPictureBuffers(buffers);
-}
-
-void PlatformVideoDecoderImpl::ReusePictureBuffer(
- int32 picture_buffer_id) {
- DCHECK(decoder_);
- decoder_->ReusePictureBuffer(picture_buffer_id);
-}
-
-void PlatformVideoDecoderImpl::Flush() {
- DCHECK(decoder_);
- decoder_->Flush();
-}
-
-void PlatformVideoDecoderImpl::Reset() {
- DCHECK(decoder_);
- decoder_->Reset();
-}
-
-void PlatformVideoDecoderImpl::Destroy() {
- DCHECK(decoder_);
- decoder_->Destroy();
- client_ = NULL;
- decoder_ = NULL;
-}
-
-void PlatformVideoDecoderImpl::NotifyError(
- VideoDecodeAccelerator::Error error) {
- DCHECK(RenderThreadImpl::current());
- client_->NotifyError(error);
-}
-
-void PlatformVideoDecoderImpl::ProvidePictureBuffers(
- uint32 requested_num_of_buffers,
- const gfx::Size& dimensions) {
- DCHECK(RenderThreadImpl::current());
- client_->ProvidePictureBuffers(requested_num_of_buffers, dimensions);
-}
-
-void PlatformVideoDecoderImpl::DismissPictureBuffer(int32 picture_buffer_id) {
- DCHECK(RenderThreadImpl::current());
- client_->DismissPictureBuffer(picture_buffer_id);
-}
-
-void PlatformVideoDecoderImpl::PictureReady(const media::Picture& picture) {
- DCHECK(RenderThreadImpl::current());
- client_->PictureReady(picture);
-}
-
-void PlatformVideoDecoderImpl::NotifyInitializeDone() {
- NOTREACHED() << "GpuVideoDecodeAcceleratorHost::Initialize is synchronous!";
-}
-
-void PlatformVideoDecoderImpl::NotifyEndOfBitstreamBuffer(
- int32 bitstream_buffer_id) {
- DCHECK(RenderThreadImpl::current());
- client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id);
-}
-
-void PlatformVideoDecoderImpl::NotifyFlushDone() {
- DCHECK(RenderThreadImpl::current());
- client_->NotifyFlushDone();
-}
-
-void PlatformVideoDecoderImpl::NotifyResetDone() {
- DCHECK(RenderThreadImpl::current());
- client_->NotifyResetDone();
-}
diff --git a/content/renderer/pepper_platform_video_decoder_impl.h b/content/renderer/pepper_platform_video_decoder_impl.h
deleted file mode 100644
index 9bd1c07..0000000
--- a/content/renderer/pepper_platform_video_decoder_impl.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (c) 2012 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.
-
-#ifndef CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_
-#define CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_
-
-#include <vector>
-
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
-#include "media/video/video_decode_accelerator.h"
-#include "webkit/plugins/ppapi/plugin_delegate.h"
-
-class PlatformVideoDecoderImpl
- : public webkit::ppapi::PluginDelegate::PlatformVideoDecoder,
- public media::VideoDecodeAccelerator::Client {
- public:
- PlatformVideoDecoderImpl(
- media::VideoDecodeAccelerator::Client* client,
- int32 command_buffer_route_id);
-
- // PlatformVideoDecoder (a.k.a. VideoDecodeAccelerator) implementation.
- virtual bool Initialize(Profile profile) OVERRIDE;
- virtual void Decode(
- const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
- virtual void AssignPictureBuffers(
- const std::vector<media::PictureBuffer>& buffers) OVERRIDE;
- virtual void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
- virtual void Flush() OVERRIDE;
- virtual void Reset() OVERRIDE;
- virtual void Destroy() OVERRIDE;
-
- // VideoDecodeAccelerator::Client implementation.
- virtual void ProvidePictureBuffers(
- uint32 requested_num_of_buffers, const gfx::Size& dimensions) OVERRIDE;
- virtual void PictureReady(const media::Picture& picture) OVERRIDE;
- virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
- virtual void NotifyInitializeDone() OVERRIDE;
- virtual void NotifyError(
- media::VideoDecodeAccelerator::Error error) OVERRIDE;
- virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE;
- virtual void NotifyFlushDone() OVERRIDE;
- virtual void NotifyResetDone() OVERRIDE;
-
- private:
- virtual ~PlatformVideoDecoderImpl();
-
- // Client lifetime must exceed lifetime of this class.
- // TODO(vrk/fischman): We should take another look at the overall
- // arcitecture of PPAPI Video Decode to make sure lifetime/ownership makes
- // sense, including lifetime of this client.
- media::VideoDecodeAccelerator::Client* client_;
-
- // Route ID for the command buffer associated with video decoder's context.
- int32 command_buffer_route_id_;
-
- // Holds a GpuVideoDecodeAcceleratorHost.
- scoped_refptr<media::VideoDecodeAccelerator> decoder_;
-
- DISALLOW_COPY_AND_ASSIGN(PlatformVideoDecoderImpl);
-};
-#endif // CONTENT_RENDERER_PEPPER_PLATFORM_VIDEO_DECODER_IMPL_H_
diff --git a/content/renderer/render_audiosourceprovider.cc b/content/renderer/render_audiosourceprovider.cc
deleted file mode 100644
index 6f070d5..0000000
--- a/content/renderer/render_audiosourceprovider.cc
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright (c) 2011 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 "content/renderer/render_audiosourceprovider.h"
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProviderClient.h"
-
-using std::vector;
-using WebKit::WebVector;
-
-RenderAudioSourceProvider::RenderAudioSourceProvider()
- : is_initialized_(false),
- channels_(0),
- sample_rate_(0.0),
- is_running_(false),
- volume_(1.0),
- renderer_(NULL),
- client_(NULL) {
- // We create the AudioDevice here because it must be created in the
- // main thread. But we don't yet know the audio format (sample-rate, etc.)
- // at this point. Later, when Initialize() is called, we have
- // the audio format information and call the AudioDevice::Initialize()
- // method to fully initialize it.
- default_sink_ = new AudioDevice();
-}
-
-RenderAudioSourceProvider::~RenderAudioSourceProvider() {}
-
-void RenderAudioSourceProvider::Start() {
- base::AutoLock auto_lock(sink_lock_);
- if (!client_)
- default_sink_->Start();
- is_running_ = true;
-}
-
-void RenderAudioSourceProvider::Stop() {
- base::AutoLock auto_lock(sink_lock_);
- if (!client_)
- default_sink_->Stop();
- is_running_ = false;
-}
-
-void RenderAudioSourceProvider::Play() {
- base::AutoLock auto_lock(sink_lock_);
- if (!client_)
- default_sink_->Play();
- is_running_ = true;
-}
-
-void RenderAudioSourceProvider::Pause(bool flush) {
- base::AutoLock auto_lock(sink_lock_);
- if (!client_)
- default_sink_->Pause(flush);
- is_running_ = false;
-}
-
-bool RenderAudioSourceProvider::SetVolume(double volume) {
- base::AutoLock auto_lock(sink_lock_);
- if (!client_)
- default_sink_->SetVolume(volume);
- volume_ = volume;
- return true;
-}
-
-void RenderAudioSourceProvider::GetVolume(double* volume) {
- if (!client_)
- default_sink_->GetVolume(volume);
- else if (volume)
- *volume = volume_;
-}
-
-void RenderAudioSourceProvider::Initialize(
- size_t buffer_size,
- int channels,
- double sample_rate,
- AudioParameters::Format latency_format,
- RenderCallback* renderer) {
- base::AutoLock auto_lock(sink_lock_);
- CHECK(!is_initialized_);
- renderer_ = renderer;
-
- default_sink_->Initialize(buffer_size,
- channels,
- sample_rate,
- latency_format,
- renderer);
-
- if (client_) {
- // Inform WebKit about the audio stream format.
- client_->setFormat(channels, sample_rate);
- }
-
- // Keep track of the format in case the client hasn't yet been set.
- channels_ = channels;
- sample_rate_ = sample_rate;
- is_initialized_ = true;
-}
-
-void RenderAudioSourceProvider::setClient(
- WebKit::WebAudioSourceProviderClient* client) {
- // Synchronize with other uses of client_ and default_sink_.
- base::AutoLock auto_lock(sink_lock_);
-
- if (client && client != client_) {
- // Detach the audio renderer from normal playback.
- default_sink_->Pause(true);
-
- // The client will now take control by calling provideInput() periodically.
- client_ = client;
-
- if (is_initialized_) {
- // The client needs to be notified of the audio format, if available.
- // If the format is not yet available, we'll be notified later
- // when Initialize() is called.
-
- // Inform WebKit about the audio stream format.
- client->setFormat(channels_, sample_rate_);
- }
- } else if (!client && client_) {
- // Restore normal playback.
- client_ = NULL;
- // TODO(crogers): We should call default_sink_->Play() if we're
- // in the playing state.
- }
-}
-
-void RenderAudioSourceProvider::provideInput(
- const WebVector<float*>& audio_data, size_t number_of_frames) {
- DCHECK(client_);
-
- if (renderer_ && is_initialized_ && is_running_) {
- // Wrap WebVector as std::vector.
- vector<float*> v(audio_data.size());
- for (size_t i = 0; i < audio_data.size(); ++i)
- v[i] = audio_data[i];
-
- // TODO(crogers): figure out if we should volume scale here or in common
- // WebAudio code. In any case we need to take care of volume.
- renderer_->Render(v, number_of_frames, 0);
- } else {
- // Provide silence if the source is not running.
- for (size_t i = 0; i < audio_data.size(); ++i)
- memset(audio_data[i], 0, sizeof(float) * number_of_frames);
- }
-}
diff --git a/content/renderer/render_audiosourceprovider.h b/content/renderer/render_audiosourceprovider.h
deleted file mode 100644
index 02f6b73..0000000
--- a/content/renderer/render_audiosourceprovider.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2011 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.
-//
-// RenderAudioSourceProvider provides a bridge between classes:
-// WebKit::WebAudioSourceProvider <---> media::AudioRendererSink
-//
-// RenderAudioSourceProvider is a "sink" of audio, and uses a default
-// AudioDevice if a client has not explicitly been set.
-//
-// WebKit optionally sets a client, and then periodically calls provideInput()
-// to render a certain number of audio sample-frames. provideInput()
-// uses the renderer to get this data, and then massages it into the form
-// required by provideInput(). In this case, the default AudioDevice
-// is no longer used.
-//
-// THREAD SAFETY:
-// It is assumed that the callers to setClient() and provideInput()
-// implement appropriate locking for thread safety when making
-// these calls. This happens in WebKit.
-
-#ifndef CONTENT_RENDERER_RENDER_AUDIOSOURCEPROVIDER_H_
-#define CONTENT_RENDERER_RENDER_AUDIOSOURCEPROVIDER_H_
-
-#include <vector>
-
-#include "content/renderer/media/audio_device.h"
-#include "media/base/audio_renderer_sink.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvider.h"
-
-namespace WebKit {
-class WebAudioSourceProviderClient;
-}
-
-class RenderAudioSourceProvider
- : public WebKit::WebAudioSourceProvider,
- public media::AudioRendererSink {
- public:
- RenderAudioSourceProvider();
- virtual ~RenderAudioSourceProvider();
-
- // WebKit::WebAudioSourceProvider implementation.
-
- // WebKit calls setClient() if it desires to take control of the rendered
- // audio stream. We call client's setFormat() when the audio stream format
- // is known.
- virtual void setClient(WebKit::WebAudioSourceProviderClient* client);
-
- // If setClient() has been called, then WebKit calls provideInput()
- // periodically to get the rendered audio stream.
- virtual void provideInput(const WebKit::WebVector<float*>& audio_data,
- size_t number_of_frames);
-
- // AudioRendererSink implementation.
- virtual void Start() OVERRIDE;
- virtual void Stop() OVERRIDE;
- virtual void Play() OVERRIDE;
- virtual void Pause(bool flush) OVERRIDE;
- virtual bool SetVolume(double volume) OVERRIDE;
- virtual void GetVolume(double* volume) OVERRIDE;
- virtual void Initialize(size_t buffer_size,
- int channels,
- double sample_rate,
- AudioParameters::Format latency_format,
- RenderCallback* renderer) OVERRIDE;
-
- private:
- // Set to true when Initialize() is called.
- bool is_initialized_;
- int channels_;
- double sample_rate_;
-
- bool is_running_;
- double volume_;
- media::AudioRendererSink::RenderCallback* renderer_;
- WebKit::WebAudioSourceProviderClient* client_;
-
- // Protects access to sink_
- base::Lock sink_lock_;
-
- // default_sink_ is the default sink.
- scoped_refptr<media::AudioRendererSink> default_sink_;
-
- DISALLOW_COPY_AND_ASSIGN(RenderAudioSourceProvider);
-};
-
-#endif // CONTENT_RENDERER_RENDER_AUDIOSOURCEPROVIDER_H_
diff --git a/content/renderer/renderer_gpu_video_decoder_factories.cc b/content/renderer/renderer_gpu_video_decoder_factories.cc
deleted file mode 100644
index 70b27ac..0000000
--- a/content/renderer/renderer_gpu_video_decoder_factories.cc
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (c) 2012 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 "content/renderer/renderer_gpu_video_decoder_factories.h"
-
-#include "base/bind.h"
-#include "base/synchronization/waitable_event.h"
-#include "content/common/child_thread.h"
-#include "content/renderer/gpu/command_buffer_proxy.h"
-#include "content/renderer/gpu/gpu_channel_host.h"
-#include "content/renderer/gpu/renderer_gl_context.h"
-#include "gpu/command_buffer/client/gles2_implementation.h"
-
-RendererGpuVideoDecoderFactories::~RendererGpuVideoDecoderFactories() {}
-RendererGpuVideoDecoderFactories::RendererGpuVideoDecoderFactories(
- GpuChannelHost* gpu_channel_host, base::WeakPtr<RendererGLContext> context)
- : message_loop_(MessageLoop::current()),
- gpu_channel_host_(gpu_channel_host),
- context_(context) {
-}
-
-media::VideoDecodeAccelerator*
-RendererGpuVideoDecoderFactories::CreateVideoDecodeAccelerator(
- media::VideoDecodeAccelerator::Profile profile,
- media::VideoDecodeAccelerator::Client* client) {
- media::VideoDecodeAccelerator* vda = NULL;
- base::WaitableEvent waiter(false, false);
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &RendererGpuVideoDecoderFactories::AsyncCreateVideoDecodeAccelerator,
- this, profile, client, &vda, &waiter));
- waiter.Wait();
- return vda;
-}
-
-void RendererGpuVideoDecoderFactories::AsyncCreateVideoDecodeAccelerator(
- media::VideoDecodeAccelerator::Profile profile,
- media::VideoDecodeAccelerator::Client* client,
- media::VideoDecodeAccelerator** vda,
- base::WaitableEvent* waiter) {
- if (context_) {
- *vda = gpu_channel_host_->CreateVideoDecoder(
- context_->GetCommandBufferProxy()->route_id(), profile, client);
- } else {
- *vda = NULL;
- }
- waiter->Signal();
-}
-
-bool RendererGpuVideoDecoderFactories::CreateTextures(
- int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids) {
- bool success = false;
- base::WaitableEvent waiter(false, false);
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &RendererGpuVideoDecoderFactories::AsyncCreateTextures, this,
- count, size, texture_ids, &success, &waiter));
- waiter.Wait();
- return success;
-}
-
-void RendererGpuVideoDecoderFactories::AsyncCreateTextures(
- int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids,
- bool* success, base::WaitableEvent* waiter) {
- if (!context_) {
- *success = false;
- waiter->Signal();
- return;
- }
- gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation();
- texture_ids->resize(count);
- gles2->GenTextures(count, &texture_ids->at(0));
- for (int i = 0; i < count; ++i) {
- gles2->ActiveTexture(GL_TEXTURE0);
- uint32 texture_id = texture_ids->at(i);
- gles2->BindTexture(GL_TEXTURE_2D, texture_id);
- gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- gles2->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- gles2->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- gles2->TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- gles2->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(),
- 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- }
- // We need a glFlush here to guarantee the decoder (in the GPU process) can
- // use the texture ids we return here. Since textures are expected to be
- // reused, this should not be unacceptably expensive.
- gles2->Flush();
- DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
- *success = true;
- waiter->Signal();
-}
-
-void RendererGpuVideoDecoderFactories::DeleteTexture(uint32 texture_id) {
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &RendererGpuVideoDecoderFactories::AsyncDeleteTexture, this, texture_id));
-}
-
-void RendererGpuVideoDecoderFactories::AsyncDeleteTexture(uint32 texture_id) {
- DCHECK_EQ(MessageLoop::current(), message_loop_);
- if (!context_)
- return;
- gpu::gles2::GLES2Implementation* gles2 = context_->GetImplementation();
- gles2->DeleteTextures(1, &texture_id);
- DCHECK_EQ(gles2->GetError(), static_cast<GLenum>(GL_NO_ERROR));
-}
-
-base::SharedMemory* RendererGpuVideoDecoderFactories::CreateSharedMemory(
- size_t size) {
- base::SharedMemory* shm = NULL;
- base::WaitableEvent waiter(false, false);
- message_loop_->PostTask(FROM_HERE, base::Bind(
- &RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory, this,
- size, &shm, &waiter));
- waiter.Wait();
- return shm;
-}
-
-void RendererGpuVideoDecoderFactories::AsyncCreateSharedMemory(
- size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter) {
- *shm = ChildThread::current()->AllocateSharedMemory(size);
- waiter->Signal();
-}
diff --git a/content/renderer/renderer_gpu_video_decoder_factories.h b/content/renderer/renderer_gpu_video_decoder_factories.h
deleted file mode 100644
index c7a7bb5..0000000
--- a/content/renderer/renderer_gpu_video_decoder_factories.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2012 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.
-
-#ifndef CONTENT_RENDERER_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_
-#define CONTENT_RENDERER_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "content/common/content_export.h"
-#include "media/filters/gpu_video_decoder.h"
-#include "ui/gfx/size.h"
-
-class GpuChannelHost;
-class RendererGLContext;
-namespace base {
-class WaitableEvent;
-}
-
-// Glue code to expose functionality needed by media::GpuVideoDecoder to
-// RenderViewImpl. This class is entirely an implementation detail of
-// RenderViewImpl and only has its own header to allow extraction of its
-// implementation from render_view_impl.cc which is already far too large.
-//
-// The public methods of the class can be called from any thread, and are
-// internally trampolined to the thread on which the class was constructed
-// (de-facto, the renderer thread) if called from a different thread.
-class CONTENT_EXPORT RendererGpuVideoDecoderFactories
- : public media::GpuVideoDecoder::Factories {
- public:
- // Takes a ref on |gpu_channel_host| and tests |context| for NULL before each
- // use.
- RendererGpuVideoDecoderFactories(GpuChannelHost* gpu_channel_host,
- base::WeakPtr<RendererGLContext> context);
-
- virtual media::VideoDecodeAccelerator* CreateVideoDecodeAccelerator(
- media::VideoDecodeAccelerator::Profile profile,
- media::VideoDecodeAccelerator::Client* client) OVERRIDE;
-
- virtual bool CreateTextures(int32 count, const gfx::Size& size,
- std::vector<uint32>* texture_ids) OVERRIDE;
-
- virtual void DeleteTexture(uint32 texture_id) OVERRIDE;
-
- virtual base::SharedMemory* CreateSharedMemory(size_t size) OVERRIDE;
-
- protected:
- friend class base::RefCountedThreadSafe<RendererGpuVideoDecoderFactories>;
- virtual ~RendererGpuVideoDecoderFactories();
-
- private:
- // Async versions of the public methods. These all run on |message_loop_|
- // exclusively, and use output parameters instead of return values. Finally,
- // each takes a WaitableEvent* param to signal completion (except for
- // DeleteTexture, which is fire-and-forget).
- void AsyncCreateVideoDecodeAccelerator(
- media::VideoDecodeAccelerator::Profile profile,
- media::VideoDecodeAccelerator::Client* client,
- media::VideoDecodeAccelerator** vda,
- base::WaitableEvent* waiter);
- void AsyncCreateTextures(
- int32 count, const gfx::Size& size, std::vector<uint32>* texture_ids,
- bool* success, base::WaitableEvent* waiter);
- void AsyncDeleteTexture(uint32 texture_id);
- void AsyncCreateSharedMemory(
- size_t size, base::SharedMemory** shm, base::WaitableEvent* waiter);
-
- MessageLoop* message_loop_;
- scoped_refptr<GpuChannelHost> gpu_channel_host_;
- base::WeakPtr<RendererGLContext> context_;
- DISALLOW_IMPLICIT_CONSTRUCTORS(RendererGpuVideoDecoderFactories);
-};
-
-#endif // CONTENT_RENDERER_RENDERER_GPU_VIDEO_DECODER_FACTORIES_H_
diff --git a/content/renderer/renderer_webaudiodevice_impl.cc b/content/renderer/renderer_webaudiodevice_impl.cc
deleted file mode 100644
index 623fb5a..0000000
--- a/content/renderer/renderer_webaudiodevice_impl.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2012 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 "content/renderer/renderer_webaudiodevice_impl.h"
-
-using WebKit::WebAudioDevice;
-using WebKit::WebVector;
-
-RendererWebAudioDeviceImpl::RendererWebAudioDeviceImpl(size_t buffer_size,
- int channels, double sample_rate, WebAudioDevice::RenderCallback* callback)
- : is_running_(false),
- client_callback_(callback) {
- audio_device_ = new AudioDevice(buffer_size, channels, sample_rate, this);
-}
-
-RendererWebAudioDeviceImpl::~RendererWebAudioDeviceImpl() {
- stop();
-}
-
-void RendererWebAudioDeviceImpl::start() {
- if (!is_running_) {
- audio_device_->Start();
- is_running_ = true;
- }
-}
-
-void RendererWebAudioDeviceImpl::stop() {
- if (is_running_) {
- audio_device_->Stop();
- is_running_ = false;
- }
-}
-
-double RendererWebAudioDeviceImpl::sampleRate() {
- return 44100.0;
-}
-
-size_t RendererWebAudioDeviceImpl::Render(const std::vector<float*>& audio_data,
- size_t number_of_frames,
- size_t audio_delay_milliseconds) {
- // Make the client callback to get rendered audio.
- DCHECK(client_callback_);
- if (client_callback_) {
- // Wrap the pointers using WebVector.
- WebVector<float*> web_audio_data(audio_data.size());
- for (size_t i = 0; i < audio_data.size(); ++i)
- web_audio_data[i] = audio_data[i];
-
- client_callback_->render(web_audio_data, number_of_frames);
- }
- return number_of_frames;
-}
-
-void RendererWebAudioDeviceImpl::OnError() {
- // TODO(crogers): implement error handling.
-}
diff --git a/content/renderer/renderer_webaudiodevice_impl.h b/content/renderer/renderer_webaudiodevice_impl.h
deleted file mode 100644
index 4a6d462..0000000
--- a/content/renderer/renderer_webaudiodevice_impl.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2012 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.
-
-#ifndef CONTENT_RENDERER_RENDERER_WEBAUDIODEVICE_IMPL_H_
-#define CONTENT_RENDERER_RENDERER_WEBAUDIODEVICE_IMPL_H_
-
-#include <vector>
-
-#include "base/memory/ref_counted.h"
-#include "content/renderer/media/audio_device.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebAudioDevice.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
-
-class RendererWebAudioDeviceImpl : public WebKit::WebAudioDevice,
- public AudioDevice::RenderCallback {
- public:
- RendererWebAudioDeviceImpl(size_t buffer_size,
- int channels,
- double sample_rate,
- WebKit::WebAudioDevice::RenderCallback* callback);
- virtual ~RendererWebAudioDeviceImpl();
-
- // WebKit::WebAudioDevice implementation.
- virtual void start();
- virtual void stop();
- virtual double sampleRate();
-
- // AudioDevice::RenderCallback implementation.
- virtual size_t Render(const std::vector<float*>& audio_data,
- size_t number_of_frames,
- size_t audio_delay_milliseconds) OVERRIDE;
- virtual void OnError() OVERRIDE;
-
- private:
- scoped_refptr<AudioDevice> audio_device_;
- bool is_running_;
-
- // Weak reference to the callback into WebKit code.
- WebKit::WebAudioDevice::RenderCallback* client_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl);
-};
-
-#endif // CONTENT_RENDERER_RENDERER_WEBAUDIODEVICE_IMPL_H_