Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: content/renderer/media/webmediaplayer_impl.cc

Issue 105143010: Connect WebMediaPlayerImpl to WebContentDecryptionModuleImpl for EME WD (Chromium side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/debug/crash_logging.h" 15 #include "base/debug/crash_logging.h"
16 #include "base/debug/trace_event.h" 16 #include "base/debug/trace_event.h"
17 #include "base/message_loop/message_loop_proxy.h" 17 #include "base/message_loop/message_loop_proxy.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
21 #include "cc/layers/video_layer.h" 21 #include "cc/layers/video_layer.h"
22 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
23 #include "content/renderer/media/buffered_data_source.h" 23 #include "content/renderer/media/buffered_data_source.h"
24 #include "content/renderer/media/crypto/key_systems.h" 24 #include "content/renderer/media/crypto/key_systems.h"
25 #include "content/renderer/media/texttrack_impl.h" 25 #include "content/renderer/media/texttrack_impl.h"
26 #include "content/renderer/media/webaudiosourceprovider_impl.h" 26 #include "content/renderer/media/webaudiosourceprovider_impl.h"
27 #include "content/renderer/media/webcontentdecryptionmodule_impl.h"
27 #include "content/renderer/media/webinbandtexttrack_impl.h" 28 #include "content/renderer/media/webinbandtexttrack_impl.h"
28 #include "content/renderer/media/webmediaplayer_delegate.h" 29 #include "content/renderer/media/webmediaplayer_delegate.h"
29 #include "content/renderer/media/webmediaplayer_params.h" 30 #include "content/renderer/media/webmediaplayer_params.h"
30 #include "content/renderer/media/webmediaplayer_util.h" 31 #include "content/renderer/media/webmediaplayer_util.h"
31 #include "content/renderer/media/webmediasource_impl.h" 32 #include "content/renderer/media/webmediasource_impl.h"
32 #include "content/renderer/pepper/pepper_webplugin_impl.h" 33 #include "content/renderer/pepper/pepper_webplugin_impl.h"
33 #include "gpu/GLES2/gl2extchromium.h" 34 #include "gpu/GLES2/gl2extchromium.h"
34 #include "media/audio/null_audio_sink.h" 35 #include "media/audio/null_audio_sink.h"
35 #include "media/base/bind_to_loop.h" 36 #include "media/base/bind_to_loop.h"
36 #include "media/base/filter_collection.h" 37 #include "media/base/filter_collection.h"
37 #include "media/base/limits.h" 38 #include "media/base/limits.h"
38 #include "media/base/media_log.h" 39 #include "media/base/media_log.h"
39 #include "media/base/media_switches.h" 40 #include "media/base/media_switches.h"
40 #include "media/base/pipeline.h" 41 #include "media/base/pipeline.h"
41 #include "media/base/text_renderer.h" 42 #include "media/base/text_renderer.h"
42 #include "media/base/video_frame.h" 43 #include "media/base/video_frame.h"
43 #include "media/filters/audio_renderer_impl.h" 44 #include "media/filters/audio_renderer_impl.h"
44 #include "media/filters/chunk_demuxer.h" 45 #include "media/filters/chunk_demuxer.h"
45 #include "media/filters/ffmpeg_audio_decoder.h" 46 #include "media/filters/ffmpeg_audio_decoder.h"
46 #include "media/filters/ffmpeg_demuxer.h" 47 #include "media/filters/ffmpeg_demuxer.h"
47 #include "media/filters/ffmpeg_video_decoder.h" 48 #include "media/filters/ffmpeg_video_decoder.h"
48 #include "media/filters/gpu_video_accelerator_factories.h" 49 #include "media/filters/gpu_video_accelerator_factories.h"
49 #include "media/filters/gpu_video_decoder.h" 50 #include "media/filters/gpu_video_decoder.h"
50 #include "media/filters/opus_audio_decoder.h" 51 #include "media/filters/opus_audio_decoder.h"
51 #include "media/filters/video_renderer_impl.h" 52 #include "media/filters/video_renderer_impl.h"
52 #include "media/filters/vpx_video_decoder.h" 53 #include "media/filters/vpx_video_decoder.h"
54 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
53 #include "third_party/WebKit/public/platform/WebMediaSource.h" 55 #include "third_party/WebKit/public/platform/WebMediaSource.h"
54 #include "third_party/WebKit/public/platform/WebRect.h" 56 #include "third_party/WebKit/public/platform/WebRect.h"
55 #include "third_party/WebKit/public/platform/WebSize.h" 57 #include "third_party/WebKit/public/platform/WebSize.h"
56 #include "third_party/WebKit/public/platform/WebString.h" 58 #include "third_party/WebKit/public/platform/WebString.h"
57 #include "third_party/WebKit/public/platform/WebURL.h" 59 #include "third_party/WebKit/public/platform/WebURL.h"
58 #include "third_party/WebKit/public/web/WebDocument.h" 60 #include "third_party/WebKit/public/web/WebDocument.h"
59 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 61 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
60 #include "third_party/WebKit/public/web/WebView.h" 62 #include "third_party/WebKit/public/web/WebView.h"
61 #include "v8/include/v8.h" 63 #include "v8/include/v8.h"
62 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" 64 #include "webkit/renderer/compositor_bindings/web_layer_impl.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 gpu_factories_(params.gpu_factories()), 157 gpu_factories_(params.gpu_factories()),
156 is_local_source_(false), 158 is_local_source_(false),
157 supports_save_(true), 159 supports_save_(true),
158 starting_(false), 160 starting_(false),
159 chunk_demuxer_(NULL), 161 chunk_demuxer_(NULL),
160 current_frame_painted_(false), 162 current_frame_painted_(false),
161 frames_dropped_before_paint_(0), 163 frames_dropped_before_paint_(0),
162 pending_repaint_(false), 164 pending_repaint_(false),
163 pending_size_change_(false), 165 pending_size_change_(false),
164 video_frame_provider_client_(NULL), 166 video_frame_provider_client_(NULL),
165 text_track_index_(0) { 167 text_track_index_(0),
168 web_cdm_(0) {
xhwang 2013/12/30 19:50:49 s/0/NULL
jrummell 2014/01/08 19:12:31 Done. WebKit presubmit checks complain about NULL,
166 media_log_->AddEvent( 169 media_log_->AddEvent(
167 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); 170 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
168 171
169 pipeline_.reset(new media::Pipeline(media_loop_, media_log_.get())); 172 pipeline_.reset(new media::Pipeline(media_loop_, media_log_.get()));
170 173
171 // |gpu_factories_| requires that its entry points be called on its 174 // |gpu_factories_| requires that its entry points be called on its
172 // |GetMessageLoop()|. Since |pipeline_| will own decoders created from the 175 // |GetMessageLoop()|. Since |pipeline_| will own decoders created from the
173 // factories, require that their message loops are identical. 176 // factories, require that their message loops are identical.
174 DCHECK(!gpu_factories_ || (gpu_factories_->GetMessageLoop() == media_loop_)); 177 DCHECK(!gpu_factories_ || (gpu_factories_->GetMessageLoop() == media_loop_));
175 178
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 if (!IsConcreteSupportedKeySystem(key_system)) 849 if (!IsConcreteSupportedKeySystem(key_system))
847 return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported; 850 return WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported;
848 851
849 if (current_key_system_.isEmpty() || key_system != current_key_system_) 852 if (current_key_system_.isEmpty() || key_system != current_key_system_)
850 return WebMediaPlayer::MediaKeyExceptionInvalidPlayerState; 853 return WebMediaPlayer::MediaKeyExceptionInvalidPlayerState;
851 854
852 decryptor_->CancelKeyRequest(session_id.utf8()); 855 decryptor_->CancelKeyRequest(session_id.utf8());
853 return WebMediaPlayer::MediaKeyExceptionNoError; 856 return WebMediaPlayer::MediaKeyExceptionNoError;
854 } 857 }
855 858
859 void WebMediaPlayerImpl::setContentDecryptionModule(
860 blink::WebContentDecryptionModule* cdm) {
861 web_cdm_ = toWebContentDecryptionModuleImpl(cdm);
862 // TODO(jrummell): use web_cdm_->getDecryptor() instead of creating
863 // ProxyDecryptor().
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698