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/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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 set_decryptor_ready_cb_ = set_decryptor_ready_cb; | 157 set_decryptor_ready_cb_ = set_decryptor_ready_cb; |
| 158 update_network_state_cb_ = media::BindToCurrentLoop(update_network_state_cb); | 158 update_network_state_cb_ = media::BindToCurrentLoop(update_network_state_cb); |
| 159 duration_change_cb_ = duration_change_cb; | 159 duration_change_cb_ = duration_change_cb; |
| 160 access_unit_size_ = kAccessUnitSizeForMediaSource; | 160 access_unit_size_ = kAccessUnitSizeForMediaSource; |
| 161 | 161 |
| 162 chunk_demuxer_.reset(new media::ChunkDemuxer( | 162 chunk_demuxer_.reset(new media::ChunkDemuxer( |
| 163 media::BindToCurrentLoop(base::Bind( | 163 media::BindToCurrentLoop(base::Bind( |
| 164 &MediaSourceDelegate::OnDemuxerOpened, main_weak_this_)), | 164 &MediaSourceDelegate::OnDemuxerOpened, main_weak_this_)), |
| 165 media::BindToCurrentLoop(base::Bind( | 165 media::BindToCurrentLoop(base::Bind( |
| 166 &MediaSourceDelegate::OnNeedKey, main_weak_this_)), | 166 &MediaSourceDelegate::OnNeedKey, main_weak_this_)), |
| 167 base::Bind(&ReturnNullTextTrack), | |
| 168 base::Bind(&LogMediaSourceError, media_log_))); | 167 base::Bind(&LogMediaSourceError, media_log_))); |
| 169 demuxer_ = chunk_demuxer_.get(); | 168 demuxer_ = chunk_demuxer_.get(); |
| 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_loop_->PostTask(FROM_HERE, | 172 media_loop_->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_loop_->BelongsToCurrentThread()); | 178 DCHECK(media_loop_->BelongsToCurrentThread()); |
| 180 demuxer_client_->AddDelegate(demuxer_client_id_, this); | 179 demuxer_client_->AddDelegate(demuxer_client_id_, this); |
| 181 demuxer_->Initialize(this, base::Bind(&MediaSourceDelegate::OnDemuxerInitDone, | 180 demuxer_->Initialize(this, base::Bind(&MediaSourceDelegate::OnDemuxerInitDone, |
| 182 media_weak_factory_.GetWeakPtr())); | 181 media_weak_factory_.GetWeakPtr()), |
| 182 false); | |
| 183 } | 183 } |
| 184 | 184 |
| 185 #if defined(GOOGLE_TV) | 185 #if defined(GOOGLE_TV) |
| 186 void MediaSourceDelegate::InitializeMediaStream( | 186 void MediaSourceDelegate::InitializeMediaStream( |
| 187 media::Demuxer* demuxer, | 187 media::Demuxer* demuxer, |
| 188 const UpdateNetworkStateCB& update_network_state_cb) { | 188 const UpdateNetworkStateCB& update_network_state_cb) { |
| 189 DCHECK(main_loop_->BelongsToCurrentThread()); | 189 DCHECK(main_loop_->BelongsToCurrentThread()); |
| 190 DCHECK(demuxer); | 190 DCHECK(demuxer); |
| 191 demuxer_ = demuxer; | 191 demuxer_ = demuxer; |
| 192 update_network_state_cb_ = media::BindToCurrentLoop(update_network_state_cb); | 192 update_network_state_cb_ = media::BindToCurrentLoop(update_network_state_cb); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 demuxer_client_->ReadFromDemuxerAck(demuxer_client_id_, *data); | 499 demuxer_client_->ReadFromDemuxerAck(demuxer_client_id_, *data); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void MediaSourceDelegate::OnDemuxerError(media::PipelineStatus status) { | 502 void MediaSourceDelegate::OnDemuxerError(media::PipelineStatus status) { |
| 503 DVLOG(1) << __FUNCTION__ << "(" << status << ") : " << demuxer_client_id_; | 503 DVLOG(1) << __FUNCTION__ << "(" << status << ") : " << demuxer_client_id_; |
| 504 // |update_network_state_cb_| is bound to the main thread. | 504 // |update_network_state_cb_| is bound to the main thread. |
| 505 if (status != media::PIPELINE_OK && !update_network_state_cb_.is_null()) | 505 if (status != media::PIPELINE_OK && !update_network_state_cb_.is_null()) |
| 506 update_network_state_cb_.Run(PipelineErrorToNetworkState(status)); | 506 update_network_state_cb_.Run(PipelineErrorToNetworkState(status)); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void MediaSourceDelegate::AddTextStream(DemuxerStream* /* text_stream */ , | |
| 510 const TextTrackConfig& /* config */ ) { | |
| 511 // TODO(matthewjheaney): do something here | |
|
acolwell GONE FROM CHROMIUM
2013/11/21 02:49:18
Put NOTIMPLEMENTED(); here and below. File a bug f
Matthew Heaney (Chromium)
2013/11/21 19:23:33
Done.
| |
| 512 } | |
| 513 | |
| 514 void MediaSourceDelegate::RemoveTextStream(DemuxerStream* /* text_stream */ ) { | |
| 515 // TODO(matthewjheaney): do something here | |
| 516 } | |
| 517 | |
| 509 void MediaSourceDelegate::OnDemuxerInitDone(media::PipelineStatus status) { | 518 void MediaSourceDelegate::OnDemuxerInitDone(media::PipelineStatus status) { |
| 510 DCHECK(media_loop_->BelongsToCurrentThread()); | 519 DCHECK(media_loop_->BelongsToCurrentThread()); |
| 511 DVLOG(1) << __FUNCTION__ << "(" << status << ") : " << demuxer_client_id_; | 520 DVLOG(1) << __FUNCTION__ << "(" << status << ") : " << demuxer_client_id_; |
| 512 DCHECK(demuxer_); | 521 DCHECK(demuxer_); |
| 513 | 522 |
| 514 if (status != media::PIPELINE_OK) { | 523 if (status != media::PIPELINE_OK) { |
| 515 OnDemuxerError(status); | 524 OnDemuxerError(status); |
| 516 return; | 525 return; |
| 517 } | 526 } |
| 518 | 527 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 822 // current time have been garbage collected or removed by the web app, this is | 831 // current time have been garbage collected or removed by the web app, this is |
| 823 // unlikely. This may cause unexpected playback stall due to seek pending an | 832 // unlikely. This may cause unexpected playback stall due to seek pending an |
| 824 // append for a GOP prior to the last GOP demuxed. | 833 // append for a GOP prior to the last GOP demuxed. |
| 825 // TODO(wolenetz): Remove the possibility for this seek to cause unexpected | 834 // TODO(wolenetz): Remove the possibility for this seek to cause unexpected |
| 826 // player stall by replaying cached data since last keyframe in browser player | 835 // player stall by replaying cached data since last keyframe in browser player |
| 827 // rather than issuing browser seek. See http://crbug.com/304234. | 836 // rather than issuing browser seek. See http://crbug.com/304234. |
| 828 return seek_time; | 837 return seek_time; |
| 829 } | 838 } |
| 830 | 839 |
| 831 } // namespace content | 840 } // namespace content |
| OLD | NEW |