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

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

Issue 22605013: Fix HLS playback on android 4.3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 JNIEnv* env = base::android::AttachCurrentThread(); 383 JNIEnv* env = base::android::AttachCurrentThread();
384 Java_MediaPlayerBridge_pause(env, j_media_player_bridge_.obj()); 384 Java_MediaPlayerBridge_pause(env, j_media_player_bridge_.obj());
385 time_update_timer_.Stop(); 385 time_update_timer_.Stop();
386 } 386 }
387 387
388 void MediaPlayerBridge::PendingSeekInternal(base::TimeDelta time) { 388 void MediaPlayerBridge::PendingSeekInternal(base::TimeDelta time) {
389 SeekInternal(time); 389 SeekInternal(time);
390 } 390 }
391 391
392 void MediaPlayerBridge::SeekInternal(base::TimeDelta time) { 392 void MediaPlayerBridge::SeekInternal(base::TimeDelta time) {
393 if (time > duration_)
394 time = duration_;
395
396 // Seeking to an invalid position may cause media player to stuck in an
397 // error state.
398 if (time < base::TimeDelta()) {
399 DCHECK_EQ(-1.0, time.InMillisecondsF());
400 return;
401 }
402
393 JNIEnv* env = base::android::AttachCurrentThread(); 403 JNIEnv* env = base::android::AttachCurrentThread();
394 CHECK(env); 404 CHECK(env);
395 405
396 int time_msec = static_cast<int>(time.InMilliseconds()); 406 int time_msec = static_cast<int>(time.InMilliseconds());
397 Java_MediaPlayerBridge_seekTo( 407 Java_MediaPlayerBridge_seekTo(
398 env, j_media_player_bridge_.obj(), time_msec); 408 env, j_media_player_bridge_.obj(), time_msec);
399 } 409 }
400 410
401 bool MediaPlayerBridge::RegisterMediaPlayerBridge(JNIEnv* env) { 411 bool MediaPlayerBridge::RegisterMediaPlayerBridge(JNIEnv* env) {
402 bool ret = RegisterNativesImpl(env); 412 bool ret = RegisterNativesImpl(env);
(...skipping 19 matching lines...) Expand all
422 432
423 GURL MediaPlayerBridge::GetUrl() { 433 GURL MediaPlayerBridge::GetUrl() {
424 return url_; 434 return url_;
425 } 435 }
426 436
427 GURL MediaPlayerBridge::GetFirstPartyForCookies() { 437 GURL MediaPlayerBridge::GetFirstPartyForCookies() {
428 return first_party_for_cookies_; 438 return first_party_for_cookies_;
429 } 439 }
430 440
431 } // namespace media 441 } // namespace media
OLDNEW
« 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