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

Side by Side Diff: content/renderer/pepper/pepper_video_source_host.h

Issue 14968002: Glue code to connect PPAPI proxy to MediaStream sources and destinations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add lock. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
10 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "content/renderer/media/video_source_handler.h"
11 #include "ppapi/c/pp_time.h" 13 #include "ppapi/c/pp_time.h"
14 #include "ppapi/host/host_message_context.h"
12 #include "ppapi/host/resource_host.h" 15 #include "ppapi/host/resource_host.h"
13 16
14 namespace content { 17 namespace content {
15 18
16 class RendererPpapiHost; 19 class RendererPpapiHost;
17 20
18 class CONTENT_EXPORT PepperVideoSourceHost : public ppapi::host::ResourceHost { 21 class CONTENT_EXPORT PepperVideoSourceHost
22 : public ppapi::host::ResourceHost,
23 public content::FrameReaderInterface {
19 public: 24 public:
20 PepperVideoSourceHost(RendererPpapiHost* host, 25 PepperVideoSourceHost(RendererPpapiHost* host,
21 PP_Instance instance, 26 PP_Instance instance,
22 PP_Resource resource); 27 PP_Resource resource);
23 28
24 virtual ~PepperVideoSourceHost(); 29 virtual ~PepperVideoSourceHost();
25 30
31 // content::FrameReaderInterface implementation.
32 virtual bool GotFrame(cricket::VideoFrame* frame) OVERRIDE;
33
26 virtual int32_t OnResourceMessageReceived( 34 virtual int32_t OnResourceMessageReceived(
27 const IPC::Message& msg, 35 const IPC::Message& msg,
28 ppapi::host::HostMessageContext* context) OVERRIDE; 36 ppapi::host::HostMessageContext* context) OVERRIDE;
29 37
30 private: 38 private:
39 int32_t ConvertFrame(ppapi::HostResource* image_data_resource,
40 PP_TimeTicks* timestamp);
41 void SendFrame(const ppapi::HostResource& image_data_resource,
42 PP_TimeTicks timestamp,
43 int32_t result);
44
31 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context, 45 int32_t OnHostMsgOpen(ppapi::host::HostMessageContext* context,
32 const std::string& stream_url); 46 const std::string& stream_url);
33 int32_t OnHostMsgGetFrame(ppapi::host::HostMessageContext* context); 47 int32_t OnHostMsgGetFrame(ppapi::host::HostMessageContext* context);
34 int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context); 48 int32_t OnHostMsgClose(ppapi::host::HostMessageContext* context);
35 49
36 RendererPpapiHost* renderer_ppapi_host_; 50 RendererPpapiHost* renderer_ppapi_host_;
51 ppapi::host::ReplyMessageContext reply_context_;
37 52
38 base::WeakPtrFactory<PepperVideoSourceHost> weak_factory_; 53 base::WeakPtrFactory<PepperVideoSourceHost> weak_factory_;
39 54
40 PP_TimeTicks last_timestamp_; 55 scoped_ptr<content::VideoSourceHandler> source_handler_;
56 std::string stream_url_;
57 scoped_ptr<cricket::VideoFrame> last_frame_;
58 base::Lock lock_;
yzshen1 2013/05/06 16:47:28 I agree with the comment that we should use PostTa
bbudge 2013/05/06 19:27:50 Done. Used a task.
59 bool get_frame_pending_;
41 60
42 DISALLOW_COPY_AND_ASSIGN(PepperVideoSourceHost); 61 DISALLOW_COPY_AND_ASSIGN(PepperVideoSourceHost);
43 }; 62 };
44 63
45 } // namespace content 64 } // namespace content
46 65
47 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_ 66 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_SOURCE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698