Roll src/third_party/WebKit d10c917:a1123a1 (svn 198729:198730)
[chromium-blink-merge.git] / content / renderer / media / webrtc / media_stream_remote_video_source.h
blob5607cd52c3c37650759bf7006d38a6e7bec0689f
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_
8 #include "base/memory/weak_ptr.h"
9 #include "base/single_thread_task_runner.h"
10 #include "content/common/content_export.h"
11 #include "content/renderer/media/media_stream_video_source.h"
12 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
13 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
15 namespace content {
17 class TrackObserver;
19 // MediaStreamRemoteVideoSource implements the MediaStreamVideoSource interface
20 // for video tracks received on a PeerConnection. The purpose of the class is
21 // to make sure there is no difference between a video track where the source is
22 // a local source and a video track where the source is a remote video track.
23 class CONTENT_EXPORT MediaStreamRemoteVideoSource
24 : public MediaStreamVideoSource {
25 public:
26 MediaStreamRemoteVideoSource(scoped_ptr<TrackObserver> observer);
27 virtual ~MediaStreamRemoteVideoSource();
29 protected:
30 // Implements MediaStreamVideoSource.
31 void GetCurrentSupportedFormats(
32 int max_requested_width,
33 int max_requested_height,
34 double max_requested_frame_rate,
35 const VideoCaptureDeviceFormatsCB& callback) override;
37 void StartSourceImpl(
38 const media::VideoCaptureFormat& format,
39 const blink::WebMediaConstraints& constraints,
40 const VideoCaptureDeliverFrameCB& frame_callback) override;
42 void StopSourceImpl() override;
44 // Used by tests to test that a frame can be received and that the
45 // MediaStreamRemoteVideoSource behaves as expected.
46 webrtc::VideoRendererInterface* RenderInterfaceForTest();
48 private:
49 void OnChanged(webrtc::MediaStreamTrackInterface::TrackState state);
51 // Internal class used for receiving frames from the webrtc track on a
52 // libjingle thread and forward it to the IO-thread.
53 class RemoteVideoSourceDelegate;
54 scoped_refptr<RemoteVideoSourceDelegate> delegate_;
55 scoped_ptr<TrackObserver> observer_;
57 DISALLOW_COPY_AND_ASSIGN(MediaStreamRemoteVideoSource);
60 } // namespace content
62 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_