OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MEDIA_STREAM_VIDEO_TRACK_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_VIDEO_TRACK_HOST_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_VIDEO_TRACK_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_VIDEO_TRACK_HOST_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/weak_ptr.h" |
9 #include "content/public/renderer/media_stream_video_sink.h" | 10 #include "content/public/renderer/media_stream_video_sink.h" |
10 #include "content/renderer/media/media_stream_video_source.h" | 11 #include "content/renderer/media/media_stream_video_source.h" |
11 #include "content/renderer/pepper/pepper_media_stream_track_host_base.h" | 12 #include "content/renderer/pepper/pepper_media_stream_track_host_base.h" |
12 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
13 #include "ppapi/c/ppb_video_frame.h" | 14 #include "ppapi/c/ppb_video_frame.h" |
14 #include "ppapi/shared_impl/media_stream_video_track_shared.h" | 15 #include "ppapi/shared_impl/media_stream_video_track_shared.h" |
15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 16 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
16 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
17 | 18 |
18 namespace content { | 19 namespace content { |
(...skipping 28 matching lines...) Expand all Loading... |
47 void InitBuffers(); | 48 void InitBuffers(); |
48 | 49 |
49 // PepperMediaStreamTrackHostBase overrides: | 50 // PepperMediaStreamTrackHostBase overrides: |
50 virtual void OnClose() OVERRIDE; | 51 virtual void OnClose() OVERRIDE; |
51 virtual int32_t OnHostMsgEnqueueBuffer( | 52 virtual int32_t OnHostMsgEnqueueBuffer( |
52 ppapi::host::HostMessageContext* context, int32_t index) OVERRIDE; | 53 ppapi::host::HostMessageContext* context, int32_t index) OVERRIDE; |
53 | 54 |
54 // Sends frame with |index| to |track_|. | 55 // Sends frame with |index| to |track_|. |
55 int32_t SendFrameToTrack(int32_t index); | 56 int32_t SendFrameToTrack(int32_t index); |
56 | 57 |
57 // MediaStreamVideoSink overrides: | 58 void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame, |
58 virtual void OnVideoFrame(const scoped_refptr<media::VideoFrame>& frame) | 59 const media::VideoCaptureFormat& format); |
59 OVERRIDE; | |
60 | 60 |
61 // MediaStreamVideoSource overrides: | 61 // MediaStreamVideoSource overrides: |
62 virtual void GetCurrentSupportedFormats( | 62 virtual void GetCurrentSupportedFormats( |
63 int max_requested_width, | 63 int max_requested_width, |
64 int max_requested_height, | 64 int max_requested_height, |
65 const VideoCaptureDeviceFormatsCB& callback) OVERRIDE; | 65 const VideoCaptureDeviceFormatsCB& callback) OVERRIDE; |
66 | 66 |
67 virtual void StartSourceImpl( | 67 virtual void StartSourceImpl( |
68 const media::VideoCaptureParams& params, | 68 const media::VideoCaptureParams& params, |
69 const VideoCaptureDeliverFrameCB& frame_callback) OVERRIDE; | 69 const VideoCaptureDeliverFrameCB& frame_callback) OVERRIDE; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // TODO(ronghuawu): Remove |type_| and split PepperMediaStreamVideoTrackHost | 112 // TODO(ronghuawu): Remove |type_| and split PepperMediaStreamVideoTrackHost |
113 // into 2 classes for read and write. | 113 // into 2 classes for read and write. |
114 TrackType type_; | 114 TrackType type_; |
115 bool output_started_; | 115 bool output_started_; |
116 | 116 |
117 // Internal class used for delivering video frames on the IO-thread to | 117 // Internal class used for delivering video frames on the IO-thread to |
118 // the MediaStreamVideoSource implementation. | 118 // the MediaStreamVideoSource implementation. |
119 class FrameDeliverer; | 119 class FrameDeliverer; |
120 scoped_refptr<FrameDeliverer> frame_deliverer_; | 120 scoped_refptr<FrameDeliverer> frame_deliverer_; |
121 | 121 |
| 122 base::WeakPtrFactory<PepperMediaStreamVideoTrackHost> weak_factory_; |
| 123 |
122 DISALLOW_COPY_AND_ASSIGN(PepperMediaStreamVideoTrackHost); | 124 DISALLOW_COPY_AND_ASSIGN(PepperMediaStreamVideoTrackHost); |
123 }; | 125 }; |
124 | 126 |
125 } // namespace content | 127 } // namespace content |
126 | 128 |
127 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_VIDEO_TRACK_HOST_H_ | 129 #endif // CONTENT_RENDERER_PEPPER_PEPPER_MEDIA_STREAM_VIDEO_TRACK_HOST_H_ |
OLD | NEW |