| 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, or |on_data_received_cb_| |
| 77 // was set to null by ClearData() or Release(), do nothing. |
| 78 if (done_cb.is_null()) |
| 79 return; |
| 80 |
| 75 if (stop_decode_pending_) { | 81 if (stop_decode_pending_) { |
| 82 DCHECK(is_decoding()); |
| 76 OnDecodeCompleted(MEDIA_CODEC_STOPPED, kNoTimestamp(), 0); | 83 OnDecodeCompleted(MEDIA_CODEC_STOPPED, kNoTimestamp(), 0); |
| 77 return; | 84 return; |
| 78 } | 85 } |
| 79 | 86 |
| 80 if (!done_cb.is_null()) | 87 done_cb.Run(); |
| 81 done_cb.Run(); | |
| 82 } | 88 } |
| 83 | 89 |
| 84 void MediaDecoderJob::Prefetch(const base::Closure& prefetch_cb) { | 90 void MediaDecoderJob::Prefetch(const base::Closure& prefetch_cb) { |
| 85 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 91 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 86 DCHECK(on_data_received_cb_.is_null()); | 92 DCHECK(on_data_received_cb_.is_null()); |
| 87 DCHECK(decode_cb_.is_null()); | 93 DCHECK(decode_cb_.is_null()); |
| 88 | 94 |
| 89 if (HasData()) { | 95 if (HasData()) { |
| 90 DVLOG(1) << __FUNCTION__ << " : using previously received data"; | 96 DVLOG(1) << __FUNCTION__ << " : using previously received data"; |
| 91 ui_task_runner_->PostTask(FROM_HERE, prefetch_cb); | 97 ui_task_runner_->PostTask(FROM_HERE, prefetch_cb); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 } | 501 } |
| 496 | 502 |
| 497 void MediaDecoderJob::InitializeReceivedData() { | 503 void MediaDecoderJob::InitializeReceivedData() { |
| 498 for (size_t i = 0; i < 2; ++i) { | 504 for (size_t i = 0; i < 2; ++i) { |
| 499 received_data_[i] = DemuxerData(); | 505 received_data_[i] = DemuxerData(); |
| 500 access_unit_index_[i] = 0; | 506 access_unit_index_[i] = 0; |
| 501 } | 507 } |
| 502 } | 508 } |
| 503 | 509 |
| 504 } // namespace media | 510 } // namespace media |
| OLD | NEW |