| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool MediaDecoderJob::Decode( | 113 bool MediaDecoderJob::Decode( |
| 114 base::TimeTicks start_time_ticks, | 114 base::TimeTicks start_time_ticks, |
| 115 base::TimeDelta start_presentation_timestamp, | 115 base::TimeDelta start_presentation_timestamp, |
| 116 const DecoderCallback& callback) { | 116 const DecoderCallback& callback) { |
| 117 DCHECK(decode_cb_.is_null()); | 117 DCHECK(decode_cb_.is_null()); |
| 118 DCHECK(data_received_cb_.is_null()); | 118 DCHECK(data_received_cb_.is_null()); |
| 119 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 119 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| 120 if (!media_codec_bridge_ || need_to_reconfig_decoder_job_) { | 120 if (!media_codec_bridge_ || need_to_reconfig_decoder_job_) { |
| 121 if (drain_decoder_) |
| 122 OnDecoderDrained(); |
| 121 need_to_reconfig_decoder_job_ = !CreateMediaCodecBridge(); | 123 need_to_reconfig_decoder_job_ = !CreateMediaCodecBridge(); |
| 122 if (drain_decoder_) { | |
| 123 // Decoder has been recreated, stop draining. | |
| 124 drain_decoder_ = false; | |
| 125 input_eos_encountered_ = false; | |
| 126 output_eos_encountered_ = false; | |
| 127 access_unit_index_[current_demuxer_data_index_]++; | |
| 128 } | |
| 129 skip_eos_enqueue_ = true; | 124 skip_eos_enqueue_ = true; |
| 130 if (need_to_reconfig_decoder_job_) | 125 if (need_to_reconfig_decoder_job_) |
| 131 return false; | 126 return false; |
| 132 } | 127 } |
| 133 | 128 |
| 134 decode_cb_ = callback; | 129 decode_cb_ = callback; |
| 135 | 130 |
| 136 if (!HasData()) { | 131 if (!HasData()) { |
| 137 RequestData(base::Bind(&MediaDecoderJob::DecodeCurrentAccessUnit, | 132 RequestData(base::Bind(&MediaDecoderJob::DecodeCurrentAccessUnit, |
| 138 base::Unretained(this), | 133 base::Unretained(this), |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 | 659 |
| 665 void MediaDecoderJob::ReleaseMediaCodecBridge() { | 660 void MediaDecoderJob::ReleaseMediaCodecBridge() { |
| 666 if (!media_codec_bridge_) | 661 if (!media_codec_bridge_) |
| 667 return; | 662 return; |
| 668 | 663 |
| 669 media_codec_bridge_.reset(); | 664 media_codec_bridge_.reset(); |
| 670 input_buf_index_ = -1; | 665 input_buf_index_ = -1; |
| 671 } | 666 } |
| 672 | 667 |
| 673 } // namespace media | 668 } // namespace media |
| OLD | NEW |