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" |
11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "jni/MediaPlayerBridge_jni.h" | 13 #include "jni/MediaPlayerBridge_jni.h" |
14 #include "media/base/android/media_common_android.h" | 14 #include "media/base/android/media_common_android.h" |
15 #include "media/base/android/media_player_manager.h" | 15 #include "media/base/android/media_player_manager.h" |
16 #include "media/base/android/media_resource_getter.h" | 16 #include "media/base/android/media_resource_getter.h" |
17 #include "media/base/android/media_url_interceptor.h" | 17 #include "media/base/android/media_url_interceptor.h" |
18 #include "media/base/buffers.h" | 18 #include "media/base/buffers.h" |
19 | 19 |
20 | |
aberent
2014/10/20 14:55:55
Why the extra blank line?
dgn
2014/10/20 15:43:20
Done.
| |
20 using base::android::ConvertUTF8ToJavaString; | 21 using base::android::ConvertUTF8ToJavaString; |
21 using base::android::ScopedJavaLocalRef; | 22 using base::android::ScopedJavaLocalRef; |
22 | 23 |
23 namespace media { | 24 namespace media { |
24 | 25 |
25 MediaPlayerBridge::MediaPlayerBridge( | 26 MediaPlayerBridge::MediaPlayerBridge( |
26 int player_id, | 27 int player_id, |
27 const GURL& url, | 28 const GURL& url, |
28 const GURL& first_party_for_cookies, | 29 const GURL& first_party_for_cookies, |
29 const std::string& user_agent, | 30 const std::string& user_agent, |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 | 411 |
411 void MediaPlayerBridge::OnMediaPrepared() { | 412 void MediaPlayerBridge::OnMediaPrepared() { |
412 if (j_media_player_bridge_.is_null()) | 413 if (j_media_player_bridge_.is_null()) |
413 return; | 414 return; |
414 | 415 |
415 prepared_ = true; | 416 prepared_ = true; |
416 duration_ = GetDuration(); | 417 duration_ = GetDuration(); |
417 | 418 |
418 // If media player was recovered from a saved state, consume all the pending | 419 // If media player was recovered from a saved state, consume all the pending |
419 // events. | 420 // events. |
420 PendingSeekInternal(pending_seek_); | 421 if (pending_seek_.InMilliseconds() >= 0) { // Initialized at -1 |
422 PendingSeekInternal(pending_seek_); | |
423 } | |
421 | 424 |
422 if (pending_play_) { | 425 if (pending_play_) { |
423 StartInternal(); | 426 StartInternal(); |
424 pending_play_ = false; | 427 pending_play_ = false; |
425 } | 428 } |
426 | 429 |
427 UpdateAllowedOperations(); | 430 UpdateAllowedOperations(); |
428 manager()->OnMediaMetadataChanged( | 431 manager()->OnMediaMetadataChanged( |
429 player_id(), duration_, width_, height_, true); | 432 player_id(), duration_, width_, height_, true); |
430 } | 433 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 | 521 |
519 GURL MediaPlayerBridge::GetUrl() { | 522 GURL MediaPlayerBridge::GetUrl() { |
520 return url_; | 523 return url_; |
521 } | 524 } |
522 | 525 |
523 GURL MediaPlayerBridge::GetFirstPartyForCookies() { | 526 GURL MediaPlayerBridge::GetFirstPartyForCookies() { |
524 return first_party_for_cookies_; | 527 return first_party_for_cookies_; |
525 } | 528 } |
526 | 529 |
527 } // namespace media | 530 } // namespace media |
OLD | NEW |