namespace media {
class MediaLog;
+class WebMediaPlayerDelegate;
}
-namespace webkit {
+namespace cc_blink {
class WebLayerImpl;
}
namespace content {
class MediaStreamAudioRenderer;
-class MediaStreamClient;
+class MediaStreamRendererFactory;
class VideoFrameProvider;
-class WebMediaPlayerDelegate;
// WebMediaPlayerMS delegates calls from WebCore::MediaPlayerPrivate to
// Chrome's media player when "src" is from media stream.
// a MediaStreamClient which provides VideoFrameProvider.
WebMediaPlayerMS(blink::WebFrame* frame,
blink::WebMediaPlayerClient* client,
- base::WeakPtr<WebMediaPlayerDelegate> delegate,
- MediaStreamClient* media_stream_client,
- media::MediaLog* media_log);
+ base::WeakPtr<media::WebMediaPlayerDelegate> delegate,
+ media::MediaLog* media_log,
+ scoped_ptr<MediaStreamRendererFactory> factory);
virtual ~WebMediaPlayerMS();
virtual void load(LoadType load_type,
virtual void setRate(double rate);
virtual void setVolume(double volume);
virtual void setPreload(blink::WebMediaPlayer::Preload preload);
- virtual const blink::WebTimeRanges& buffered();
- virtual double maxTimeSeekable() const;
+ virtual blink::WebTimeRanges buffered() const;
+ virtual blink::WebTimeRanges seekable() const;
// Methods for painting.
virtual void paint(blink::WebCanvas* canvas,
const blink::WebRect& rect,
- unsigned char alpha);
+ unsigned char alpha,
+ SkXfermode::Mode mode);
// True if the loaded media has a playable video/audio track.
virtual bool hasVideo() const;
virtual blink::WebMediaPlayer::NetworkState networkState() const;
virtual blink::WebMediaPlayer::ReadyState readyState() const;
- virtual bool didLoadingProgress() const;
+ virtual bool didLoadingProgress();
virtual bool hasSingleSecurityOrigin() const;
virtual bool didPassCORSAccessCheck() const;
virtual unsigned videoDecodedByteCount() const;
// VideoFrameProvider implementation.
- virtual void SetVideoFrameProviderClient(
- cc::VideoFrameProvider::Client* client) OVERRIDE;
- virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE;
- virtual void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame)
- OVERRIDE;
+ void SetVideoFrameProviderClient(
+ cc::VideoFrameProvider::Client* client) override;
+ scoped_refptr<media::VideoFrame> GetCurrentFrame() override;
+ void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame) override;
private:
// The callback for VideoFrameProvider to signal a new frame is available.
blink::WebTimeRanges buffered_;
+ float volume_;
+
// Used for DCHECKs to ensure methods calls executed in the correct thread.
base::ThreadChecker thread_checker_;
blink::WebMediaPlayerClient* client_;
- base::WeakPtr<WebMediaPlayerDelegate> delegate_;
-
- MediaStreamClient* media_stream_client_;
+ base::WeakPtr<media::WebMediaPlayerDelegate> delegate_;
// Specify content:: to disambiguate from cc::.
scoped_refptr<content::VideoFrameProvider> video_frame_provider_;
// |current_frame_| is updated only on main thread. The object it holds
// can be freed on the compositor thread if it is the last to hold a
- // reference but media::VideoFrame is a thread-safe ref-pointer.
+ // reference but media::VideoFrame is a thread-safe ref-pointer. It is
+ // however read on the compositing thread so locking is required around all
+ // modifications on the main thread, and all reads on the compositing thread.
scoped_refptr<media::VideoFrame> current_frame_;
// |current_frame_used_| is updated on both main and compositing thread.
// It's used to track whether |current_frame_| was painted for detecting
// when to increase |dropped_frame_count_|.
bool current_frame_used_;
+ // |current_frame_lock_| protects |current_frame_used_| and |current_frame_|.
base::Lock current_frame_lock_;
bool pending_repaint_;
- scoped_ptr<webkit::WebLayerImpl> video_weblayer_;
+ scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_;
// A pointer back to the compositor to inform it about state changes. This is
// not NULL while the compositor is actively using this webmediaplayer.
cc::VideoFrameProvider::Client* video_frame_provider_client_;
bool received_first_frame_;
- bool sequence_started_;
- base::TimeDelta start_time_;
+ base::TimeDelta current_time_;
unsigned total_frame_count_;
unsigned dropped_frame_count_;
media::SkCanvasVideoRenderer video_renderer_;
scoped_refptr<media::MediaLog> media_log_;
+ scoped_ptr<MediaStreamRendererFactory> renderer_factory_;
+
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS);
};