Chromium Code Reviews| Index: content/renderer/media/webrtc/media_stream_remote_video_source.h |
| diff --git a/content/renderer/media/webrtc/media_stream_remote_video_source.h b/content/renderer/media/webrtc/media_stream_remote_video_source.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..addfff0b8daf93ee110a0de7bc6bd8071f1467e7 |
| --- /dev/null |
| +++ b/content/renderer/media/webrtc/media_stream_remote_video_source.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_ |
| +#define CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "content/common/content_export.h" |
| +#include "content/renderer/media/media_stream_video_source.h" |
| +#include "media/base/video_frame_pool.h" |
| +#include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| +#include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
|
Ronghua Wu (Left Chromium)
2014/03/17 22:45:35
move one line above
perkj_chrome
2014/03/19 16:34:48
actually - WebKit includes must come first in thir
|
| + |
| +namespace content { |
| + |
| +// MediaStreamRemoteVideoSource implements the MediaStreamVideoSource interface |
| +// for video tracks received on a PeerConnection. The purpose of the class is |
| +// to make sure there is no difference between a video track where the source is |
| +// a local source and a video track where the source is a remote video track. |
| +class CONTENT_EXPORT MediaStreamRemoteVideoSource |
| + : public MediaStreamVideoSource, |
| + public webrtc::VideoRendererInterface, |
| + public webrtc::ObserverInterface, |
| + public base::SupportsWeakPtr<MediaStreamRemoteVideoSource> { |
| + public: |
| + explicit MediaStreamRemoteVideoSource( |
| + webrtc::VideoTrackInterface* remote_track); |
| + virtual ~MediaStreamRemoteVideoSource(); |
| + |
| + protected: |
| + // Implements MediaStreamVideoSource. |
| + virtual void GetCurrentSupportedFormats( |
| + int max_requested_width, |
| + int max_requested_height) OVERRIDE; |
| + |
| + virtual void StartSourceImpl( |
| + const media::VideoCaptureParams& params) OVERRIDE; |
| + |
| + virtual void StopSourceImpl() OVERRIDE; |
| + |
| + virtual webrtc::VideoSourceInterface* GetAdapter() OVERRIDE; |
| + |
| + // Implements webrtc::VideoRendererInterface used for receiving video frames |
| + // from the PeerConnection video track. May be called on |
| + // a different thread. |
| + virtual void SetSize(int width, int height) OVERRIDE; |
| + virtual void RenderFrame(const cricket::VideoFrame* frame) OVERRIDE; |
| + |
| + // webrtc::ObserverInterface implementation. |
| + virtual void OnChanged() OVERRIDE; |
| + |
| + private: |
| + void FrameFormatOnMainThread(const media::VideoCaptureFormat& format); |
| + void DoRenderFrameOnMainThread(scoped_refptr<media::VideoFrame> video_frame); |
| + |
| + scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| + scoped_refptr<webrtc::VideoTrackInterface> remote_track_; |
| + webrtc::MediaStreamTrackInterface::TrackState track_state_; |
| + |
| + // |first_frame_received_| and |frame_pool_| are only accessed on whatever |
| + /// thread webrtc::VideoRendererInterface::RenderFrame is called on. |
|
Ronghua Wu (Left Chromium)
2014/03/17 22:45:35
remove extra /
perkj_chrome
2014/03/19 16:34:48
Done.
|
| + bool first_frame_received_; |
| + media::VideoFramePool frame_pool_; |
| + |
| + // |format_| is the format currently received by this source. |
| + media::VideoCaptureFormat format_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(MediaStreamRemoteVideoSource); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_WEBRTC_MEDIA_STREAM_REMOTE_VIDEO_SOURCE_H_ |