Chromium Code Reviews| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 status != MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER); | 438 status != MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER); |
| 439 | 439 |
| 440 if (status != MEDIA_CODEC_OK) { | 440 if (status != MEDIA_CODEC_OK) { |
| 441 callback.Run(status, kNoTimestamp(), kNoTimestamp()); | 441 callback.Run(status, kNoTimestamp(), kNoTimestamp()); |
| 442 return; | 442 return; |
| 443 } | 443 } |
| 444 | 444 |
| 445 // TODO(xhwang/qinmin): This logic is correct but strange. Clean it up. | 445 // TODO(xhwang/qinmin): This logic is correct but strange. Clean it up. |
| 446 if (output_eos_encountered_) | 446 if (output_eos_encountered_) |
| 447 status = MEDIA_CODEC_OUTPUT_END_OF_STREAM; | 447 status = MEDIA_CODEC_OUTPUT_END_OF_STREAM; |
| 448 else if (has_format_change) | 448 else if (has_format_change) { |
|
qinmin
2015/01/12 23:57:15
This is on the decoder thread, you should never ca
kjoswiak
2015/01/13 00:14:30
Ahh, hmm. See my reply to Jesse's comment in patch
kjoswiak
2015/01/13 00:39:42
Looking closer, this fix wouldn't change anything.
gunsch
2015/01/13 00:45:31
Kyle: check the first line of each function. Some
qinmin
2015/01/13 00:46:51
you are touching variables like time_stamp_helper,
kjoswiak
2015/01/13 01:05:58
Hmm I see. We use audio_timestamp_helper_ in Relea
| |
| 449 status = MEDIA_CODEC_OUTPUT_FORMAT_CHANGED; | 449 status = UpdateOutputFormat(); |
| 450 if (status == MEDIA_CODEC_ERROR) { | |
| 451 callback.Run(status, kNoTimestamp(), kNoTimestamp()); | |
| 452 return; | |
| 453 } | |
| 454 } | |
| 450 | 455 |
| 451 bool render_output = presentation_timestamp >= preroll_timestamp_ && | 456 bool render_output = presentation_timestamp >= preroll_timestamp_ && |
| 452 (status != MEDIA_CODEC_OUTPUT_END_OF_STREAM || size != 0u); | 457 (status != MEDIA_CODEC_OUTPUT_END_OF_STREAM || size != 0u); |
| 453 base::TimeDelta time_to_render; | 458 base::TimeDelta time_to_render; |
| 454 DCHECK(!start_time_ticks.is_null()); | 459 DCHECK(!start_time_ticks.is_null()); |
| 455 if (render_output && ComputeTimeToRender()) { | 460 if (render_output && ComputeTimeToRender()) { |
| 456 time_to_render = presentation_timestamp - (base::TimeTicks::Now() - | 461 time_to_render = presentation_timestamp - (base::TimeTicks::Now() - |
| 457 start_time_ticks + start_presentation_timestamp); | 462 start_time_ticks + start_presentation_timestamp); |
| 458 } | 463 } |
| 459 | 464 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 DCHECK(false) << "Invalid output status"; | 541 DCHECK(false) << "Invalid output status"; |
| 537 break; | 542 break; |
| 538 }; | 543 }; |
| 539 | 544 |
| 540 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM && drain_decoder_) { | 545 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM && drain_decoder_) { |
| 541 OnDecoderDrained(); | 546 OnDecoderDrained(); |
| 542 status = MEDIA_CODEC_OK; | 547 status = MEDIA_CODEC_OK; |
| 543 } | 548 } |
| 544 | 549 |
| 545 if (status == MEDIA_CODEC_OUTPUT_FORMAT_CHANGED) { | 550 if (status == MEDIA_CODEC_OUTPUT_FORMAT_CHANGED) { |
| 546 if (UpdateOutputFormat()) | 551 config_changed_cb_.Run(); |
| 547 config_changed_cb_.Run(); | |
| 548 status = MEDIA_CODEC_OK; | 552 status = MEDIA_CODEC_OK; |
| 549 } | 553 } |
| 550 | 554 |
| 551 if (release_resources_pending_) { | 555 if (release_resources_pending_) { |
| 552 ReleaseMediaCodecBridge(); | 556 ReleaseMediaCodecBridge(); |
| 553 release_resources_pending_ = false; | 557 release_resources_pending_ = false; |
| 554 if (drain_decoder_) | 558 if (drain_decoder_) |
| 555 OnDecoderDrained(); | 559 OnDecoderDrained(); |
| 556 } | 560 } |
| 557 | 561 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 642 return CreateMediaCodecBridgeInternal(); | 646 return CreateMediaCodecBridgeInternal(); |
| 643 } | 647 } |
| 644 | 648 |
| 645 bool MediaDecoderJob::IsCodecReconfigureNeeded( | 649 bool MediaDecoderJob::IsCodecReconfigureNeeded( |
| 646 const DemuxerConfigs& configs) const { | 650 const DemuxerConfigs& configs) const { |
| 647 if (!AreDemuxerConfigsChanged(configs)) | 651 if (!AreDemuxerConfigsChanged(configs)) |
| 648 return false; | 652 return false; |
| 649 return true; | 653 return true; |
| 650 } | 654 } |
| 651 | 655 |
| 652 bool MediaDecoderJob::UpdateOutputFormat() { | |
| 653 return false; | |
| 654 } | |
| 655 | |
| 656 void MediaDecoderJob::ReleaseMediaCodecBridge() { | 656 void MediaDecoderJob::ReleaseMediaCodecBridge() { |
| 657 if (!media_codec_bridge_) | 657 if (!media_codec_bridge_) |
| 658 return; | 658 return; |
| 659 | 659 |
| 660 media_codec_bridge_.reset(); | 660 media_codec_bridge_.reset(); |
| 661 input_buf_index_ = -1; | 661 input_buf_index_ = -1; |
| 662 } | 662 } |
| 663 | 663 |
| 664 } // namespace media | 664 } // namespace media |
| OLD | NEW |