OLD | NEW |
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 Java_MediaPlayerBridge_getCurrentPosition( | 387 Java_MediaPlayerBridge_getCurrentPosition( |
388 env, j_media_player_bridge_.obj())); | 388 env, j_media_player_bridge_.obj())); |
389 } | 389 } |
390 | 390 |
391 base::TimeDelta MediaPlayerBridge::GetDuration() { | 391 base::TimeDelta MediaPlayerBridge::GetDuration() { |
392 if (!prepared_) | 392 if (!prepared_) |
393 return duration_; | 393 return duration_; |
394 JNIEnv* env = base::android::AttachCurrentThread(); | 394 JNIEnv* env = base::android::AttachCurrentThread(); |
395 const int duration_ms = | 395 const int duration_ms = |
396 Java_MediaPlayerBridge_getDuration(env, j_media_player_bridge_.obj()); | 396 Java_MediaPlayerBridge_getDuration(env, j_media_player_bridge_.obj()); |
397 return duration_ms < 0 ? media::kInfiniteDuration() | 397 return duration_ms < 0 ? media::kInfiniteDuration |
398 : base::TimeDelta::FromMilliseconds(duration_ms); | 398 : base::TimeDelta::FromMilliseconds(duration_ms); |
399 } | 399 } |
400 | 400 |
401 void MediaPlayerBridge::Release() { | 401 void MediaPlayerBridge::Release() { |
402 is_active_ = false; | 402 is_active_ = false; |
403 | 403 |
404 on_decoder_resources_released_cb_.Run(player_id()); | 404 on_decoder_resources_released_cb_.Run(player_id()); |
405 if (j_media_player_bridge_.is_null()) | 405 if (j_media_player_bridge_.is_null()) |
406 return; | 406 return; |
407 | 407 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 598 |
599 GURL MediaPlayerBridge::GetUrl() { | 599 GURL MediaPlayerBridge::GetUrl() { |
600 return url_; | 600 return url_; |
601 } | 601 } |
602 | 602 |
603 GURL MediaPlayerBridge::GetFirstPartyForCookies() { | 603 GURL MediaPlayerBridge::GetFirstPartyForCookies() { |
604 return first_party_for_cookies_; | 604 return first_party_for_cookies_; |
605 } | 605 } |
606 | 606 |
607 } // namespace media | 607 } // namespace media |
OLD | NEW |