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

Side by Side Diff: webkit/media/webmediaplayer_ms.h

Issue 12902002: Remove WebVideoFrame, WebVideoFrameProvider, and WebVideoLayer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_ 5 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_
6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_ 6 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "cc/layers/video_frame_provider.h"
12 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
13 #include "media/filters/skcanvas_video_renderer.h" 14 #include "media/filters/skcanvas_video_renderer.h"
14 #include "skia/ext/platform_canvas.h" 15 #include "skia/ext/platform_canvas.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebStreamTextureClien t.h"
16 18
17 namespace WebKit { 19 namespace WebKit {
18 class WebFrame; 20 class WebFrame;
19 class WebMediaPlayerClient; 21 class WebMediaPlayerClient;
20 class WebVideoFrame; 22 class WebVideoFrame;
21 } 23 }
22 24
23 namespace media { 25 namespace media {
24 class MediaLog; 26 class MediaLog;
25 } 27 }
(...skipping 14 matching lines...) Expand all
40 // provides video frames for rendering. 42 // provides video frames for rendering.
41 // 43 //
42 // TODO(wjia): add AudioPlayer. 44 // TODO(wjia): add AudioPlayer.
43 // AudioPlayer 45 // AudioPlayer
44 // plays audio streams. 46 // plays audio streams.
45 // 47 //
46 // WebKit::WebMediaPlayerClient 48 // WebKit::WebMediaPlayerClient
47 // WebKit client of this media player object. 49 // WebKit client of this media player object.
48 class WebMediaPlayerMS 50 class WebMediaPlayerMS
49 : public WebKit::WebMediaPlayer, 51 : public WebKit::WebMediaPlayer,
52 public cc::VideoFrameProvider,
53 public WebKit::WebStreamTextureClient,
50 public base::SupportsWeakPtr<WebMediaPlayerMS> { 54 public base::SupportsWeakPtr<WebMediaPlayerMS> {
51 public: 55 public:
52 // Construct a WebMediaPlayerMS with reference to the client, and 56 // Construct a WebMediaPlayerMS with reference to the client, and
53 // a MediaStreamClient which provides VideoFrameProvider. 57 // a MediaStreamClient which provides VideoFrameProvider.
54 WebMediaPlayerMS(WebKit::WebFrame* frame, 58 WebMediaPlayerMS(WebKit::WebFrame* frame,
55 WebKit::WebMediaPlayerClient* client, 59 WebKit::WebMediaPlayerClient* client,
56 base::WeakPtr<WebMediaPlayerDelegate> delegate, 60 base::WeakPtr<WebMediaPlayerDelegate> delegate,
57 MediaStreamClient* media_stream_client, 61 MediaStreamClient* media_stream_client,
58 media::MediaLog* media_log); 62 media::MediaLog* media_log);
59 virtual ~WebMediaPlayerMS(); 63 virtual ~WebMediaPlayerMS();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 virtual bool didPassCORSAccessCheck() const OVERRIDE; 117 virtual bool didPassCORSAccessCheck() const OVERRIDE;
114 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const OVERRIDE; 118 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const OVERRIDE;
115 119
116 virtual float mediaTimeForTimeValue(float timeValue) const OVERRIDE; 120 virtual float mediaTimeForTimeValue(float timeValue) const OVERRIDE;
117 121
118 virtual unsigned decodedFrameCount() const OVERRIDE; 122 virtual unsigned decodedFrameCount() const OVERRIDE;
119 virtual unsigned droppedFrameCount() const OVERRIDE; 123 virtual unsigned droppedFrameCount() const OVERRIDE;
120 virtual unsigned audioDecodedByteCount() const OVERRIDE; 124 virtual unsigned audioDecodedByteCount() const OVERRIDE;
121 virtual unsigned videoDecodedByteCount() const OVERRIDE; 125 virtual unsigned videoDecodedByteCount() const OVERRIDE;
122 126
123 virtual WebKit::WebVideoFrame* getCurrentFrame() OVERRIDE; 127 virtual WebKit::WebLayer* createCompositingLayer();
124 virtual void putCurrentFrame(WebKit::WebVideoFrame* web_video_frame) OVERRIDE; 128
129 // VideoFrameProvider imlpementation.
130 virtual void SetVideoFrameProviderClient(
131 cc::VideoFrameProvider::Client* client) OVERRIDE;
132 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE;
133 virtual void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame)
134 OVERRIDE;
135
136 // WebStreamTextureClient implementation.
137 virtual void didReceiveFrame();
138 virtual void didUpdateMatrix(const float* matrix);
125 139
126 private: 140 private:
127 // The callback for VideoFrameProvider to signal a new frame is available. 141 // The callback for VideoFrameProvider to signal a new frame is available.
128 void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame); 142 void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame);
129 // Need repaint due to state change. 143 // Need repaint due to state change.
130 void RepaintInternal(); 144 void RepaintInternal();
131 145
132 // The callback for source to report error. 146 // The callback for source to report error.
133 void OnSourceError(); 147 void OnSourceError();
134 148
(...skipping 13 matching lines...) Expand all
148 WebKit::WebTimeRanges buffered_; 162 WebKit::WebTimeRanges buffered_;
149 163
150 // Used for DCHECKs to ensure methods calls executed in the correct thread. 164 // Used for DCHECKs to ensure methods calls executed in the correct thread.
151 base::ThreadChecker thread_checker_; 165 base::ThreadChecker thread_checker_;
152 166
153 WebKit::WebMediaPlayerClient* client_; 167 WebKit::WebMediaPlayerClient* client_;
154 168
155 base::WeakPtr<WebMediaPlayerDelegate> delegate_; 169 base::WeakPtr<WebMediaPlayerDelegate> delegate_;
156 170
157 MediaStreamClient* media_stream_client_; 171 MediaStreamClient* media_stream_client_;
158 scoped_refptr<VideoFrameProvider> video_frame_provider_; 172 scoped_refptr<webkit_media::VideoFrameProvider> video_frame_provider_;
159 bool paused_; 173 bool paused_;
174
175 base::Lock current_frame_lock_;
160 // |current_frame_| is updated only on main thread. 176 // |current_frame_| is updated only on main thread.
161 scoped_refptr<media::VideoFrame> current_frame_; 177 scoped_refptr<media::VideoFrame> current_frame_;
162 // |current_frame_used_| is updated on both main and compositing thread. 178 // |current_frame_used_| is updated on both main and compositing thread.
163 // It's used to track whether |current_frame_| was painted for detecting 179 // It's used to track whether |current_frame_| was painted for detecting
164 // when to increase |dropped_frame_count_|. 180 // when to increase |dropped_frame_count_|.
165 bool current_frame_used_; 181 bool current_frame_used_;
166 base::Lock current_frame_lock_;
167 bool pending_repaint_; 182 bool pending_repaint_;
183
184 base::Lock provider_lock_;
185 cc::VideoFrameProvider::Client* video_frame_provider_client_;
186
168 bool received_first_frame_; 187 bool received_first_frame_;
169 bool sequence_started_; 188 bool sequence_started_;
170 base::TimeDelta start_time_; 189 base::TimeDelta start_time_;
171 unsigned total_frame_count_; 190 unsigned total_frame_count_;
172 unsigned dropped_frame_count_; 191 unsigned dropped_frame_count_;
173 media::SkCanvasVideoRenderer video_renderer_; 192 media::SkCanvasVideoRenderer video_renderer_;
174 193
175 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; 194 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_;
176 195
177 scoped_refptr<media::MediaLog> media_log_; 196 scoped_refptr<media::MediaLog> media_log_;
178 197
179 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); 198 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS);
180 }; 199 };
181 200
182 } // namespace webkit_media 201 } // namespace webkit_media
183 202
184 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_ 203 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_MS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698