| 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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 const MediaDecoderJob::DecoderCallback& callback) { | 381 const MediaDecoderJob::DecoderCallback& callback) { |
| 382 DVLOG(1) << __FUNCTION__; | 382 DVLOG(1) << __FUNCTION__; |
| 383 DCHECK(decoder_task_runner_->BelongsToCurrentThread()); | 383 DCHECK(decoder_task_runner_->BelongsToCurrentThread()); |
| 384 TRACE_EVENT0("media", __FUNCTION__); | 384 TRACE_EVENT0("media", __FUNCTION__); |
| 385 | 385 |
| 386 if (needs_flush) { | 386 if (needs_flush) { |
| 387 DVLOG(1) << "DecodeInternal needs flush."; | 387 DVLOG(1) << "DecodeInternal needs flush."; |
| 388 input_eos_encountered_ = false; | 388 input_eos_encountered_ = false; |
| 389 output_eos_encountered_ = false; | 389 output_eos_encountered_ = false; |
| 390 input_buf_index_ = -1; | 390 input_buf_index_ = -1; |
| 391 MediaCodecStatus reset_status = media_codec_bridge_->Reset(); | 391 MediaCodecStatus flush_status = media_codec_bridge_->Flush(); |
| 392 if (MEDIA_CODEC_OK != reset_status) { | 392 if (flush_status != MEDIA_CODEC_OK) { |
| 393 callback.Run(reset_status, false, kNoTimestamp(), kNoTimestamp()); | 393 callback.Run(flush_status, false, kNoTimestamp(), kNoTimestamp()); |
| 394 return; | 394 return; |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 | 397 |
| 398 // Once output EOS has occurred, we should not be asked to decode again. | 398 // Once output EOS has occurred, we should not be asked to decode again. |
| 399 // MediaCodec has undefined behavior if similarly asked to decode after output | 399 // MediaCodec has undefined behavior if similarly asked to decode after output |
| 400 // EOS. | 400 // EOS. |
| 401 DCHECK(!output_eos_encountered_); | 401 DCHECK(!output_eos_encountered_); |
| 402 | 402 |
| 403 // For aborted access unit, just skip it and inform the player. | 403 // For aborted access unit, just skip it and inform the player. |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 683 |
| 684 void MediaDecoderJob::ReleaseMediaCodecBridge() { | 684 void MediaDecoderJob::ReleaseMediaCodecBridge() { |
| 685 if (!media_codec_bridge_) | 685 if (!media_codec_bridge_) |
| 686 return; | 686 return; |
| 687 | 687 |
| 688 media_codec_bridge_.reset(); | 688 media_codec_bridge_.reset(); |
| 689 input_buf_index_ = -1; | 689 input_buf_index_ = -1; |
| 690 } | 690 } |
| 691 | 691 |
| 692 } // namespace media | 692 } // namespace media |
| OLD | NEW |