| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 UpdateEffectiveVolume(); | 123 UpdateEffectiveVolume(); |
| 124 | 124 |
| 125 AttachListener(j_media_player_bridge_.obj()); | 125 AttachListener(j_media_player_bridge_.obj()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void MediaPlayerBridge::SetDuration(base::TimeDelta duration) { | 128 void MediaPlayerBridge::SetDuration(base::TimeDelta duration) { |
| 129 duration_ = duration; | 129 duration_ = duration; |
| 130 } | 130 } |
| 131 | 131 |
| 132 void MediaPlayerBridge::SetVideoSurface(gfx::ScopedJavaSurface surface) { | 132 void MediaPlayerBridge::SetVideoSurface(gl::ScopedJavaSurface surface) { |
| 133 surface_ = std::move(surface); | 133 surface_ = std::move(surface); |
| 134 | 134 |
| 135 if (j_media_player_bridge_.is_null()) | 135 if (j_media_player_bridge_.is_null()) |
| 136 return; | 136 return; |
| 137 | 137 |
| 138 JNIEnv* env = base::android::AttachCurrentThread(); | 138 JNIEnv* env = base::android::AttachCurrentThread(); |
| 139 CHECK(env); | 139 CHECK(env); |
| 140 | 140 |
| 141 Java_MediaPlayerBridge_setSurface( | 141 Java_MediaPlayerBridge_setSurface( |
| 142 env, j_media_player_bridge_.obj(), surface_.j_surface().obj()); | 142 env, j_media_player_bridge_.obj(), surface_.j_surface().obj()); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 return; | 406 return; |
| 407 | 407 |
| 408 time_update_timer_.Stop(); | 408 time_update_timer_.Stop(); |
| 409 if (prepared_) { | 409 if (prepared_) { |
| 410 pending_seek_ = GetCurrentTime(); | 410 pending_seek_ = GetCurrentTime(); |
| 411 should_seek_on_prepare_ = true; | 411 should_seek_on_prepare_ = true; |
| 412 } | 412 } |
| 413 | 413 |
| 414 prepared_ = false; | 414 prepared_ = false; |
| 415 pending_play_ = false; | 415 pending_play_ = false; |
| 416 SetVideoSurface(gfx::ScopedJavaSurface()); | 416 SetVideoSurface(gl::ScopedJavaSurface()); |
| 417 JNIEnv* env = base::android::AttachCurrentThread(); | 417 JNIEnv* env = base::android::AttachCurrentThread(); |
| 418 Java_MediaPlayerBridge_release(env, j_media_player_bridge_.obj()); | 418 Java_MediaPlayerBridge_release(env, j_media_player_bridge_.obj()); |
| 419 j_media_player_bridge_.Reset(); | 419 j_media_player_bridge_.Reset(); |
| 420 DetachListener(); | 420 DetachListener(); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void MediaPlayerBridge::UpdateEffectiveVolumeInternal(double effective_volume) { | 423 void MediaPlayerBridge::UpdateEffectiveVolumeInternal(double effective_volume) { |
| 424 if (j_media_player_bridge_.is_null()) { | 424 if (j_media_player_bridge_.is_null()) { |
| 425 return; | 425 return; |
| 426 } | 426 } |
| (...skipping 171 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 |