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/android/media_source_delegate.h" | 5 #include "content/renderer/media/android/media_source_delegate.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 duration_change_cb_ = duration_change_cb; | 158 duration_change_cb_ = duration_change_cb; |
159 waiting_for_decryption_key_cb_ = | 159 waiting_for_decryption_key_cb_ = |
160 media::BindToCurrentLoop(waiting_for_decryption_key_cb); | 160 media::BindToCurrentLoop(waiting_for_decryption_key_cb); |
161 access_unit_size_ = kAccessUnitSizeForMediaSource; | 161 access_unit_size_ = kAccessUnitSizeForMediaSource; |
162 | 162 |
163 chunk_demuxer_.reset(new media::ChunkDemuxer( | 163 chunk_demuxer_.reset(new media::ChunkDemuxer( |
164 media::BindToCurrentLoop( | 164 media::BindToCurrentLoop( |
165 base::Bind(&MediaSourceDelegate::OnDemuxerOpened, main_weak_this_)), | 165 base::Bind(&MediaSourceDelegate::OnDemuxerOpened, main_weak_this_)), |
166 media::BindToCurrentLoop(base::Bind( | 166 media::BindToCurrentLoop(base::Bind( |
167 &MediaSourceDelegate::OnEncryptedMediaInitData, main_weak_this_)), | 167 &MediaSourceDelegate::OnEncryptedMediaInitData, main_weak_this_)), |
168 base::Bind(&media::MediaLog::AddLogEvent, media_log_), media_log_, | 168 media_log_, false)); |
169 false)); | |
170 | 169 |
171 // |this| will be retained until StopDemuxer() is posted, so Unretained() is | 170 // |this| will be retained until StopDemuxer() is posted, so Unretained() is |
172 // safe here. | 171 // safe here. |
173 media_task_runner_->PostTask(FROM_HERE, | 172 media_task_runner_->PostTask(FROM_HERE, |
174 base::Bind(&MediaSourceDelegate::InitializeDemuxer, | 173 base::Bind(&MediaSourceDelegate::InitializeDemuxer, |
175 base::Unretained(this))); | 174 base::Unretained(this))); |
176 } | 175 } |
177 | 176 |
178 void MediaSourceDelegate::InitializeDemuxer() { | 177 void MediaSourceDelegate::InitializeDemuxer() { |
179 DCHECK(media_task_runner_->BelongsToCurrentThread()); | 178 DCHECK(media_task_runner_->BelongsToCurrentThread()); |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 return media::kInfiniteDuration(); | 656 return media::kInfiniteDuration(); |
658 | 657 |
659 return media::ConvertSecondsToTimestamp(duration); | 658 return media::ConvertSecondsToTimestamp(duration); |
660 } | 659 } |
661 | 660 |
662 void MediaSourceDelegate::OnDemuxerOpened() { | 661 void MediaSourceDelegate::OnDemuxerOpened() { |
663 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 662 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
664 if (media_source_opened_cb_.is_null()) | 663 if (media_source_opened_cb_.is_null()) |
665 return; | 664 return; |
666 | 665 |
667 media_source_opened_cb_.Run(new media::WebMediaSourceImpl( | 666 media_source_opened_cb_.Run( |
668 chunk_demuxer_.get(), | 667 new media::WebMediaSourceImpl(chunk_demuxer_.get(), media_log_)); |
669 base::Bind(&media::MediaLog::AddLogEvent, media_log_))); | |
670 } | 668 } |
671 | 669 |
672 void MediaSourceDelegate::OnEncryptedMediaInitData( | 670 void MediaSourceDelegate::OnEncryptedMediaInitData( |
673 media::EmeInitDataType init_data_type, | 671 media::EmeInitDataType init_data_type, |
674 const std::vector<uint8>& init_data) { | 672 const std::vector<uint8>& init_data) { |
675 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 673 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
676 if (encrypted_media_init_data_cb_.is_null()) | 674 if (encrypted_media_init_data_cb_.is_null()) |
677 return; | 675 return; |
678 | 676 |
679 encrypted_media_init_data_cb_.Run(init_data_type, init_data); | 677 encrypted_media_init_data_cb_.Run(init_data_type, init_data); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 configs->video_size = config.natural_size(); | 752 configs->video_size = config.natural_size(); |
755 configs->is_video_encrypted = config.is_encrypted(); | 753 configs->is_video_encrypted = config.is_encrypted(); |
756 configs->video_extra_data = std::vector<uint8>( | 754 configs->video_extra_data = std::vector<uint8>( |
757 config.extra_data(), config.extra_data() + config.extra_data_size()); | 755 config.extra_data(), config.extra_data() + config.extra_data_size()); |
758 return true; | 756 return true; |
759 } | 757 } |
760 return false; | 758 return false; |
761 } | 759 } |
762 | 760 |
763 } // namespace content | 761 } // namespace content |
OLD | NEW |