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. |
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_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 20 #ifndef WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
21 #define WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 21 #define WEBKIT_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 "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
30 #include "media/base/audio_renderer_sink.h" | 31 #include "media/base/audio_renderer_sink.h" |
31 #include "media/base/decryptor.h" | 32 #include "media/base/decryptor.h" |
32 #include "media/base/pipeline.h" | 33 #include "media/base/pipeline.h" |
33 #include "media/filters/skcanvas_video_renderer.h" | 34 #include "media/filters/skcanvas_video_renderer.h" |
34 #include "skia/ext/platform_canvas.h" | 35 #include "skia/ext/platform_canvas.h" |
35 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" | 36 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" |
36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide r.h" | 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide r.h" |
37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" | 38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayer.h" |
38 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" | 39 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient. h" |
39 #include "webkit/media/crypto/key_systems.h" | 40 #include "webkit/media/crypto/key_systems.h" |
40 #include "webkit/media/crypto/proxy_decryptor.h" | 41 #include "webkit/media/crypto/proxy_decryptor.h" |
41 | 42 |
42 class RenderAudioSourceProvider; | 43 class RenderAudioSourceProvider; |
43 | 44 |
44 namespace WebKit { | 45 namespace WebKit { |
45 class WebFrame; | 46 class WebFrame; |
46 } | 47 } |
47 | 48 |
48 namespace base { | 49 namespace base { |
49 class MessageLoopProxy; | 50 class MessageLoopProxy; |
50 } | 51 } |
51 | 52 |
52 namespace media { | 53 namespace media { |
53 class ChunkDemuxer; | 54 class ChunkDemuxer; |
54 class MediaLog; | 55 class MediaLog; |
55 } | 56 } |
56 | 57 |
58 namespace webkit { | |
59 class WebLayerImpl; | |
60 } | |
61 | |
57 namespace webkit_media { | 62 namespace webkit_media { |
58 | 63 |
59 class BufferedDataSource; | 64 class BufferedDataSource; |
60 class MediaStreamClient; | 65 class MediaStreamClient; |
61 class WebAudioSourceProviderImpl; | 66 class WebAudioSourceProviderImpl; |
62 class WebMediaPlayerDelegate; | 67 class WebMediaPlayerDelegate; |
63 class WebMediaPlayerParams; | 68 class WebMediaPlayerParams; |
64 | 69 |
65 class WebMediaPlayerImpl | 70 class WebMediaPlayerImpl |
66 : public WebKit::WebMediaPlayer, | 71 : public WebKit::WebMediaPlayer, |
72 public cc::VideoFrameProvider, | |
67 public MessageLoop::DestructionObserver, | 73 public MessageLoop::DestructionObserver, |
68 public base::SupportsWeakPtr<WebMediaPlayerImpl> { | 74 public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
69 public: | 75 public: |
70 // Constructs a WebMediaPlayer implementation using Chromium's media stack. | 76 // Constructs a WebMediaPlayer implementation using Chromium's media stack. |
71 // | 77 // |
72 // |delegate| may be null. | 78 // |delegate| may be null. |
73 WebMediaPlayerImpl( | 79 WebMediaPlayerImpl( |
74 WebKit::WebFrame* frame, | 80 WebKit::WebFrame* frame, |
75 WebKit::WebMediaPlayerClient* client, | 81 WebKit::WebMediaPlayerClient* client, |
76 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 82 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 virtual bool didPassCORSAccessCheck() const; | 140 virtual bool didPassCORSAccessCheck() const; |
135 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const; | 141 virtual WebKit::WebMediaPlayer::MovieLoadType movieLoadType() const; |
136 | 142 |
137 virtual float mediaTimeForTimeValue(float timeValue) const; | 143 virtual float mediaTimeForTimeValue(float timeValue) const; |
138 | 144 |
139 virtual unsigned decodedFrameCount() const; | 145 virtual unsigned decodedFrameCount() const; |
140 virtual unsigned droppedFrameCount() const; | 146 virtual unsigned droppedFrameCount() const; |
141 virtual unsigned audioDecodedByteCount() const; | 147 virtual unsigned audioDecodedByteCount() const; |
142 virtual unsigned videoDecodedByteCount() const; | 148 virtual unsigned videoDecodedByteCount() const; |
143 | 149 |
144 virtual WebKit::WebVideoFrame* getCurrentFrame(); | 150 // cc::VideoFrameProvider implementation. |
145 virtual void putCurrentFrame(WebKit::WebVideoFrame* web_video_frame); | 151 virtual void SetVideoFrameProviderClient( |
152 cc::VideoFrameProvider::Client* client) OVERRIDE; | |
153 virtual scoped_refptr<media::VideoFrame> GetCurrentFrame() OVERRIDE; | |
154 virtual void PutCurrentFrame(const scoped_refptr<media::VideoFrame>& frame) | |
155 OVERRIDE; | |
146 | 156 |
147 virtual bool copyVideoTextureToPlatformTexture( | 157 virtual bool copyVideoTextureToPlatformTexture( |
148 WebKit::WebGraphicsContext3D* web_graphics_context, | 158 WebKit::WebGraphicsContext3D* web_graphics_context, |
149 unsigned int texture, | 159 unsigned int texture, |
150 unsigned int level, | 160 unsigned int level, |
151 unsigned int internal_format, | 161 unsigned int internal_format, |
152 bool premultiply_alpha, | 162 bool premultiply_alpha, |
153 bool flip_y); | 163 bool flip_y); |
154 | 164 |
155 virtual WebKit::WebAudioSourceProvider* audioSourceProvider(); | 165 virtual WebKit::WebAudioSourceProvider* audioSourceProvider(); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 // Video frame rendering members. | 344 // Video frame rendering members. |
335 // | 345 // |
336 // |lock_| protects |current_frame_| since new frames arrive on the video | 346 // |lock_| protects |current_frame_| since new frames arrive on the video |
337 // rendering thread, yet are accessed for rendering on either the main thread | 347 // rendering thread, yet are accessed for rendering on either the main thread |
338 // or compositing thread depending on whether accelerated compositing is used. | 348 // or compositing thread depending on whether accelerated compositing is used. |
339 base::Lock lock_; | 349 base::Lock lock_; |
340 media::SkCanvasVideoRenderer skcanvas_video_renderer_; | 350 media::SkCanvasVideoRenderer skcanvas_video_renderer_; |
341 scoped_refptr<media::VideoFrame> current_frame_; | 351 scoped_refptr<media::VideoFrame> current_frame_; |
342 bool pending_repaint_; | 352 bool pending_repaint_; |
343 | 353 |
354 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; | |
355 | |
356 cc::VideoFrameProvider::Client* video_frame_provider_client_; | |
jamesr
2013/03/21 00:59:11
could use some member comments here - at least ind
danakj
2013/03/21 03:05:26
Done.
| |
357 | |
344 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 358 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
345 }; | 359 }; |
346 | 360 |
347 } // namespace webkit_media | 361 } // namespace webkit_media |
348 | 362 |
349 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 363 #endif // WEBKIT_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |