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

Unified Diff: content/renderer/pepper/pepper_video_decoder_host.h

Issue 311853005: Implement software fallback for PPB_VideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, fix Windows compile, restore test. Created 6 years, 6 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
Index: content/renderer/pepper/pepper_video_decoder_host.h
diff --git a/content/renderer/pepper/pepper_video_decoder_host.h b/content/renderer/pepper/pepper_video_decoder_host.h
index bc44fe848dffe9778ae846b106db13647c9c5ca0..ae7d525d3e1d81184e399d8434f083d2ac082353 100644
--- a/content/renderer/pepper/pepper_video_decoder_host.h
+++ b/content/renderer/pepper/pepper_video_decoder_host.h
@@ -10,11 +10,9 @@
#include "base/basictypes.h"
#include "base/containers/hash_tables.h"
-#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "content/common/content_export.h"
-#include "gpu/command_buffer/common/mailbox.h"
#include "media/video/video_decode_accelerator.h"
#include "ppapi/c/pp_codecs.h"
#include "ppapi/host/host_message_context.h"
@@ -30,6 +28,7 @@ namespace content {
class PPB_Graphics3D_Impl;
class RendererPpapiHost;
class RenderViewImpl;
+class VideoDecoderShim;
class CONTENT_EXPORT PepperVideoDecoderHost
: public ppapi::host::ResourceHost,
@@ -50,6 +49,8 @@ class CONTENT_EXPORT PepperVideoDecoderHost
const ppapi::host::ReplyMessageContext reply_context;
};
+ friend class VideoDecoderShim;
+
// ResourceHost implementation.
virtual int32_t OnResourceMessageReceived(
const IPC::Message& msg,
@@ -61,10 +62,10 @@ class CONTENT_EXPORT PepperVideoDecoderHost
uint32 texture_target) OVERRIDE;
virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
virtual void PictureReady(const media::Picture& picture) OVERRIDE;
- virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE;
- virtual void NotifyFlushDone() OVERRIDE;
virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE;
+ virtual void NotifyFlushDone() OVERRIDE;
virtual void NotifyResetDone() OVERRIDE;
+ virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE;
int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context,
const ppapi::HostResource& graphics_context,
@@ -85,11 +86,21 @@ class CONTENT_EXPORT PepperVideoDecoderHost
int32_t OnHostMsgFlush(ppapi::host::HostMessageContext* context);
int32_t OnHostMsgReset(ppapi::host::HostMessageContext* context);
+ // These methods are needed by VideoDecodeAdapter, to look like a
Ami GONE FROM CHROMIUM 2014/06/07 18:26:39 s/Adapter/Shim/ (please make a pass)
bbudge 2014/06/07 21:28:33 Done.
+ // VideoDecodeAccelerator.
+ void OnInitializeComplete(int32_t result);
+ intptr_t ShmIdToKey(uint32_t shm_id);
+ intptr_t ShmHandleToKey(const base::SharedMemoryHandle& handle);
+ const uint8_t* ShmHandleToAddress(const base::SharedMemoryHandle& handle);
+ void RequestTextures(uint32 requested_num_of_buffers,
+ const gfx::Size& dimensions,
+ uint32 texture_target,
+ const std::vector<gpu::Mailbox>& mailboxes);
+
// Non-owning pointer.
RendererPpapiHost* renderer_ppapi_host_;
scoped_ptr<media::VideoDecodeAccelerator> decoder_;
- scoped_refptr<PPB_Graphics3D_Impl> graphics3d_;
// A vector holding our shm buffers, in sync with a similar vector in the
// resource. We use a buffer's index in these vectors as its id on both sides
@@ -99,6 +110,10 @@ class CONTENT_EXPORT PepperVideoDecoderHost
// A vector of true/false indicating if a shm buffer is in use by the decoder.
// This is parallel to |shm_buffers_|.
std::vector<uint8_t> shm_buffer_busy_;
+ // A map of shm handles to memory addresses, to assist VideoDecoderShim.
Ami GONE FROM CHROMIUM 2014/06/07 18:26:39 If you didn't need to go from Handle to addr (only
bbudge 2014/06/07 21:28:33 So much better. Done.
+ // base::SharedMemoryHandle isn't suitable as a key on POSIX.
+ typedef base::hash_map<intptr_t, void*> SharedMemoryAddrMap;
+ SharedMemoryAddrMap shm_handle_to_memory_map_;
// Maps decode uid to PendingDecode info.
typedef base::hash_map<int32_t, PendingDecode> PendingDecodeMap;
@@ -106,6 +121,8 @@ class CONTENT_EXPORT PepperVideoDecoderHost
ppapi::host::ReplyMessageContext flush_reply_context_;
ppapi::host::ReplyMessageContext reset_reply_context_;
+ // Only used when in software fallback mode.
+ ppapi::host::ReplyMessageContext initialize_reply_context_;
bool initialized_;

Powered by Google App Engine
This is Rietveld 408576698