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

Unified Diff: media/base/android/media_source_player.cc

Issue 53413004: Clear any pending surface change prior to checking media crypto in MSP::ConfigureVideoDecoderJob() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move job reset and clearing any pending surface change event after the browser seek logic Created 7 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/media_source_player.cc
diff --git a/media/base/android/media_source_player.cc b/media/base/android/media_source_player.cc
index 8e23a91629331fc6f8df18098a23ee69d37915d2..0944b87984a6a1a52dcf856b270dd1aa081baa46 100644
--- a/media/base/android/media_source_player.cc
+++ b/media/base/android/media_source_player.cc
@@ -727,8 +727,10 @@ void MediaSourcePlayer::ConfigureVideoDecoderJob() {
}
// Create video decoder job only if config changes or we don't have a job.
- if (video_decoder_job_ && !reconfig_video_decoder_)
+ if (video_decoder_job_ && !reconfig_video_decoder_) {
+ DCHECK(!IsEventPending(SURFACE_CHANGE_EVENT_PENDING));
return;
+ }
if (reconfig_video_decoder_) {
// No hack browser seek should be required. I-Frame must be next.
@@ -736,9 +738,13 @@ void MediaSourcePlayer::ConfigureVideoDecoderJob() {
<< "detecting video config change and reconfiguring video decoder";
}
+ DCHECK(!video_decoder_job_ || !video_decoder_job_->is_decoding());
+
// If uncertain that video I-frame data is next and there is no seek already
// in process, request browser demuxer seek so the new decoder will decode
// an I-frame first. Otherwise, the new MediaCodec might crash. See b/8950387.
+ // Eventual OnDemuxerSeekDone() will trigger ProcessPendingEvents() and
+ // continue from here.
// TODO(wolenetz): Instead of doing hack browser seek, replay cached data
// since last keyframe. See http://crbug.com/304234.
if (!next_video_data_is_iframe_ && !IsEventPending(SEEK_EVENT_PENDING)) {
@@ -746,17 +752,22 @@ void MediaSourcePlayer::ConfigureVideoDecoderJob() {
return;
}
+ // Release the old VideoDecoderJob first so the surface can get released.
+ // Android does not allow 2 MediaCodec instances use the same surface.
+ video_decoder_job_.reset();
+
+ // Now that we have ensured the job is reset, clear any pending surface change
+ // event. If there was such an event, eventual job re-creation, below, will
+ // use the current |surface_|.
+ if (IsEventPending(SURFACE_CHANGE_EVENT_PENDING))
+ ClearPendingEvent(SURFACE_CHANGE_EVENT_PENDING);
+
base::android::ScopedJavaLocalRef<jobject> media_crypto = GetMediaCrypto();
if (is_video_encrypted_ && media_crypto.is_null())
return;
- DCHECK(!video_decoder_job_ || !video_decoder_job_->is_decoding());
-
DVLOG(1) << __FUNCTION__ << " : creating new video decoder job";
- // Release the old VideoDecoderJob first so the surface can get released.
- // Android does not allow 2 MediaCodec instances use the same surface.
- video_decoder_job_.reset();
// Create the new VideoDecoderJob.
bool is_secure = IsProtectedSurfaceRequired();
video_decoder_job_.reset(
@@ -773,9 +784,6 @@ void MediaSourcePlayer::ConfigureVideoDecoderJob() {
reconfig_video_decoder_ = false;
}
- if (IsEventPending(SURFACE_CHANGE_EVENT_PENDING))
- ClearPendingEvent(SURFACE_CHANGE_EVENT_PENDING);
-
// Inform the fullscreen view the player is ready.
// TODO(qinmin): refactor MediaPlayerBridge so that we have a better way
// to inform ContentVideoView.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698