Chromium Code Reviews| 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 7981401284f223a8f652b5b9b733d8120ee8fe2e..dc2d31dad975192456a53bc2448f0ff6dd9085e3 100644 |
| --- a/content/renderer/media/webrtc/video_destination_handler.h |
| +++ b/content/renderer/media/webrtc/video_destination_handler.h |
| @@ -16,37 +16,46 @@ |
| 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. It implements a method |Bind| to |
|
magjed_chromium
2014/10/07 14:07:01
unterminated comment
perkj_chrome
2014/10/07 15:39:04
Done.
|
| + |
| 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; |
| + // Binds the MediaStreamVideoSource with |FrameWriterCallback| which can be |
| + // used by the effects pepper plugin host to inject processed frames. |
| + VideoDestinationHandler::FrameWriterCallback Bind(); |
|
magjed_chromium
2014/10/07 14:07:01
Maybe 'Bind' is a strange name for this function?
perkj_chrome
2014/10/07 15:39:04
Done.
|
| + |
| protected: |
| // MediaStreamVideoSource implementation. |
| virtual void GetCurrentSupportedFormats( |
| @@ -60,33 +69,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_ |