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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 ProcessPendingEvents(); | 474 ProcessPendingEvents(); |
475 return; | 475 return; |
476 } | 476 } |
477 | 477 |
478 if ((status == MEDIA_CODEC_OK || status == MEDIA_CODEC_INPUT_END_OF_STREAM) && | 478 if ((status == MEDIA_CODEC_OK || status == MEDIA_CODEC_INPUT_END_OF_STREAM) && |
479 is_clock_manager && current_presentation_timestamp != kNoTimestamp()) { | 479 is_clock_manager && current_presentation_timestamp != kNoTimestamp()) { |
480 UpdateTimestamps(current_presentation_timestamp, | 480 UpdateTimestamps(current_presentation_timestamp, |
481 max_presentation_timestamp); | 481 max_presentation_timestamp); |
482 } | 482 } |
483 | 483 |
484 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM) | 484 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM) { |
485 PlaybackCompleted(is_audio); | 485 PlaybackCompleted(is_audio); |
| 486 if (is_clock_manager) |
| 487 interpolator_.StopInterpolating(); |
| 488 } |
486 | 489 |
487 if (pending_event_ != NO_EVENT_PENDING) { | 490 if (pending_event_ != NO_EVENT_PENDING) { |
488 ProcessPendingEvents(); | 491 ProcessPendingEvents(); |
489 return; | 492 return; |
490 } | 493 } |
491 | 494 |
492 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM) | 495 if (status == MEDIA_CODEC_OUTPUT_END_OF_STREAM) |
493 return; | 496 return; |
494 | 497 |
495 if (!playing_) { | 498 if (!playing_) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 is_waiting_for_video_decoder_ = true; | 572 is_waiting_for_video_decoder_ = true; |
570 if (!IsEventPending(DECODER_CREATION_EVENT_PENDING)) | 573 if (!IsEventPending(DECODER_CREATION_EVENT_PENDING)) |
571 SetPendingEvent(DECODER_CREATION_EVENT_PENDING); | 574 SetPendingEvent(DECODER_CREATION_EVENT_PENDING); |
572 } | 575 } |
573 | 576 |
574 void MediaSourcePlayer::PlaybackCompleted(bool is_audio) { | 577 void MediaSourcePlayer::PlaybackCompleted(bool is_audio) { |
575 DVLOG(1) << __FUNCTION__ << "(" << is_audio << ")"; | 578 DVLOG(1) << __FUNCTION__ << "(" << is_audio << ")"; |
576 | 579 |
577 if (AudioFinished() && VideoFinished()) { | 580 if (AudioFinished() && VideoFinished()) { |
578 playing_ = false; | 581 playing_ = false; |
579 interpolator_.StopInterpolating(); | |
580 start_time_ticks_ = base::TimeTicks(); | 582 start_time_ticks_ = base::TimeTicks(); |
581 manager()->OnPlaybackComplete(player_id()); | 583 manager()->OnPlaybackComplete(player_id()); |
582 } | 584 } |
583 } | 585 } |
584 | 586 |
585 void MediaSourcePlayer::ClearDecodingData() { | 587 void MediaSourcePlayer::ClearDecodingData() { |
586 DVLOG(1) << __FUNCTION__; | 588 DVLOG(1) << __FUNCTION__; |
587 audio_decoder_job_->Flush(); | 589 audio_decoder_job_->Flush(); |
588 video_decoder_job_->Flush(); | 590 video_decoder_job_->Flush(); |
589 start_time_ticks_ = base::TimeTicks(); | 591 start_time_ticks_ = base::TimeTicks(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 // release MediaDrm when the video is paused, or when the device goes to | 756 // release MediaDrm when the video is paused, or when the device goes to |
755 // sleep (see http://crbug.com/272421). | 757 // sleep (see http://crbug.com/272421). |
756 NOTREACHED() << "CDM detachment not supported."; | 758 NOTREACHED() << "CDM detachment not supported."; |
757 DCHECK(drm_bridge_); | 759 DCHECK(drm_bridge_); |
758 audio_decoder_job_->SetDrmBridge(NULL); | 760 audio_decoder_job_->SetDrmBridge(NULL); |
759 video_decoder_job_->SetDrmBridge(NULL); | 761 video_decoder_job_->SetDrmBridge(NULL); |
760 drm_bridge_ = NULL; | 762 drm_bridge_ = NULL; |
761 } | 763 } |
762 | 764 |
763 } // namespace media | 765 } // namespace media |
OLD | NEW |