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 #include "content/renderer/media/webmediaplayer_impl.h" | 5 #include "content/renderer/media/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "media/filters/audio_renderer_impl.h" | 43 #include "media/filters/audio_renderer_impl.h" |
| 44 #include "media/filters/chunk_demuxer.h" | 44 #include "media/filters/chunk_demuxer.h" |
| 45 #include "media/filters/ffmpeg_audio_decoder.h" | 45 #include "media/filters/ffmpeg_audio_decoder.h" |
| 46 #include "media/filters/ffmpeg_demuxer.h" | 46 #include "media/filters/ffmpeg_demuxer.h" |
| 47 #include "media/filters/ffmpeg_video_decoder.h" | 47 #include "media/filters/ffmpeg_video_decoder.h" |
| 48 #include "media/filters/gpu_video_accelerator_factories.h" | 48 #include "media/filters/gpu_video_accelerator_factories.h" |
| 49 #include "media/filters/gpu_video_decoder.h" | 49 #include "media/filters/gpu_video_decoder.h" |
| 50 #include "media/filters/opus_audio_decoder.h" | 50 #include "media/filters/opus_audio_decoder.h" |
| 51 #include "media/filters/video_renderer_impl.h" | 51 #include "media/filters/video_renderer_impl.h" |
| 52 #include "media/filters/vpx_video_decoder.h" | 52 #include "media/filters/vpx_video_decoder.h" |
| 53 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" | |
| 53 #include "third_party/WebKit/public/platform/WebMediaSource.h" | 54 #include "third_party/WebKit/public/platform/WebMediaSource.h" |
| 54 #include "third_party/WebKit/public/platform/WebRect.h" | 55 #include "third_party/WebKit/public/platform/WebRect.h" |
| 55 #include "third_party/WebKit/public/platform/WebSize.h" | 56 #include "third_party/WebKit/public/platform/WebSize.h" |
| 56 #include "third_party/WebKit/public/platform/WebString.h" | 57 #include "third_party/WebKit/public/platform/WebString.h" |
| 57 #include "third_party/WebKit/public/platform/WebURL.h" | 58 #include "third_party/WebKit/public/platform/WebURL.h" |
| 58 #include "third_party/WebKit/public/web/WebDocument.h" | 59 #include "third_party/WebKit/public/web/WebDocument.h" |
| 59 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 60 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 60 #include "third_party/WebKit/public/web/WebView.h" | 61 #include "third_party/WebKit/public/web/WebView.h" |
| 61 #include "v8/include/v8.h" | 62 #include "v8/include/v8.h" |
| 62 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 63 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 frames_dropped_before_paint_(0), | 162 frames_dropped_before_paint_(0), |
| 162 pending_repaint_(false), | 163 pending_repaint_(false), |
| 163 pending_size_change_(false), | 164 pending_size_change_(false), |
| 164 video_frame_provider_client_(NULL), | 165 video_frame_provider_client_(NULL), |
| 165 text_track_index_(0) { | 166 text_track_index_(0) { |
| 166 media_log_->AddEvent( | 167 media_log_->AddEvent( |
| 167 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); | 168 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); |
| 168 | 169 |
| 169 pipeline_.reset(new media::Pipeline(media_loop_, media_log_.get())); | 170 pipeline_.reset(new media::Pipeline(media_loop_, media_log_.get())); |
| 170 | 171 |
| 172 // Grab a copy of the current CDM. This may be updated at any time by calls | |
|
ddorwin
2013/12/18 23:47:35
It's not really a copy.
| |
| 173 // to mediaKeysChanged(). | |
| 174 cdm_ = client_->getWebContentDecryptionModule(); | |
|
ddorwin
2013/12/18 23:47:35
A WebContentDecryptionModule is not that interesti
ddorwin
2013/12/19 00:26:27
I don't think this is the right time to set cdm_ (
| |
| 175 | |
| 171 // |gpu_factories_| requires that its entry points be called on its | 176 // |gpu_factories_| requires that its entry points be called on its |
| 172 // |GetMessageLoop()|. Since |pipeline_| will own decoders created from the | 177 // |GetMessageLoop()|. Since |pipeline_| will own decoders created from the |
| 173 // factories, require that their message loops are identical. | 178 // factories, require that their message loops are identical. |
| 174 DCHECK(!gpu_factories_ || (gpu_factories_->GetMessageLoop() == media_loop_)); | 179 DCHECK(!gpu_factories_ || (gpu_factories_->GetMessageLoop() == media_loop_)); |
| 175 | 180 |
| 176 // Let V8 know we started new thread if we did not do it yet. | 181 // Let V8 know we started new thread if we did not do it yet. |
| 177 // Made separate task to avoid deletion of player currently being created. | 182 // Made separate task to avoid deletion of player currently being created. |
| 178 // Also, delaying GC until after player starts gets rid of starting lag -- | 183 // Also, delaying GC until after player starts gets rid of starting lag -- |
| 179 // collection happens in parallel with playing. | 184 // collection happens in parallel with playing. |
| 180 // | 185 // |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 if (!IsConcreteSupportedKeySystem(key_system)) | 851 if (!IsConcreteSupportedKeySystem(key_system)) |
| 847 return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported; | 852 return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported; |
| 848 | 853 |
| 849 if (current_key_system_.isEmpty() || key_system != current_key_system_) | 854 if (current_key_system_.isEmpty() || key_system != current_key_system_) |
| 850 return WebMediaPlayer::MediaKeyExceptionInvalidPlayerState; | 855 return WebMediaPlayer::MediaKeyExceptionInvalidPlayerState; |
| 851 | 856 |
| 852 decryptor_->CancelKeyRequest(session_id.utf8()); | 857 decryptor_->CancelKeyRequest(session_id.utf8()); |
| 853 return WebMediaPlayer::MediaKeyExceptionNoError; | 858 return WebMediaPlayer::MediaKeyExceptionNoError; |
| 854 } | 859 } |
| 855 | 860 |
| 861 void WebMediaPlayerImpl::mediaKeysChanged( | |
| 862 blink::WebContentDecryptionModule* cdm) { | |
| 863 cdm_ = cdm; | |
|
ddorwin
2013/12/18 23:47:35
We need to stop any current uses of the old one (u
| |
| 864 } | |
| 865 | |
| 856 void WebMediaPlayerImpl::OnDestruct() { | 866 void WebMediaPlayerImpl::OnDestruct() { |
| 857 Destroy(); | 867 Destroy(); |
| 858 } | 868 } |
| 859 | 869 |
| 860 void WebMediaPlayerImpl::Repaint() { | 870 void WebMediaPlayerImpl::Repaint() { |
| 861 DCHECK(main_loop_->BelongsToCurrentThread()); | 871 DCHECK(main_loop_->BelongsToCurrentThread()); |
| 862 TRACE_EVENT0("media", "WebMediaPlayerImpl:repaint"); | 872 TRACE_EVENT0("media", "WebMediaPlayerImpl:repaint"); |
| 863 | 873 |
| 864 bool size_changed = false; | 874 bool size_changed = false; |
| 865 { | 875 { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1309 // The |current_frame_| wasn't painted, it is being replaced, and we haven't | 1319 // The |current_frame_| wasn't painted, it is being replaced, and we haven't |
| 1310 // even gotten the chance to request a repaint for it yet. Mark it as dropped. | 1320 // even gotten the chance to request a repaint for it yet. Mark it as dropped. |
| 1311 TRACE_EVENT0("media", "WebMediaPlayerImpl:frameDropped"); | 1321 TRACE_EVENT0("media", "WebMediaPlayerImpl:frameDropped"); |
| 1312 DVLOG(1) << "Frame dropped before being painted: " | 1322 DVLOG(1) << "Frame dropped before being painted: " |
| 1313 << current_frame_->GetTimestamp().InSecondsF(); | 1323 << current_frame_->GetTimestamp().InSecondsF(); |
| 1314 if (frames_dropped_before_paint_ < kuint32max) | 1324 if (frames_dropped_before_paint_ < kuint32max) |
| 1315 frames_dropped_before_paint_++; | 1325 frames_dropped_before_paint_++; |
| 1316 } | 1326 } |
| 1317 | 1327 |
| 1318 } // namespace content | 1328 } // namespace content |
| OLD | NEW |