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

Side by Side Diff: content/renderer/media/webrtc/media_stream_remote_video_source.h

Issue 201583003: Implement a source for remote video tracks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "content/common/content_export.h"
10 #include "content/renderer/media/media_stream_video_source.h"
11 #include "media/base/video_frame_pool.h"
12 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
13 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h"
14
15 namespace content {
16
17 // MediaStreamRemoteVideoSource implements the MediaStreamVideoSource interface
18 // for video tracks received on a PeerConnection. The purpose of the class is
19 // to make sure there is no difference between a video track where the source is
20 // a local source and a video track where the source is a remote video track.
21 class CONTENT_EXPORT MediaStreamRemoteVideoSource
22 : public MediaStreamVideoSource,
23 NON_EXPORTED_BASE(public webrtc::VideoRendererInterface),
24 NON_EXPORTED_BASE(public webrtc::ObserverInterface),
25 public base::SupportsWeakPtr<MediaStreamRemoteVideoSource> {
26 public:
27 explicit MediaStreamRemoteVideoSource(
28 webrtc::VideoTrackInterface* remote_track);
29 virtual ~MediaStreamRemoteVideoSource();
30
31 protected:
32 // Implements MediaStreamVideoSource.
33 virtual void GetCurrentSupportedFormats(
34 int max_requested_width,
35 int max_requested_height) OVERRIDE;
36
37 virtual void StartSourceImpl(
38 const media::VideoCaptureParams& params) OVERRIDE;
39
40 virtual void StopSourceImpl() OVERRIDE;
41
42 virtual webrtc::VideoSourceInterface* GetAdapter() OVERRIDE;
43
44 // Implements webrtc::VideoRendererInterface used for receiving video frames
45 // from the PeerConnection video track. May be called on
46 // a different thread.
47 virtual void SetSize(int width, int height) OVERRIDE;
48 virtual void RenderFrame(const cricket::VideoFrame* frame) OVERRIDE;
49
50 // webrtc::ObserverInterface implementation.
51 virtual void OnChanged() OVERRIDE;
52
53 private:
54 void FrameFormatOnMainThread(const media::VideoCaptureFormat& format);
55 void DoRenderFrameOnMainThread(scoped_refptr<media::VideoFrame> video_frame);
56
57 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
58 scoped_refptr<webrtc::VideoTrackInterface> remote_track_;
59 webrtc::MediaStreamTrackInterface::TrackState last_state_;
60
61 // |first_frame_received_| and |frame_pool_| are only accessed on whatever
62 // thread webrtc::VideoRendererInterface::RenderFrame is called on.
63 bool first_frame_received_;
64 media::VideoFramePool frame_pool_;
65
66 // |format_| is the format currently received by this source.
67 media::VideoCaptureFormat format_;
68
69 DISALLOW_COPY_AND_ASSIGN(MediaStreamRemoteVideoSource);
70 };
71
72 } // namespace content
73
74 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698