| 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_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/threading/thread_checker.h" | 8 #include "base/threading/thread_checker.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/renderer/media/media_stream_video_source.h" | 10 #include "content/renderer/media/media_stream_video_source.h" |
| 11 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 11 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 12 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 12 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 // MediaStreamRemoteVideoSource implements the MediaStreamVideoSource interface | 16 // MediaStreamRemoteVideoSource implements the MediaStreamVideoSource interface |
| 17 // for video tracks received on a PeerConnection. The purpose of the class is | 17 // for video tracks received on a PeerConnection. The purpose of the class is |
| 18 // to make sure there is no difference between a video track where the source is | 18 // to make sure there is no difference between a video track where the source is |
| 19 // a local source and a video track where the source is a remote video track. | 19 // a local source and a video track where the source is a remote video track. |
| 20 class CONTENT_EXPORT MediaStreamRemoteVideoSource | 20 class CONTENT_EXPORT MediaStreamRemoteVideoSource |
| 21 : public MediaStreamVideoSource, | 21 : public MediaStreamVideoSource, |
| 22 NON_EXPORTED_BASE(public webrtc::ObserverInterface) { | 22 NON_EXPORTED_BASE(public webrtc::ObserverInterface) { |
| 23 public: | 23 public: |
| 24 explicit MediaStreamRemoteVideoSource( | 24 explicit MediaStreamRemoteVideoSource( |
| 25 webrtc::VideoTrackInterface* remote_track); | 25 webrtc::VideoTrackInterface* remote_track); |
| 26 virtual ~MediaStreamRemoteVideoSource(); | 26 virtual ~MediaStreamRemoteVideoSource(); |
| 27 | 27 |
| 28 protected: | 28 protected: |
| 29 // Implements MediaStreamVideoSource. | 29 // Implements MediaStreamVideoSource. |
| 30 virtual void GetCurrentSupportedFormats( | 30 void GetCurrentSupportedFormats( |
| 31 int max_requested_width, | 31 int max_requested_width, |
| 32 int max_requested_height, | 32 int max_requested_height, |
| 33 double max_requested_frame_rate, | 33 double max_requested_frame_rate, |
| 34 const VideoCaptureDeviceFormatsCB& callback) override; | 34 const VideoCaptureDeviceFormatsCB& callback) override; |
| 35 | 35 |
| 36 virtual void StartSourceImpl( | 36 void StartSourceImpl( |
| 37 const media::VideoCaptureFormat& format, | 37 const media::VideoCaptureFormat& format, |
| 38 const VideoCaptureDeliverFrameCB& frame_callback) override; | 38 const VideoCaptureDeliverFrameCB& frame_callback) override; |
| 39 | 39 |
| 40 virtual void StopSourceImpl() override; | 40 void StopSourceImpl() override; |
| 41 | 41 |
| 42 // Used by tests to test that a frame can be received and that the | 42 // Used by tests to test that a frame can be received and that the |
| 43 // MediaStreamRemoteVideoSource behaves as expected. | 43 // MediaStreamRemoteVideoSource behaves as expected. |
| 44 webrtc::VideoRendererInterface* RenderInterfaceForTest(); | 44 webrtc::VideoRendererInterface* RenderInterfaceForTest(); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // webrtc::ObserverInterface implementation. | 47 // webrtc::ObserverInterface implementation. |
| 48 virtual void OnChanged() override; | 48 void OnChanged() override; |
| 49 | 49 |
| 50 scoped_refptr<webrtc::VideoTrackInterface> remote_track_; | 50 scoped_refptr<webrtc::VideoTrackInterface> remote_track_; |
| 51 webrtc::MediaStreamTrackInterface::TrackState last_state_; | 51 webrtc::MediaStreamTrackInterface::TrackState last_state_; |
| 52 | 52 |
| 53 // Internal class used for receiving frames from the webrtc track on a | 53 // Internal class used for receiving frames from the webrtc track on a |
| 54 // libjingle thread and forward it to the IO-thread. | 54 // libjingle thread and forward it to the IO-thread. |
| 55 class RemoteVideoSourceDelegate; | 55 class RemoteVideoSourceDelegate; |
| 56 scoped_refptr<RemoteVideoSourceDelegate> delegate_; | 56 scoped_refptr<RemoteVideoSourceDelegate> delegate_; |
| 57 | 57 |
| 58 // Bound to the render thread. | 58 // Bound to the render thread. |
| 59 base::ThreadChecker thread_checker_; | 59 base::ThreadChecker thread_checker_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(MediaStreamRemoteVideoSource); | 61 DISALLOW_COPY_AND_ASSIGN(MediaStreamRemoteVideoSource); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace content | 64 } // namespace content |
| 65 | 65 |
| 66 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_ | 66 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_ |
| OLD | NEW |