Chromium Code Reviews| 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 CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 20 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
| 21 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 21 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
| 22 | 22 |
| 23 #include <map> | |
| 23 #include <string> | 24 #include <string> |
| 24 #include <vector> | 25 #include <vector> |
| 25 | 26 |
| 26 #include "base/basictypes.h" | 27 #include "base/basictypes.h" |
| 27 #include "base/memory/ref_counted.h" | 28 #include "base/memory/ref_counted.h" |
| 28 #include "base/memory/scoped_ptr.h" | 29 #include "base/memory/scoped_ptr.h" |
| 29 #include "base/memory/weak_ptr.h" | 30 #include "base/memory/weak_ptr.h" |
| 30 #include "base/threading/thread.h" | 31 #include "base/threading/thread.h" |
| 31 #include "cc/layers/video_frame_provider.h" | 32 #include "cc/layers/video_frame_provider.h" |
| 32 #include "content/renderer/media/crypto/proxy_decryptor.h" | 33 #include "content/renderer/media/crypto/proxy_decryptor.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 51 | 52 |
| 52 namespace base { | 53 namespace base { |
| 53 class MessageLoopProxy; | 54 class MessageLoopProxy; |
| 54 } | 55 } |
| 55 | 56 |
| 56 namespace media { | 57 namespace media { |
| 57 class ChunkDemuxer; | 58 class ChunkDemuxer; |
| 58 class FFmpegDemuxer; | 59 class FFmpegDemuxer; |
| 59 class GpuVideoAcceleratorFactories; | 60 class GpuVideoAcceleratorFactories; |
| 60 class MediaLog; | 61 class MediaLog; |
| 62 class TextBuffer; | |
| 61 } | 63 } |
| 62 | 64 |
| 63 namespace webkit { | 65 namespace webkit { |
| 64 class WebLayerImpl; | 66 class WebLayerImpl; |
| 65 } | 67 } |
| 66 | 68 |
| 67 namespace content { | 69 namespace content { |
| 68 class BufferedDataSource; | 70 class BufferedDataSource; |
| 69 class WebAudioSourceProviderImpl; | 71 class WebAudioSourceProviderImpl; |
| 70 class WebMediaPlayerDelegate; | 72 class WebMediaPlayerDelegate; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 int system_code); | 195 int system_code); |
| 194 void OnKeyMessage(const std::string& session_id, | 196 void OnKeyMessage(const std::string& session_id, |
| 195 const std::vector<uint8>& message, | 197 const std::vector<uint8>& message, |
| 196 const std::string& default_url); | 198 const std::string& default_url); |
| 197 void OnNeedKey(const std::string& type, | 199 void OnNeedKey(const std::string& type, |
| 198 const std::string& session_id, | 200 const std::string& session_id, |
| 199 const std::vector<uint8>& init_data); | 201 const std::vector<uint8>& init_data); |
| 200 scoped_ptr<media::TextTrack> OnTextTrack(media::TextKind kind, | 202 scoped_ptr<media::TextTrack> OnTextTrack(media::TextKind kind, |
| 201 const std::string& label, | 203 const std::string& label, |
| 202 const std::string& language); | 204 const std::string& language); |
| 205 void OnFFmpegTextTrack(media::TextKind kind, | |
|
acolwell GONE FROM CHROMIUM
2013/09/12 00:15:15
A separate method should not be needed for FFmpegD
Matthew Heaney (Chromium)
2013/09/13 19:51:54
Agreed. I'm thinking I should make the DemuxerHos
Matthew Heaney (Chromium)
2013/09/20 23:53:54
I haven't touched the ChunkDemuxer yet. I just wa
| |
| 206 const std::string& label, | |
| 207 const std::string& language, | |
| 208 int index); | |
| 203 void SetOpaque(bool); | 209 void SetOpaque(bool); |
| 204 | 210 |
| 205 private: | 211 private: |
| 206 // Called after |defer_load_cb_| has decided to allow the load. If | 212 // Called after |defer_load_cb_| has decided to allow the load. If |
| 207 // |defer_load_cb_| is null this is called immediately. | 213 // |defer_load_cb_| is null this is called immediately. |
| 208 void DoLoad(LoadType load_type, | 214 void DoLoad(LoadType load_type, |
| 209 const WebKit::WebURL& url, | 215 const WebKit::WebURL& url, |
| 210 CORSMode cors_mode); | 216 CORSMode cors_mode); |
| 211 | 217 |
| 212 // Called after asynchronous initialization of a data source completed. | 218 // Called after asynchronous initialization of a data source completed. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 // Gets the duration value reported by the pipeline. | 257 // Gets the duration value reported by the pipeline. |
| 252 double GetPipelineDuration() const; | 258 double GetPipelineDuration() const; |
| 253 | 259 |
| 254 // Notifies WebKit of the duration change. | 260 // Notifies WebKit of the duration change. |
| 255 void OnDurationChange(); | 261 void OnDurationChange(); |
| 256 | 262 |
| 257 // Called by VideoRendererBase on its internal thread with the new frame to be | 263 // Called by VideoRendererBase on its internal thread with the new frame to be |
| 258 // painted. | 264 // painted. |
| 259 void FrameReady(const scoped_refptr<media::VideoFrame>& frame); | 265 void FrameReady(const scoped_refptr<media::VideoFrame>& frame); |
| 260 | 266 |
| 267 // Called by TextRendererImpl when a decoded cue has been delivered on the | |
| 268 // text stream having the given |index|, and hence can be added to the | |
| 269 // cue list for this text track. | |
| 270 void CueReady(int index, const scoped_refptr<media::TextBuffer>& cue); | |
| 271 | |
| 261 WebKit::WebFrame* frame_; | 272 WebKit::WebFrame* frame_; |
| 262 | 273 |
| 263 // TODO(hclam): get rid of these members and read from the pipeline directly. | 274 // TODO(hclam): get rid of these members and read from the pipeline directly. |
| 264 WebKit::WebMediaPlayer::NetworkState network_state_; | 275 WebKit::WebMediaPlayer::NetworkState network_state_; |
| 265 WebKit::WebMediaPlayer::ReadyState ready_state_; | 276 WebKit::WebMediaPlayer::ReadyState ready_state_; |
| 266 | 277 |
| 267 // Keep a list of buffered time ranges. | 278 // Keep a list of buffered time ranges. |
| 268 WebKit::WebTimeRanges buffered_; | 279 WebKit::WebTimeRanges buffered_; |
| 269 | 280 |
| 270 // Message loops for posting tasks on Chrome's main thread. Also used | 281 // Message loops for posting tasks on Chrome's main thread. Also used |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 // playback. | 371 // playback. |
| 361 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; | 372 scoped_ptr<webkit::WebLayerImpl> video_weblayer_; |
| 362 | 373 |
| 363 // A pointer back to the compositor to inform it about state changes. This is | 374 // A pointer back to the compositor to inform it about state changes. This is |
| 364 // not NULL while the compositor is actively using this webmediaplayer. | 375 // not NULL while the compositor is actively using this webmediaplayer. |
| 365 cc::VideoFrameProvider::Client* video_frame_provider_client_; | 376 cc::VideoFrameProvider::Client* video_frame_provider_client_; |
| 366 | 377 |
| 367 // Text track objects get a unique index value when they're created. | 378 // Text track objects get a unique index value when they're created. |
| 368 int text_track_index_; | 379 int text_track_index_; |
| 369 | 380 |
| 381 // Text track objects for the FFmpeg-based pipeline. | |
| 382 typedef std::map<int, media::TextTrack*> TextTrackMap; | |
| 383 TextTrackMap ffmpeg_text_track_map_; | |
|
acolwell GONE FROM CHROMIUM
2013/09/12 00:15:15
The ChunkDemuxer didn't need this map here. Why do
Matthew Heaney (Chromium)
2013/09/13 19:51:54
I was having some trouble getting the callback mec
Matthew Heaney (Chromium)
2013/09/20 23:53:54
As it turns out, creating a TextTrack(Impl) object
| |
| 384 | |
| 370 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 385 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
| 371 }; | 386 }; |
| 372 | 387 |
| 373 } // namespace content | 388 } // namespace content |
| 374 | 389 |
| 375 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 390 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
| OLD | NEW |