Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: media/base/android/media_source_player.cc

Issue 50433007: Allow simultaneous audio and video config change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address acolwell's comment from PS2 Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 start_time_ticks_, start_presentation_timestamp_, base::Bind( 648 start_time_ticks_, start_presentation_timestamp_, base::Bind(
649 &MediaSourcePlayer::MediaDecoderCallback, 649 &MediaSourcePlayer::MediaDecoderCallback,
650 weak_this_.GetWeakPtr(), true))) { 650 weak_this_.GetWeakPtr(), true))) {
651 TRACE_EVENT_ASYNC_BEGIN0("media", "MediaSourcePlayer::DecodeMoreAudio", 651 TRACE_EVENT_ASYNC_BEGIN0("media", "MediaSourcePlayer::DecodeMoreAudio",
652 audio_decoder_job_.get()); 652 audio_decoder_job_.get());
653 return; 653 return;
654 } 654 }
655 655
656 // Failed to start the next decode. 656 // Failed to start the next decode.
657 // Wait for demuxer ready message. 657 // Wait for demuxer ready message.
658 DCHECK(!reconfig_audio_decoder_);
658 reconfig_audio_decoder_ = true; 659 reconfig_audio_decoder_ = true;
660
661 // Config change may have just been detected on the other stream. If so,
662 // don't send a duplicate demuxer config request.
663 if (IsEventPending(CONFIG_CHANGE_EVENT_PENDING)) {
664 DCHECK(reconfig_video_decoder_);
xhwang 2013/11/04 21:55:48 hmm, isn't this always true given line 659? Or are
wolenetz 2013/11/04 22:00:55 This DCHECK is to ensure that the CONFIG_CHANGE_EV
xhwang1 2013/11/05 02:30:21 Oh, I didn't realize it's "video", not "audio". So
665 return;
666 }
667
659 SetPendingEvent(CONFIG_CHANGE_EVENT_PENDING); 668 SetPendingEvent(CONFIG_CHANGE_EVENT_PENDING);
660 ProcessPendingEvents(); 669 ProcessPendingEvents();
661 } 670 }
662 671
663 void MediaSourcePlayer::DecodeMoreVideo() { 672 void MediaSourcePlayer::DecodeMoreVideo() {
664 DVLOG(1) << __FUNCTION__; 673 DVLOG(1) << __FUNCTION__;
665 DCHECK(!video_decoder_job_->is_decoding()); 674 DCHECK(!video_decoder_job_->is_decoding());
666 675
667 if (video_decoder_job_->Decode( 676 if (video_decoder_job_->Decode(
668 start_time_ticks_, start_presentation_timestamp_, base::Bind( 677 start_time_ticks_, start_presentation_timestamp_, base::Bind(
669 &MediaSourcePlayer::MediaDecoderCallback, 678 &MediaSourcePlayer::MediaDecoderCallback,
670 weak_this_.GetWeakPtr(), false))) { 679 weak_this_.GetWeakPtr(), false))) {
671 TRACE_EVENT_ASYNC_BEGIN0("media", "MediaSourcePlayer::DecodeMoreVideo", 680 TRACE_EVENT_ASYNC_BEGIN0("media", "MediaSourcePlayer::DecodeMoreVideo",
672 video_decoder_job_.get()); 681 video_decoder_job_.get());
673 return; 682 return;
674 } 683 }
675 684
676 // Failed to start the next decode. 685 // Failed to start the next decode.
677 // Wait for demuxer ready message. 686 // Wait for demuxer ready message.
678 reconfig_video_decoder_ = true;
679 687
680 // After this detection of video config change, next video data received 688 // After this detection of video config change, next video data received
681 // will begin with I-frame. 689 // will begin with I-frame.
682 next_video_data_is_iframe_ = true; 690 next_video_data_is_iframe_ = true;
683 691
692 DCHECK(!reconfig_video_decoder_);
693 reconfig_video_decoder_ = true;
694
695 // Config change may have just been detected on the other stream. If so,
696 // don't send a duplicate demuxer config request.
697 if (IsEventPending(CONFIG_CHANGE_EVENT_PENDING)) {
698 DCHECK(reconfig_audio_decoder_);
699 return;
700 }
701
684 SetPendingEvent(CONFIG_CHANGE_EVENT_PENDING); 702 SetPendingEvent(CONFIG_CHANGE_EVENT_PENDING);
685 ProcessPendingEvents(); 703 ProcessPendingEvents();
686 } 704 }
687 705
688 void MediaSourcePlayer::PlaybackCompleted(bool is_audio) { 706 void MediaSourcePlayer::PlaybackCompleted(bool is_audio) {
689 DVLOG(1) << __FUNCTION__ << "(" << is_audio << ")"; 707 DVLOG(1) << __FUNCTION__ << "(" << is_audio << ")";
690 if (is_audio) 708 if (is_audio)
691 audio_finished_ = true; 709 audio_finished_ = true;
692 else 710 else
693 video_finished_ = true; 711 video_finished_ = true;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 945
928 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) { 946 void MediaSourcePlayer::ClearPendingEvent(PendingEventFlags event) {
929 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")"; 947 DVLOG(1) << __FUNCTION__ << "(" << GetEventName(event) << ")";
930 DCHECK_NE(event, NO_EVENT_PENDING); 948 DCHECK_NE(event, NO_EVENT_PENDING);
931 DCHECK(IsEventPending(event)) << GetEventName(event); 949 DCHECK(IsEventPending(event)) << GetEventName(event);
932 950
933 pending_event_ &= ~event; 951 pending_event_ &= ~event;
934 } 952 }
935 953
936 } // namespace media 954 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/media_source_player.h ('k') | media/base/android/media_source_player_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698