Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/filters/chunk_demuxer.h" | 5 #include "media/filters/chunk_demuxer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 DCHECK(!open_cb_.is_null()); | 420 DCHECK(!open_cb_.is_null()); |
| 421 DCHECK(!encrypted_media_init_data_cb_.is_null()); | 421 DCHECK(!encrypted_media_init_data_cb_.is_null()); |
| 422 } | 422 } |
| 423 | 423 |
| 424 std::string ChunkDemuxer::GetDisplayName() const { | 424 std::string ChunkDemuxer::GetDisplayName() const { |
| 425 return "ChunkDemuxer"; | 425 return "ChunkDemuxer"; |
| 426 } | 426 } |
| 427 | 427 |
| 428 void ChunkDemuxer::Initialize( | 428 void ChunkDemuxer::Initialize( |
| 429 DemuxerHost* host, | 429 DemuxerHost* host, |
| 430 const PipelineStatusCB& cb, | 430 const PipelineStatusCB& cb, |
|
xhwang
2016/09/16 23:41:47
nit on naming: This code is old. We use |status_cb
alokp
2016/09/17 00:06:05
IIUC do you want me to change the function argumen
xhwang
2016/09/17 03:58:24
A TODO for the renaming should be good. Thank you!
alokp
2016/09/17 05:43:14
I can make this trivial change while I am already
| |
| 431 bool enable_text_tracks) { | 431 bool enable_text_tracks) { |
| 432 DVLOG(1) << "Init()"; | 432 DVLOG(1) << "Init()"; |
| 433 | 433 |
| 434 base::AutoLock auto_lock(lock_); | 434 base::AutoLock auto_lock(lock_); |
| 435 | |
| 436 // The |init_cb_| must only be run after this method returns, so always post. | |
| 437 init_cb_ = BindToCurrentLoop(cb); | |
| 438 if (state_ == SHUTDOWN) { | 435 if (state_ == SHUTDOWN) { |
| 439 base::ResetAndReturn(&init_cb_).Run(DEMUXER_ERROR_COULD_NOT_OPEN); | 436 // Init cb must only be run after this method returns, so always post. |
| 437 base::ThreadTaskRunnerHandle::Get()->PostTask( | |
| 438 FROM_HERE, base::Bind(cb, DEMUXER_ERROR_COULD_NOT_OPEN)); | |
| 440 return; | 439 return; |
| 441 } | 440 } |
| 441 | |
| 442 DCHECK_EQ(state_, WAITING_FOR_INIT); | 442 DCHECK_EQ(state_, WAITING_FOR_INIT); |
| 443 host_ = host; | 443 host_ = host; |
| 444 // Do not post init_cb once this function returns because if there is an | |
| 445 // error after initialization, the error might be reported before init_cb | |
| 446 // has a chance to run. This is because ChunkDemuxer::ReportError_Locked | |
| 447 // directly calls DemuxerHost::OnDemuxerError: crbug.com/633016. | |
| 448 init_cb_ = cb; | |
| 444 enable_text_ = enable_text_tracks; | 449 enable_text_ = enable_text_tracks; |
| 445 | 450 |
| 446 ChangeState_Locked(INITIALIZING); | 451 ChangeState_Locked(INITIALIZING); |
| 447 | 452 |
| 448 base::ResetAndReturn(&open_cb_).Run(); | 453 base::ResetAndReturn(&open_cb_).Run(); |
| 449 } | 454 } |
| 450 | 455 |
| 451 void ChunkDemuxer::Stop() { | 456 void ChunkDemuxer::Stop() { |
| 452 DVLOG(1) << "Stop()"; | 457 DVLOG(1) << "Stop()"; |
| 453 Shutdown(); | 458 Shutdown(); |
| (...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1272 } | 1277 } |
| 1273 | 1278 |
| 1274 void ChunkDemuxer::ShutdownAllStreams() { | 1279 void ChunkDemuxer::ShutdownAllStreams() { |
| 1275 for (MediaSourceStateMap::iterator itr = source_state_map_.begin(); | 1280 for (MediaSourceStateMap::iterator itr = source_state_map_.begin(); |
| 1276 itr != source_state_map_.end(); ++itr) { | 1281 itr != source_state_map_.end(); ++itr) { |
| 1277 itr->second->Shutdown(); | 1282 itr->second->Shutdown(); |
| 1278 } | 1283 } |
| 1279 } | 1284 } |
| 1280 | 1285 |
| 1281 } // namespace media | 1286 } // namespace media |
| OLD | NEW |