OLD | NEW |
---|---|
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 // Delegate calls from WebCore::MediaPlayerPrivate to Chrome's video player. | 5 // Delegate calls from WebCore::MediaPlayerPrivate to Chrome's video player. |
6 // It contains Pipeline which is the actual media player pipeline, it glues | 6 // It contains Pipeline which is the actual media player pipeline, it glues |
7 // the media player pipeline, data source, audio renderer and renderer. | 7 // the media player pipeline, data source, audio renderer and renderer. |
8 // Pipeline would creates multiple threads and access some public methods | 8 // Pipeline would creates multiple threads and access some public methods |
9 // of this class, so we need to be extra careful about concurrent access of | 9 // of this class, so we need to be extra careful about concurrent access of |
10 // methods and members. | 10 // methods and members. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 // Contains common logic used across the different types loading. | 223 // Contains common logic used across the different types loading. |
224 void LoadSetup(const WebKit::WebURL& url); | 224 void LoadSetup(const WebKit::WebURL& url); |
225 | 225 |
226 // Called after asynchronous initialization of a data source completed. | 226 // Called after asynchronous initialization of a data source completed. |
227 void DataSourceInitialized(const GURL& gurl, bool success); | 227 void DataSourceInitialized(const GURL& gurl, bool success); |
228 | 228 |
229 // Called when the data source is downloading or paused. | 229 // Called when the data source is downloading or paused. |
230 void NotifyDownloading(bool is_downloading); | 230 void NotifyDownloading(bool is_downloading); |
231 | 231 |
232 // Finishes starting the pipeline due to a call to load(). | 232 // Finishes starting the pipeline due to a call to load(). |
233 void StartPipeline(); | 233 // |
234 // A non-null |media_source| will construct a Media Source pipeline. | |
235 void StartPipeline(WebKit::WebMediaSource* media_source); | |
234 | 236 |
235 // Helpers that set the network/ready state and notifies the client if | 237 // Helpers that set the network/ready state and notifies the client if |
236 // they've changed. | 238 // they've changed. |
237 void SetNetworkState(WebKit::WebMediaPlayer::NetworkState state); | 239 void SetNetworkState(WebKit::WebMediaPlayer::NetworkState state); |
238 void SetReadyState(WebKit::WebMediaPlayer::ReadyState state); | 240 void SetReadyState(WebKit::WebMediaPlayer::ReadyState state); |
239 | 241 |
240 // Destroy resources held. | 242 // Destroy resources held. |
241 void Destroy(); | 243 void Destroy(); |
242 | 244 |
243 // Getter method to |client_|. | 245 // Getter method to |client_|. |
(...skipping 21 matching lines...) Expand all Loading... | |
265 // Gets the duration value reported by the pipeline. | 267 // Gets the duration value reported by the pipeline. |
266 double GetPipelineDuration() const; | 268 double GetPipelineDuration() const; |
267 | 269 |
268 // Notifies WebKit of the duration change. | 270 // Notifies WebKit of the duration change. |
269 void OnDurationChange(); | 271 void OnDurationChange(); |
270 | 272 |
271 // Called by VideoRendererBase on its internal thread with the new frame to be | 273 // Called by VideoRendererBase on its internal thread with the new frame to be |
272 // painted. | 274 // painted. |
273 void FrameReady(const scoped_refptr<media::VideoFrame>& frame); | 275 void FrameReady(const scoped_refptr<media::VideoFrame>& frame); |
274 | 276 |
275 // Builds a FilterCollection based on the current configuration of | |
276 // WebMediaPlayerImpl. | |
277 scoped_ptr<media::FilterCollection> BuildFilterCollection(); | |
278 | |
279 WebKit::WebFrame* frame_; | 277 WebKit::WebFrame* frame_; |
280 | 278 |
281 // TODO(hclam): get rid of these members and read from the pipeline directly. | 279 // TODO(hclam): get rid of these members and read from the pipeline directly. |
282 WebKit::WebMediaPlayer::NetworkState network_state_; | 280 WebKit::WebMediaPlayer::NetworkState network_state_; |
283 WebKit::WebMediaPlayer::ReadyState ready_state_; | 281 WebKit::WebMediaPlayer::ReadyState ready_state_; |
284 | 282 |
285 // Keep a list of buffered time ranges. | 283 // Keep a list of buffered time ranges. |
286 WebKit::WebTimeRanges buffered_; | 284 WebKit::WebTimeRanges buffered_; |
287 | 285 |
288 // Message loops for posting tasks on Chrome's main thread. Also used | 286 // Message loops for posting tasks on Chrome's main thread. Also used |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
343 | 341 |
344 // The decryptor that manages decryption keys and decrypts encrypted frames. | 342 // The decryptor that manages decryption keys and decrypts encrypted frames. |
345 scoped_ptr<ProxyDecryptor> decryptor_; | 343 scoped_ptr<ProxyDecryptor> decryptor_; |
346 | 344 |
347 bool starting_; | 345 bool starting_; |
348 | 346 |
349 // These two are mutually exclusive: | 347 // These two are mutually exclusive: |
350 // |data_source_| is used for regular resource loads. | 348 // |data_source_| is used for regular resource loads. |
351 // |chunk_demuxer_| is used for Media Source resource loads. | 349 // |chunk_demuxer_| is used for Media Source resource loads. |
352 scoped_refptr<BufferedDataSource> data_source_; | 350 scoped_refptr<BufferedDataSource> data_source_; |
353 scoped_refptr<media::ChunkDemuxer> chunk_demuxer_; | 351 media::ChunkDemuxer* chunk_demuxer_; // Owned by |pipeline_|. |
scherkus (not reviewing)
2013/04/17 17:21:59
is there a UAF bug here if pipeline hits an error?
acolwell GONE FROM CHROMIUM
2013/04/17 20:24:53
Yes. This is accessed from the renderer thread and
| |
354 | 352 |
355 // Temporary for EME v0.1. In the future the init data type should be passed | 353 // Temporary for EME v0.1. In the future the init data type should be passed |
356 // through GenerateKeyRequest() directly from WebKit. | 354 // through GenerateKeyRequest() directly from WebKit. |
357 std::string init_data_type_; | 355 std::string init_data_type_; |
358 | 356 |
359 // Video frame rendering members. | 357 // Video frame rendering members. |
360 // | 358 // |
361 // |lock_| protects |current_frame_| since new frames arrive on the video | 359 // |lock_| protects |current_frame_| since new frames arrive on the video |
362 // rendering thread, yet are accessed for rendering on either the main thread | 360 // rendering thread, yet are accessed for rendering on either the main thread |
363 // or compositing thread depending on whether accelerated compositing is used. | 361 // or compositing thread depending on whether accelerated compositing is used. |
364 base::Lock lock_; | 362 base::Lock lock_; |
365 media::SkCanvasVideoRenderer skcanvas_video_renderer_; | 363 media::SkCanvasVideoRenderer skcanvas_video_renderer_; |
366 scoped_refptr<media::VideoFrame> current_frame_; | 364 scoped_refptr<media::VideoFrame> current_frame_; |
367 bool pending_repaint_; | 365 bool pending_repaint_; |
368 | 366 |
369 // The compositor layer for displaying the video content when using composited | 367 // The compositor layer for displaying the video content when using composited |
370 // playback. | 368 // playback. |
371 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; | 369 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; |
372 | 370 |
373 // A pointer back to the compositor to inform it about state changes. This is | 371 // A pointer back to the compositor to inform it about state changes. This is |
374 // not NULL while the compositor is actively using this webmediaplayer. | 372 // not NULL while the compositor is actively using this webmediaplayer. |
375 cc::VideoFrameProvider::Client* video_frame_provider_client_; | 373 cc::VideoFrameProvider::Client* video_frame_provider_client_; |
376 | 374 |
377 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 375 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
378 }; | 376 }; |
379 | 377 |
380 } // namespace webkit_media | 378 } // namespace webkit_media |
381 | 379 |
382 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 380 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |