| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 // MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER is received. | 423 // MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER is received. |
| 424 do { | 424 do { |
| 425 status = media_codec_bridge_->DequeueOutputBuffer( | 425 status = media_codec_bridge_->DequeueOutputBuffer( |
| 426 timeout, | 426 timeout, |
| 427 &buffer_index, | 427 &buffer_index, |
| 428 &offset, | 428 &offset, |
| 429 &size, | 429 &size, |
| 430 &presentation_timestamp, | 430 &presentation_timestamp, |
| 431 &output_eos_encountered_, | 431 &output_eos_encountered_, |
| 432 NULL); | 432 NULL); |
| 433 if (status == MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED && | 433 if (status == MEDIA_CODEC_OUTPUT_FORMAT_CHANGED) { |
| 434 !media_codec_bridge_->GetOutputBuffers()) { | |
| 435 status = MEDIA_CODEC_ERROR; | |
| 436 } else if (status == MEDIA_CODEC_OUTPUT_FORMAT_CHANGED) { | |
| 437 // TODO(qinmin): instead of waiting for the next output buffer to be | 434 // TODO(qinmin): instead of waiting for the next output buffer to be |
| 438 // dequeued, post a task on the UI thread to signal the format change. | 435 // dequeued, post a task on the UI thread to signal the format change. |
| 439 has_format_change = true; | 436 has_format_change = true; |
| 440 } | 437 } |
| 441 } while (status != MEDIA_CODEC_OK && status != MEDIA_CODEC_ERROR && | 438 } while (status != MEDIA_CODEC_OK && status != MEDIA_CODEC_ERROR && |
| 442 status != MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER); | 439 status != MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER); |
| 443 | 440 |
| 444 if (status != MEDIA_CODEC_OK) { | 441 if (status != MEDIA_CODEC_OK) { |
| 445 callback.Run(status, kNoTimestamp(), kNoTimestamp()); | 442 callback.Run(status, kNoTimestamp(), kNoTimestamp()); |
| 446 return; | 443 return; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 | 656 |
| 660 void MediaDecoderJob::ReleaseMediaCodecBridge() { | 657 void MediaDecoderJob::ReleaseMediaCodecBridge() { |
| 661 if (!media_codec_bridge_) | 658 if (!media_codec_bridge_) |
| 662 return; | 659 return; |
| 663 | 660 |
| 664 media_codec_bridge_.reset(); | 661 media_codec_bridge_.reset(); |
| 665 input_buf_index_ = -1; | 662 input_buf_index_ = -1; |
| 666 } | 663 } |
| 667 | 664 |
| 668 } // namespace media | 665 } // namespace media |
| OLD | NEW |