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

Side by Side Diff: webkit/renderer/media/android/media_source_delegate.cc

Issue 17289006: Separate CDM initialization from GenerateKeyRequest & remove key_system parameters. (Closed) Base URL: master
Patch Set: rebase only Created 7 years, 6 months 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 "webkit/renderer/media/android/media_source_delegate.h" 5 #include "webkit/renderer/media/android/media_source_delegate.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "media/base/android/demuxer_stream_player_params.h" 9 #include "media/base/android/demuxer_stream_player_params.h"
10 #include "media/base/bind_to_loop.h" 10 #include "media/base/bind_to_loop.h"
11 #include "media/base/demuxer_stream.h" 11 #include "media/base/demuxer_stream.h"
12 #include "media/base/media_log.h" 12 #include "media/base/media_log.h"
13 #include "media/filters/chunk_demuxer.h" 13 #include "media/filters/chunk_demuxer.h"
14 #include "third_party/WebKit/public/platform/WebString.h" 14 #include "third_party/WebKit/public/platform/WebString.h"
15 #include "third_party/WebKit/public/web/WebMediaSource.h" 15 #include "third_party/WebKit/public/web/WebMediaSource.h"
16 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 16 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
17 #include "webkit/renderer/media/android/webmediaplayer_proxy_android.h" 17 #include "webkit/renderer/media/android/webmediaplayer_proxy_android.h"
18 #include "webkit/renderer/media/crypto/key_systems.h"
19 #include "webkit/renderer/media/webmediaplayer_util.h" 18 #include "webkit/renderer/media/webmediaplayer_util.h"
20 #include "webkit/renderer/media/webmediasourceclient_impl.h" 19 #include "webkit/renderer/media/webmediasourceclient_impl.h"
21 20
22 using media::DemuxerStream; 21 using media::DemuxerStream;
23 using media::MediaPlayerHostMsg_DemuxerReady_Params; 22 using media::MediaPlayerHostMsg_DemuxerReady_Params;
24 using media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params; 23 using media::MediaPlayerHostMsg_ReadFromDemuxerAck_Params;
25 using WebKit::WebMediaPlayer; 24 using WebKit::WebMediaPlayer;
26 using WebKit::WebString; 25 using WebKit::WebString;
27 26
28 namespace { 27 namespace {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const UpdateNetworkStateCB& update_network_state_cb, 102 const UpdateNetworkStateCB& update_network_state_cb,
104 const DurationChangeCB& duration_change_cb) { 103 const DurationChangeCB& duration_change_cb) {
105 DCHECK(media_source); 104 DCHECK(media_source);
106 media_source_.reset(media_source); 105 media_source_.reset(media_source);
107 need_key_cb_ = need_key_cb; 106 need_key_cb_ = need_key_cb;
108 update_network_state_cb_ = update_network_state_cb; 107 update_network_state_cb_ = update_network_state_cb;
109 duration_change_cb_ = duration_change_cb; 108 duration_change_cb_ = duration_change_cb;
110 109
111 chunk_demuxer_.reset(new media::ChunkDemuxer( 110 chunk_demuxer_.reset(new media::ChunkDemuxer(
112 BIND_TO_RENDER_LOOP(&MediaSourceDelegate::OnDemuxerOpened), 111 BIND_TO_RENDER_LOOP(&MediaSourceDelegate::OnDemuxerOpened),
113 BIND_TO_RENDER_LOOP_2(&MediaSourceDelegate::OnNeedKey, "", ""), 112 BIND_TO_RENDER_LOOP_1(&MediaSourceDelegate::OnNeedKey, ""),
114 base::Bind(&MediaSourceDelegate::OnAddTextTrack, 113 base::Bind(&MediaSourceDelegate::OnAddTextTrack,
115 base::Unretained(this)), 114 base::Unretained(this)),
116 base::Bind(&LogMediaSourceError, media_log_))); 115 base::Bind(&LogMediaSourceError, media_log_)));
117 chunk_demuxer_->Initialize(this, 116 chunk_demuxer_->Initialize(this,
118 BIND_TO_RENDER_LOOP(&MediaSourceDelegate::OnDemuxerInitDone)); 117 BIND_TO_RENDER_LOOP(&MediaSourceDelegate::OnDemuxerInitDone));
119 demuxer_ = chunk_demuxer_.get(); 118 demuxer_ = chunk_demuxer_.get();
120 access_unit_size_ = kAccessUnitSizeForMediaSource; 119 access_unit_size_ = kAccessUnitSizeForMediaSource;
121 } 120 }
122 121
123 #if defined(GOOGLE_TV) 122 #if defined(GOOGLE_TV)
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 393 }
395 394
396 void MediaSourceDelegate::OnDemuxerOpened() { 395 void MediaSourceDelegate::OnDemuxerOpened() {
397 if (!media_source_) 396 if (!media_source_)
398 return; 397 return;
399 398
400 media_source_->open(new WebMediaSourceClientImpl( 399 media_source_->open(new WebMediaSourceClientImpl(
401 chunk_demuxer_.get(), base::Bind(&LogMediaSourceError, media_log_))); 400 chunk_demuxer_.get(), base::Bind(&LogMediaSourceError, media_log_)));
402 } 401 }
403 402
404 void MediaSourceDelegate::OnNeedKey(const std::string& key_system, 403 void MediaSourceDelegate::OnNeedKey(const std::string& session_id,
405 const std::string& session_id,
406 const std::string& type, 404 const std::string& type,
407 scoped_ptr<uint8[]> init_data, 405 scoped_ptr<uint8[]> init_data,
408 int init_data_size) { 406 int init_data_size) {
409 if (need_key_cb_.is_null()) 407 if (need_key_cb_.is_null())
410 return; 408 return;
411 409
412 need_key_cb_.Run( 410 need_key_cb_.Run(session_id, type, init_data.Pass(), init_data_size);
413 key_system, session_id, type, init_data.Pass(), init_data_size);
414 } 411 }
415 412
416 scoped_ptr<media::TextTrack> MediaSourceDelegate::OnAddTextTrack( 413 scoped_ptr<media::TextTrack> MediaSourceDelegate::OnAddTextTrack(
417 media::TextKind kind, 414 media::TextKind kind,
418 const std::string& label, 415 const std::string& label,
419 const std::string& language) { 416 const std::string& language) {
420 return scoped_ptr<media::TextTrack>(); 417 return scoped_ptr<media::TextTrack>();
421 } 418 }
422 419
423 } // namespace webkit_media 420 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/renderer/media/android/media_source_delegate.h ('k') | webkit/renderer/media/android/webmediaplayer_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698