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

Unified Diff: content/renderer/media/webrtc/video_destination_handler.h

Issue 631903003: Move VideoDestinationHandler processing to the IO-thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years, 2 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 | « no previous file | content/renderer/media/webrtc/video_destination_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc/video_destination_handler.h
diff --git a/content/renderer/media/webrtc/video_destination_handler.h b/content/renderer/media/webrtc/video_destination_handler.h
index 0a9ab85445c57194b10f6f6bc35d2ae44b8aa7c4..e57039d5a45e8c0f930be13c3499936a0f0b25d2 100644
--- a/content/renderer/media/webrtc/video_destination_handler.h
+++ b/content/renderer/media/webrtc/video_destination_handler.h
@@ -16,37 +16,45 @@
namespace content {
-class PeerConnectionDependencyFactory;
class MediaStreamRegistryInterface;
class PPB_ImageData_Impl;
-// Interface used by the effects pepper plugin to output the processed frame
-// to the video track.
-class CONTENT_EXPORT FrameWriterInterface {
+// VideoDestinationHandler is a glue class between the content MediaStream and
+// the effects pepper plugin host.
+class CONTENT_EXPORT VideoDestinationHandler {
public:
- // The ownership of the |image_data| deosn't transfer. So the implementation
- // of this interface should make a copy of the |image_data| before return.
- virtual void PutFrame(PPB_ImageData_Impl* image_data,
- int64 time_stamp_ns) = 0;
- virtual ~FrameWriterInterface() {}
+ // FrameWriterCallback is used to forward frames from the pepper host.
+ // It must be invoked on the main render thread.
+ typedef base::Callback<
+ void(const scoped_refptr<PPB_ImageData_Impl>& frame,
+ int64 time_stamp_ns)> FrameWriterCallback;
+
+ // Instantiates and adds a new video track to the MediaStream specified by
+ // |url|. Returns a handler for delivering frames to the new video track as
+ // |frame_writer|.
+ // If |registry| is NULL the global blink::WebMediaStreamRegistry will be
+ // used to look up the media stream.
+ // Returns true on success and false on failure.
+ static bool Open(MediaStreamRegistryInterface* registry,
+ const std::string& url,
+ FrameWriterCallback* frame_writer);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(VideoDestinationHandler);
};
// PpFrameWriter implements MediaStreamVideoSource and can therefore provide
-// video frames to MediaStreamVideoTracks. It also implements
-// FrameWriterInterface, which will be used by the effects pepper plugin to
-// inject the processed frame.
+// video frames to MediaStreamVideoTracks.
class CONTENT_EXPORT PpFrameWriter
- : NON_EXPORTED_BASE(public MediaStreamVideoSource),
- public FrameWriterInterface,
- NON_EXPORTED_BASE(public base::SupportsWeakPtr<PpFrameWriter>) {
+ : NON_EXPORTED_BASE(public MediaStreamVideoSource) {
public:
PpFrameWriter();
virtual ~PpFrameWriter();
- // FrameWriterInterface implementation.
- // This method will be called by the Pepper host from render thread.
- virtual void PutFrame(PPB_ImageData_Impl* image_data,
- int64 time_stamp_ns) override;
+ // Returns a callback that can be used for delivering frames to this
+ // MediaStreamSource implementation.
+ VideoDestinationHandler::FrameWriterCallback GetFrameWriterCallback();
+
protected:
// MediaStreamVideoSource implementation.
virtual void GetCurrentSupportedFormats(
@@ -60,33 +68,12 @@ class CONTENT_EXPORT PpFrameWriter
virtual void StopSourceImpl() override;
private:
- media::VideoFramePool frame_pool_;
-
class FrameWriterDelegate;
scoped_refptr<FrameWriterDelegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(PpFrameWriter);
};
-// VideoDestinationHandler is a glue class between the content MediaStream and
-// the effects pepper plugin host.
-class CONTENT_EXPORT VideoDestinationHandler {
- public:
- // Instantiates and adds a new video track to the MediaStream specified by
- // |url|. Returns a handler for delivering frames to the new video track as
- // |frame_writer|.
- // If |registry| is NULL the global blink::WebMediaStreamRegistry will be
- // used to look up the media stream.
- // The caller of the function takes the ownership of |frame_writer|.
- // Returns true on success and false on failure.
- static bool Open(MediaStreamRegistryInterface* registry,
- const std::string& url,
- FrameWriterInterface** frame_writer);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(VideoDestinationHandler);
-};
-
} // namespace content
-#endif // CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_
+#endif // CONTENT_RENDERER_MEDIA_WEBRTC_VIDEO_DESTINATION_HANDLER_H_
« no previous file with comments | « no previous file | content/renderer/media/webrtc/video_destination_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698