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

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

Issue 2626443003: Improve MediaPlayerBridge seek resiliance (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « content/browser/media/android/media_player_renderer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_player_bridge.h" 5 #include "media/base/android/media_player_bridge.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/android/context_utils.h" 9 #include "base/android/context_utils.h"
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 MediaPlayerAndroid::OnMediaInterrupted(); 461 MediaPlayerAndroid::OnMediaInterrupted();
462 } 462 }
463 463
464 void MediaPlayerBridge::OnMediaPrepared() { 464 void MediaPlayerBridge::OnMediaPrepared() {
465 if (j_media_player_bridge_.is_null()) 465 if (j_media_player_bridge_.is_null())
466 return; 466 return;
467 467
468 prepared_ = true; 468 prepared_ = true;
469 duration_ = GetDuration(); 469 duration_ = GetDuration();
470 470
471 UpdateAllowedOperations();
472
471 // If media player was recovered from a saved state, consume all the pending 473 // If media player was recovered from a saved state, consume all the pending
472 // events. 474 // events.
473 if (should_seek_on_prepare_) { 475 if (should_seek_on_prepare_) {
474 PendingSeekInternal(pending_seek_); 476 PendingSeekInternal(pending_seek_);
475 pending_seek_ = base::TimeDelta::FromMilliseconds(0); 477 pending_seek_ = base::TimeDelta::FromMilliseconds(0);
476 should_seek_on_prepare_ = false; 478 should_seek_on_prepare_ = false;
477 } 479 }
478 480
479 if (!surface_.IsEmpty()) 481 if (!surface_.IsEmpty())
480 SetVideoSurface(std::move(surface_)); 482 SetVideoSurface(std::move(surface_));
481 483
482 if (pending_play_) { 484 if (pending_play_) {
483 StartInternal(); 485 StartInternal();
484 pending_play_ = false; 486 pending_play_ = false;
485 } 487 }
486 488
487 UpdateAllowedOperations();
488 manager()->OnMediaMetadataChanged( 489 manager()->OnMediaMetadataChanged(
489 player_id(), duration_, width_, height_, true); 490 player_id(), duration_, width_, height_, true);
490 } 491 }
491 492
492 ScopedJavaLocalRef<jobject> MediaPlayerBridge::GetAllowedOperations() { 493 ScopedJavaLocalRef<jobject> MediaPlayerBridge::GetAllowedOperations() {
493 JNIEnv* env = base::android::AttachCurrentThread(); 494 JNIEnv* env = base::android::AttachCurrentThread();
494 CHECK(env); 495 CHECK(env);
495 496
496 return Java_MediaPlayerBridge_getAllowedOperations(env, 497 return Java_MediaPlayerBridge_getAllowedOperations(env,
497 j_media_player_bridge_); 498 j_media_player_bridge_);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 595
595 GURL MediaPlayerBridge::GetUrl() { 596 GURL MediaPlayerBridge::GetUrl() {
596 return url_; 597 return url_;
597 } 598 }
598 599
599 GURL MediaPlayerBridge::GetFirstPartyForCookies() { 600 GURL MediaPlayerBridge::GetFirstPartyForCookies() {
600 return first_party_for_cookies_; 601 return first_party_for_cookies_;
601 } 602 }
602 603
603 } // namespace media 604 } // namespace media
OLDNEW
« no previous file with comments | « content/browser/media/android/media_player_renderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698