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

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

Issue 15039009: Add PPAPI tests for VideoSource and VideoDestination resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 7 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 | « chrome/test/ppapi/ppapi_test.cc ('k') | content/renderer/pepper/pepper_video_source_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_video_source_host.h
diff --git a/content/renderer/pepper/pepper_video_source_host.h b/content/renderer/pepper/pepper_video_source_host.h
index 16aba452e050547165ef099cda907dabf0101607..355f43bbd65782b89d5fb4867ce81beb23d50e1f 100644
--- a/content/renderer/pepper/pepper_video_source_host.h
+++ b/content/renderer/pepper/pepper_video_source_host.h
@@ -6,6 +6,7 @@
#define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_
#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/common/content_export.h"
@@ -14,13 +15,13 @@
#include "ppapi/host/host_message_context.h"
#include "ppapi/host/resource_host.h"
+struct PP_ImageDataDesc;
+
namespace content {
class RendererPpapiHost;
-class CONTENT_EXPORT PepperVideoSourceHost
- : public ppapi::host::ResourceHost,
- public content::FrameReaderInterface {
+class CONTENT_EXPORT PepperVideoSourceHost : public ppapi::host::ResourceHost {
public:
PepperVideoSourceHost(RendererPpapiHost* host,
PP_Instance instance,
@@ -28,26 +29,44 @@ class CONTENT_EXPORT PepperVideoSourceHost
virtual ~PepperVideoSourceHost();
- // content::FrameReaderInterface implementation.
- virtual bool GotFrame(cricket::VideoFrame* frame) OVERRIDE;
-
virtual int32_t OnResourceMessageReceived(
const IPC::Message& msg,
ppapi::host::HostMessageContext* context) OVERRIDE;
private:
+ // This helper object receives frames on a video worker thread and passes
+ // them on to us.
+ class FrameReceiver : public content::FrameReaderInterface,
+ public base::RefCountedThreadSafe<FrameReceiver> {
+ public:
+ explicit FrameReceiver(const base::WeakPtr<PepperVideoSourceHost>& host);
+
+ // content::FrameReaderInterface implementation.
+ virtual bool GotFrame(cricket::VideoFrame* frame) OVERRIDE;
+
+ void OnGotFrame(scoped_ptr<cricket::VideoFrame> frame);
+
+ private:
+ friend class base::RefCountedThreadSafe<FrameReceiver>;
+ virtual ~FrameReceiver();
+
+ base::WeakPtr<PepperVideoSourceHost> host_;
+ scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_;
+ };
+
+ friend class FrameReceiver;
+
int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context,
const std::string& stream_url);
int32_t OnHostMsgGetFrame(ppapi::host::HostMessageContext* context);
int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context);
- void OnGotFrame(scoped_ptr<cricket::VideoFrame> frame);
+ // Sends the reply to a GetFrame message from the plugin. A reply is always
+ // sent and last_frame_, reply_context_, and get_frame_pending_ are all reset.
+ void SendGetFrameReply();
+ // Sends the reply to a GetFrame message from the plugin in case of an error.
+ void SendGetFrameErrorReply(int32_t error);
- int32_t ConvertFrame(ppapi::HostResource* image_data_resource,
- PP_TimeTicks* timestamp);
- void SendFrame(const ppapi::HostResource& image_data_resource,
- PP_TimeTicks timestamp,
- int32_t result);
void Close();
RendererPpapiHost* renderer_ppapi_host_;
@@ -55,9 +74,9 @@ class CONTENT_EXPORT PepperVideoSourceHost
base::WeakPtrFactory<PepperVideoSourceHost> weak_factory_;
ppapi::host::ReplyMessageContext reply_context_;
- scoped_refptr<base::MessageLoopProxy> main_message_loop_proxy_;
scoped_ptr<content::VideoSourceHandler> source_handler_;
+ scoped_refptr<FrameReceiver> frame_receiver_;
std::string stream_url_;
scoped_ptr<cricket::VideoFrame> last_frame_;
bool get_frame_pending_;
« no previous file with comments | « chrome/test/ppapi/ppapi_test.cc ('k') | content/renderer/pepper/pepper_video_source_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698