OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_source_player.h" | 5 #include "media/base/android/media_source_player.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM) { | 491 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM) { |
492 if (is_audio) | 492 if (is_audio) |
493 SetAudible(false); | 493 SetAudible(false); |
494 return; | 494 return; |
495 } | 495 } |
496 | 496 |
497 if (!playing_) { | 497 if (!playing_) { |
498 if (is_clock_manager) | 498 if (is_clock_manager) |
499 interpolator_.StopInterpolating(); | 499 interpolator_.StopInterpolating(); |
500 | 500 |
501 if (is_audio) | 501 if (is_audio) |
qinmin
2015/04/14 02:55:10
how about move this to line 485 ? also, what about
timav
2015/04/28 02:17:55
I cannot do that because of false starvations whic
| |
502 SetAudible(false); | 502 SetAudible(false); |
503 return; | 503 return; |
504 } | 504 } |
505 | 505 |
506 if (status == MEDIA_CODEC_NO_KEY) { | 506 if (status == MEDIA_CODEC_NO_KEY) { |
507 if (key_added_while_decode_pending_) { | 507 if (key_added_while_decode_pending_) { |
508 DVLOG(2) << __FUNCTION__ << ": Key was added during decoding."; | 508 DVLOG(2) << __FUNCTION__ << ": Key was added during decoding."; |
509 ResumePlaybackAfterKeyAdded(); | 509 ResumePlaybackAfterKeyAdded(); |
510 } else { | 510 } else { |
511 if (is_audio) | 511 if (is_audio) |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
721 return; | 721 return; |
722 } | 722 } |
723 | 723 |
724 ClearPendingEvent(PREFETCH_DONE_EVENT_PENDING); | 724 ClearPendingEvent(PREFETCH_DONE_EVENT_PENDING); |
725 | 725 |
726 if (pending_event_ != NO_EVENT_PENDING) { | 726 if (pending_event_ != NO_EVENT_PENDING) { |
727 ProcessPendingEvents(); | 727 ProcessPendingEvents(); |
728 return; | 728 return; |
729 } | 729 } |
730 | 730 |
731 if (!playing_) | 731 if (!playing_) { |
732 SetAudible(false); | |
732 return; | 733 return; |
734 } | |
733 | 735 |
734 start_time_ticks_ = base::TimeTicks::Now(); | 736 start_time_ticks_ = base::TimeTicks::Now(); |
735 start_presentation_timestamp_ = GetCurrentTime(); | 737 start_presentation_timestamp_ = GetCurrentTime(); |
736 if (!interpolator_.interpolating()) | 738 if (!interpolator_.interpolating()) |
737 interpolator_.StartInterpolating(); | 739 interpolator_.StartInterpolating(); |
738 | 740 |
739 if (!AudioFinished()) | 741 if (!AudioFinished()) |
740 DecodeMoreAudio(); | 742 DecodeMoreAudio(); |
743 else | |
744 SetAudible(false); | |
745 | |
741 | 746 |
742 if (!VideoFinished()) | 747 if (!VideoFinished()) |
743 DecodeMoreVideo(); | 748 DecodeMoreVideo(); |
744 } | 749 } |
745 | 750 |
746 void MediaSourcePlayer::OnDemuxerConfigsChanged() { | 751 void MediaSourcePlayer::OnDemuxerConfigsChanged() { |
747 manager()->OnMediaMetadataChanged( | 752 manager()->OnMediaMetadataChanged( |
748 player_id(), duration_, GetVideoWidth(), GetVideoHeight(), true); | 753 player_id(), duration_, GetVideoWidth(), GetVideoHeight(), true); |
749 } | 754 } |
750 | 755 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
833 // support setMediaKeys(0) (see http://crbug.com/330324), or when we release | 838 // support setMediaKeys(0) (see http://crbug.com/330324), or when we release |
834 // MediaDrm when the video is paused, or when the device goes to sleep (see | 839 // MediaDrm when the video is paused, or when the device goes to sleep (see |
835 // http://crbug.com/272421). | 840 // http://crbug.com/272421). |
836 audio_decoder_job_->SetDrmBridge(NULL); | 841 audio_decoder_job_->SetDrmBridge(NULL); |
837 video_decoder_job_->SetDrmBridge(NULL); | 842 video_decoder_job_->SetDrmBridge(NULL); |
838 cdm_registration_id_ = 0; | 843 cdm_registration_id_ = 0; |
839 drm_bridge_ = NULL; | 844 drm_bridge_ = NULL; |
840 } | 845 } |
841 | 846 |
842 } // namespace media | 847 } // namespace media |
OLD | NEW |