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 "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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 SetVideoSurface(gfx::ScopedJavaSurface()); | 317 SetVideoSurface(gfx::ScopedJavaSurface()); |
318 JNIEnv* env = base::android::AttachCurrentThread(); | 318 JNIEnv* env = base::android::AttachCurrentThread(); |
319 Java_MediaPlayerBridge_release(env, j_media_player_bridge_.obj()); | 319 Java_MediaPlayerBridge_release(env, j_media_player_bridge_.obj()); |
320 j_media_player_bridge_.Reset(); | 320 j_media_player_bridge_.Reset(); |
321 release_media_resources_cb_.Run(player_id()); | 321 release_media_resources_cb_.Run(player_id()); |
322 listener_->ReleaseMediaPlayerListenerResources(); | 322 listener_->ReleaseMediaPlayerListenerResources(); |
323 } | 323 } |
324 | 324 |
325 void MediaPlayerBridge::SetVolume(double volume) { | 325 void MediaPlayerBridge::SetVolume(double volume) { |
326 if (j_media_player_bridge_.is_null()) | 326 if (j_media_player_bridge_.is_null()) |
327 return; | 327 Prepare(); |
qinmin
2014/05/27 15:09:53
The player could get destroyed if releaseMediaReso
| |
328 | 328 |
329 JNIEnv* env = base::android::AttachCurrentThread(); | 329 JNIEnv* env = base::android::AttachCurrentThread(); |
330 CHECK(env); | 330 CHECK(env); |
331 Java_MediaPlayerBridge_setVolume( | 331 Java_MediaPlayerBridge_setVolume( |
332 env, j_media_player_bridge_.obj(), volume); | 332 env, j_media_player_bridge_.obj(), volume); |
333 } | 333 } |
334 | 334 |
335 void MediaPlayerBridge::OnVideoSizeChanged(int width, int height) { | 335 void MediaPlayerBridge::OnVideoSizeChanged(int width, int height) { |
336 width_ = width; | 336 width_ = width; |
337 height_ = height; | 337 height_ = height; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 | 473 |
474 GURL MediaPlayerBridge::GetFirstPartyForCookies() { | 474 GURL MediaPlayerBridge::GetFirstPartyForCookies() { |
475 return first_party_for_cookies_; | 475 return first_party_for_cookies_; |
476 } | 476 } |
477 | 477 |
478 bool MediaPlayerBridge::IsSurfaceInUse() const { | 478 bool MediaPlayerBridge::IsSurfaceInUse() const { |
479 return is_surface_in_use_; | 479 return is_surface_in_use_; |
480 } | 480 } |
481 | 481 |
482 } // namespace media | 482 } // namespace media |
OLD | NEW |