| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "media/base/android/media_codec_bridge.h" | 10 #include "media/base/android/media_codec_bridge.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 const base::TimeTicks& start_time_ticks, | 217 const base::TimeTicks& start_time_ticks, |
| 218 const base::TimeDelta& start_presentation_timestamp, | 218 const base::TimeDelta& start_presentation_timestamp, |
| 219 bool needs_flush, | 219 bool needs_flush, |
| 220 const MediaDecoderJob::DecoderCallback& callback) { | 220 const MediaDecoderJob::DecoderCallback& callback) { |
| 221 DVLOG(1) << __FUNCTION__; | 221 DVLOG(1) << __FUNCTION__; |
| 222 DCHECK(decoder_loop_->BelongsToCurrentThread()); | 222 DCHECK(decoder_loop_->BelongsToCurrentThread()); |
| 223 | 223 |
| 224 if (needs_flush) { | 224 if (needs_flush) { |
| 225 DVLOG(1) << "DecodeInternal needs flush."; | 225 DVLOG(1) << "DecodeInternal needs flush."; |
| 226 input_eos_encountered_ = false; | 226 input_eos_encountered_ = false; |
| 227 media_codec_bridge_->Reset(); | 227 MediaCodecStatus reset_status = media_codec_bridge_->Reset(); |
| 228 if (MEDIA_CODEC_OK != reset_status) { |
| 229 callback.Run(reset_status, start_presentation_timestamp, 0); |
| 230 return; |
| 231 } |
| 228 } | 232 } |
| 229 | 233 |
| 230 MediaCodecStatus input_status = MEDIA_CODEC_INPUT_END_OF_STREAM; | 234 MediaCodecStatus input_status = MEDIA_CODEC_INPUT_END_OF_STREAM; |
| 231 if (!input_eos_encountered_) { | 235 if (!input_eos_encountered_) { |
| 232 input_status = QueueInputBuffer(unit); | 236 input_status = QueueInputBuffer(unit); |
| 233 if (input_status == MEDIA_CODEC_INPUT_END_OF_STREAM) { | 237 if (input_status == MEDIA_CODEC_INPUT_END_OF_STREAM) { |
| 234 input_eos_encountered_ = true; | 238 input_eos_encountered_ = true; |
| 235 } else if (input_status != MEDIA_CODEC_OK) { | 239 } else if (input_status != MEDIA_CODEC_OK) { |
| 236 callback.Run(input_status, start_presentation_timestamp, 0); | 240 callback.Run(input_status, start_presentation_timestamp, 0); |
| 237 return; | 241 return; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 status != MEDIA_CODEC_STOPPED) { | 319 status != MEDIA_CODEC_STOPPED) { |
| 316 access_unit_index_++; | 320 access_unit_index_++; |
| 317 } | 321 } |
| 318 | 322 |
| 319 stop_decode_pending_ = false; | 323 stop_decode_pending_ = false; |
| 320 base::ResetAndReturn(&decode_cb_).Run(status, presentation_timestamp, | 324 base::ResetAndReturn(&decode_cb_).Run(status, presentation_timestamp, |
| 321 audio_output_bytes); | 325 audio_output_bytes); |
| 322 } | 326 } |
| 323 | 327 |
| 324 } // namespace media | 328 } // namespace media |
| OLD | NEW |