| 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 MediaCodecStatus status = | 424 MediaCodecStatus status = |
| 425 media_codec_bridge_->DequeueOutputBuffer(timeout, | 425 media_codec_bridge_->DequeueOutputBuffer(timeout, |
| 426 &buffer_index, | 426 &buffer_index, |
| 427 &offset, | 427 &offset, |
| 428 &size, | 428 &size, |
| 429 &presentation_timestamp, | 429 &presentation_timestamp, |
| 430 &output_eos_encountered_, | 430 &output_eos_encountered_, |
| 431 NULL); | 431 NULL); |
| 432 | 432 |
| 433 if (status != MEDIA_CODEC_OK) { | 433 if (status != MEDIA_CODEC_OK) { |
| 434 if (status == MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED && | |
| 435 !media_codec_bridge_->GetOutputBuffers()) { | |
| 436 status = MEDIA_CODEC_ERROR; | |
| 437 } | |
| 438 callback.Run(status, kNoTimestamp(), kNoTimestamp()); | 434 callback.Run(status, kNoTimestamp(), kNoTimestamp()); |
| 439 return; | 435 return; |
| 440 } | 436 } |
| 441 | 437 |
| 442 // TODO(xhwang/qinmin): This logic is correct but strange. Clean it up. | 438 // TODO(xhwang/qinmin): This logic is correct but strange. Clean it up. |
| 443 if (output_eos_encountered_) | 439 if (output_eos_encountered_) |
| 444 status = MEDIA_CODEC_OUTPUT_END_OF_STREAM; | 440 status = MEDIA_CODEC_OUTPUT_END_OF_STREAM; |
| 445 | 441 |
| 446 bool render_output = presentation_timestamp >= preroll_timestamp_ && | 442 bool render_output = presentation_timestamp >= preroll_timestamp_ && |
| 447 (status != MEDIA_CODEC_OUTPUT_END_OF_STREAM || size != 0u); | 443 (status != MEDIA_CODEC_OUTPUT_END_OF_STREAM || size != 0u); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 | 640 |
| 645 void MediaDecoderJob::ReleaseMediaCodecBridge() { | 641 void MediaDecoderJob::ReleaseMediaCodecBridge() { |
| 646 if (!media_codec_bridge_) | 642 if (!media_codec_bridge_) |
| 647 return; | 643 return; |
| 648 | 644 |
| 649 media_codec_bridge_.reset(); | 645 media_codec_bridge_.reset(); |
| 650 input_buf_index_ = -1; | 646 input_buf_index_ = -1; |
| 651 } | 647 } |
| 652 | 648 |
| 653 } // namespace media | 649 } // namespace media |
| OLD | NEW |