OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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. |
11 // | 11 // |
12 // Other issues: | 12 // Other issues: |
13 // During tear down of the whole browser or a tab, the DOM tree may not be | 13 // During tear down of the whole browser or a tab, the DOM tree may not be |
14 // destructed nicely, and there will be some dangling media threads trying to | 14 // destructed nicely, and there will be some dangling media threads trying to |
15 // the main thread, so we need this class to listen to destruction event of the | 15 // the main thread, so we need this class to listen to destruction event of the |
16 // main thread and cleanup the media threads when the even is received. Also | 16 // main thread and cleanup the media threads when the even is received. Also |
17 // at destruction of this class we will need to unhook it from destruction event | 17 // at destruction of this class we will need to unhook it from destruction event |
18 // list of the main thread. | 18 // list of the main thread. |
19 | 19 |
20 #ifndef WEBKIT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 20 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
21 #define WEBKIT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 21 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
22 | 22 |
23 #include <string> | 23 #include <string> |
24 | 24 |
25 #include "base/memory/ref_counted.h" | 25 #include "base/memory/ref_counted.h" |
26 #include "base/memory/scoped_ptr.h" | 26 #include "base/memory/scoped_ptr.h" |
27 #include "base/memory/weak_ptr.h" | 27 #include "base/memory/weak_ptr.h" |
28 #include "base/threading/thread.h" | 28 #include "base/threading/thread.h" |
29 #include "cc/layers/video_frame_provider.h" | 29 #include "cc/layers/video_frame_provider.h" |
| 30 #include "content/common/content_export.h" |
30 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
31 #include "media/base/audio_renderer_sink.h" | 32 #include "media/base/audio_renderer_sink.h" |
32 #include "media/base/decryptor.h" | 33 #include "media/base/decryptor.h" |
33 #include "media/base/media_keys.h" | 34 #include "media/base/media_keys.h" |
34 #include "media/base/pipeline.h" | 35 #include "media/base/pipeline.h" |
35 #include "media/base/text_track.h" | 36 #include "media/base/text_track.h" |
36 #include "media/filters/gpu_video_decoder.h" | 37 #include "media/filters/gpu_video_decoder.h" |
37 #include "media/filters/skcanvas_video_renderer.h" | 38 #include "media/filters/skcanvas_video_renderer.h" |
38 #include "skia/ext/platform_canvas.h" | 39 #include "skia/ext/platform_canvas.h" |
39 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 40 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
(...skipping 15 matching lines...) Expand all Loading... |
55 namespace media { | 56 namespace media { |
56 class ChunkDemuxer; | 57 class ChunkDemuxer; |
57 class FFmpegDemuxer; | 58 class FFmpegDemuxer; |
58 class MediaLog; | 59 class MediaLog; |
59 } | 60 } |
60 | 61 |
61 namespace webkit { | 62 namespace webkit { |
62 class WebLayerImpl; | 63 class WebLayerImpl; |
63 } | 64 } |
64 | 65 |
65 namespace webkit_media { | 66 namespace content { |
66 | |
67 class BufferedDataSource; | 67 class BufferedDataSource; |
68 class MediaStreamClient; | 68 class MediaStreamClient; |
69 class WebAudioSourceProviderImpl; | 69 class WebAudioSourceProviderImpl; |
| 70 class WebTextTrackImpl; |
| 71 } |
| 72 |
| 73 namespace content { |
70 class WebMediaPlayerDelegate; | 74 class WebMediaPlayerDelegate; |
71 class WebMediaPlayerParams; | 75 class WebMediaPlayerParams; |
72 class WebTextTrackImpl; | |
73 | 76 |
74 class WebMediaPlayerImpl | 77 class CONTENT_EXPORT WebMediaPlayerImpl |
75 : public WebKit::WebMediaPlayer, | 78 : public WebKit::WebMediaPlayer, |
76 public cc::VideoFrameProvider, | 79 public cc::VideoFrameProvider, |
77 public base::MessageLoop::DestructionObserver, | 80 public base::MessageLoop::DestructionObserver, |
78 public base::SupportsWeakPtr<WebMediaPlayerImpl> { | 81 public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
79 public: | 82 public: |
80 // Constructs a WebMediaPlayer implementation using Chromium's media stack. | 83 // Constructs a WebMediaPlayer implementation using Chromium's media stack. |
81 // | 84 // |
82 // |delegate| may be null. | 85 // |delegate| may be null. |
83 WebMediaPlayerImpl( | 86 WebMediaPlayerImpl( |
84 WebKit::WebFrame* frame, | 87 WebKit::WebFrame* frame, |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 301 |
299 // Seek gets pending if another seek is in progress. Only last pending seek | 302 // Seek gets pending if another seek is in progress. Only last pending seek |
300 // will have effect. | 303 // will have effect. |
301 bool pending_seek_; | 304 bool pending_seek_; |
302 double pending_seek_seconds_; | 305 double pending_seek_seconds_; |
303 | 306 |
304 WebKit::WebMediaPlayerClient* client_; | 307 WebKit::WebMediaPlayerClient* client_; |
305 | 308 |
306 base::WeakPtr<WebMediaPlayerDelegate> delegate_; | 309 base::WeakPtr<WebMediaPlayerDelegate> delegate_; |
307 | 310 |
308 MediaStreamClient* media_stream_client_; | |
309 | |
310 scoped_refptr<media::MediaLog> media_log_; | 311 scoped_refptr<media::MediaLog> media_log_; |
311 | 312 |
312 // Since accelerated compositing status is only known after the first layout, | 313 // Since accelerated compositing status is only known after the first layout, |
313 // we delay reporting it to UMA until that time. | 314 // we delay reporting it to UMA until that time. |
314 bool accelerated_compositing_reported_; | 315 bool accelerated_compositing_reported_; |
315 | 316 |
316 bool incremented_externally_allocated_memory_; | 317 bool incremented_externally_allocated_memory_; |
317 | 318 |
318 // Factories for supporting GpuVideoDecoder. May be null. | 319 // Factories for supporting GpuVideoDecoder. May be null. |
319 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories_; | 320 scoped_refptr<media::GpuVideoDecoder::Factories> gpu_factories_; |
320 | 321 |
321 // Routes audio playback to either AudioRendererSink or WebAudio. | 322 // Routes audio playback to either AudioRendererSink or WebAudio. |
322 scoped_refptr<WebAudioSourceProviderImpl> audio_source_provider_; | 323 scoped_refptr<WebAudioSourceProviderImpl> audio_source_provider_; |
323 | 324 |
324 bool is_local_source_; | 325 bool is_local_source_; |
325 bool supports_save_; | 326 bool supports_save_; |
326 | 327 |
327 // The decryptor that manages decryption keys and decrypts encrypted frames. | 328 // The decryptor that manages decryption keys and decrypts encrypted frames. |
328 scoped_ptr<ProxyDecryptor> decryptor_; | 329 scoped_ptr<webkit_media::ProxyDecryptor> decryptor_; |
329 | 330 |
330 bool starting_; | 331 bool starting_; |
331 | 332 |
332 // These two are mutually exclusive: | 333 // These two are mutually exclusive: |
333 // |data_source_| is used for regular resource loads. | 334 // |data_source_| is used for regular resource loads. |
334 // |chunk_demuxer_| is used for Media Source resource loads. | 335 // |chunk_demuxer_| is used for Media Source resource loads. |
335 // | 336 // |
336 // |demuxer_| will contain the appropriate demuxer based on which resource | 337 // |demuxer_| will contain the appropriate demuxer based on which resource |
337 // load strategy we're using. | 338 // load strategy we're using. |
338 scoped_ptr<BufferedDataSource> data_source_; | 339 scoped_ptr<BufferedDataSource> data_source_; |
(...skipping 22 matching lines...) Expand all Loading... |
361 // A pointer back to the compositor to inform it about state changes. This is | 362 // A pointer back to the compositor to inform it about state changes. This is |
362 // not NULL while the compositor is actively using this webmediaplayer. | 363 // not NULL while the compositor is actively using this webmediaplayer. |
363 cc::VideoFrameProvider::Client* video_frame_provider_client_; | 364 cc::VideoFrameProvider::Client* video_frame_provider_client_; |
364 | 365 |
365 // Text track objects get a unique index value when they're created. | 366 // Text track objects get a unique index value when they're created. |
366 int text_track_index_; | 367 int text_track_index_; |
367 | 368 |
368 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 369 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
369 }; | 370 }; |
370 | 371 |
371 } // namespace webkit_media | 372 } // namespace content |
372 | 373 |
373 #endif // WEBKIT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 374 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |