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 "media/base/android/media_decoder_job.h" | 5 #include "media/base/android/media_decoder_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 is_requesting_demuxer_data_ = false; | 65 is_requesting_demuxer_data_ = false; |
| 66 return; | 66 return; |
| 67 } | 67 } |
| 68 | 68 |
| 69 size_t next_demuxer_data_index = inactive_demuxer_data_index(); | 69 size_t next_demuxer_data_index = inactive_demuxer_data_index(); |
| 70 received_data_[next_demuxer_data_index] = data; | 70 received_data_[next_demuxer_data_index] = data; |
| 71 access_unit_index_[next_demuxer_data_index] = 0; | 71 access_unit_index_[next_demuxer_data_index] = 0; |
| 72 is_requesting_demuxer_data_ = false; | 72 is_requesting_demuxer_data_ = false; |
| 73 | 73 |
| 74 base::Closure done_cb = base::ResetAndReturn(&on_data_received_cb_); | 74 base::Closure done_cb = base::ResetAndReturn(&on_data_received_cb_); |
| 75 | |
| 76 // If this data request is for the inactive chunk, do nothing. | |
|
wolenetz
2014/04/10 00:15:35
I'm confused. If it's a request for the inactive c
qinmin
2014/04/10 00:19:37
So if done_cb.is_null() is true, this is the data
| |
| 77 if (done_cb.is_null()) | |
| 78 return; | |
| 79 | |
| 75 if (stop_decode_pending_) { | 80 if (stop_decode_pending_) { |
| 81 DCHECK(is_decoding()); | |
| 76 OnDecodeCompleted(MEDIA_CODEC_STOPPED, kNoTimestamp(), 0); | 82 OnDecodeCompleted(MEDIA_CODEC_STOPPED, kNoTimestamp(), 0); |
| 77 return; | 83 return; |
| 78 } | 84 } |
| 79 | 85 |
| 80 if (!done_cb.is_null()) | 86 done_cb.Run(); |
| 81 done_cb.Run(); | |
| 82 } | 87 } |
| 83 | 88 |
| 84 void MediaDecoderJob::Prefetch(const base::Closure& prefetch_cb) { | 89 void MediaDecoderJob::Prefetch(const base::Closure& prefetch_cb) { |
| 85 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 90 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 86 DCHECK(on_data_received_cb_.is_null()); | 91 DCHECK(on_data_received_cb_.is_null()); |
| 87 DCHECK(decode_cb_.is_null()); | 92 DCHECK(decode_cb_.is_null()); |
| 88 | 93 |
| 89 if (HasData()) { | 94 if (HasData()) { |
| 90 DVLOG(1) << __FUNCTION__ << " : using previously received data"; | 95 DVLOG(1) << __FUNCTION__ << " : using previously received data"; |
| 91 ui_task_runner_->PostTask(FROM_HERE, prefetch_cb); | 96 ui_task_runner_->PostTask(FROM_HERE, prefetch_cb); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 } | 500 } |
| 496 | 501 |
| 497 void MediaDecoderJob::InitializeReceivedData() { | 502 void MediaDecoderJob::InitializeReceivedData() { |
| 498 for (size_t i = 0; i < 2; ++i) { | 503 for (size_t i = 0; i < 2; ++i) { |
| 499 received_data_[i] = DemuxerData(); | 504 received_data_[i] = DemuxerData(); |
| 500 access_unit_index_[i] = 0; | 505 access_unit_index_[i] = 0; |
| 501 } | 506 } |
| 502 } | 507 } |
| 503 | 508 |
| 504 } // namespace media | 509 } // namespace media |
| OLD | NEW |