OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "ui/gfx/image/image.h" | 65 #include "ui/gfx/image/image.h" |
66 | 66 |
67 static const uint32 kGLTextureExternalOES = 0x8D65; | 67 static const uint32 kGLTextureExternalOES = 0x8D65; |
68 static const int kSDKVersionToSupportSecurityOriginCheck = 20; | 68 static const int kSDKVersionToSupportSecurityOriginCheck = 20; |
69 | 69 |
70 using blink::WebMediaPlayer; | 70 using blink::WebMediaPlayer; |
71 using blink::WebSize; | 71 using blink::WebSize; |
72 using blink::WebString; | 72 using blink::WebString; |
73 using blink::WebURL; | 73 using blink::WebURL; |
74 using gpu::gles2::GLES2Interface; | 74 using gpu::gles2::GLES2Interface; |
| 75 using media::LogHelper; |
| 76 using media::MediaLog; |
75 using media::MediaPlayerAndroid; | 77 using media::MediaPlayerAndroid; |
76 using media::VideoFrame; | 78 using media::VideoFrame; |
77 | 79 |
78 namespace { | 80 namespace { |
79 // Prefix for histograms related to Encrypted Media Extensions. | 81 // Prefix for histograms related to Encrypted Media Extensions. |
80 const char* kMediaEme = "Media.EME."; | 82 const char* kMediaEme = "Media.EME."; |
81 | 83 |
82 // File-static function is to allow it to run even after WMPA is deleted. | 84 // File-static function is to allow it to run even after WMPA is deleted. |
83 void OnReleaseTexture( | 85 void OnReleaseTexture( |
84 const scoped_refptr<content::StreamTextureFactory>& factories, | 86 const scoped_refptr<content::StreamTextureFactory>& factories, |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 | 421 |
420 void WebMediaPlayerAndroid::seek(double seconds) { | 422 void WebMediaPlayerAndroid::seek(double seconds) { |
421 DCHECK(main_thread_checker_.CalledOnValidThread()); | 423 DCHECK(main_thread_checker_.CalledOnValidThread()); |
422 DVLOG(1) << __FUNCTION__ << "(" << seconds << ")"; | 424 DVLOG(1) << __FUNCTION__ << "(" << seconds << ")"; |
423 | 425 |
424 base::TimeDelta new_seek_time = base::TimeDelta::FromSecondsD(seconds); | 426 base::TimeDelta new_seek_time = base::TimeDelta::FromSecondsD(seconds); |
425 | 427 |
426 if (seeking_) { | 428 if (seeking_) { |
427 if (new_seek_time == seek_time_) { | 429 if (new_seek_time == seek_time_) { |
428 if (media_source_delegate_) { | 430 if (media_source_delegate_) { |
429 if (!pending_seek_) { | 431 // Don't suppress any redundant in-progress MSE seek. There could have |
430 // If using media source demuxer, only suppress redundant seeks if | 432 // been changes to the underlying buffers after seeking the demuxer and |
431 // there is no pending seek. This enforces that any pending seek that | 433 // before receiving OnSeekComplete() for the currently in-progress seek. |
432 // results in a demuxer seek is preceded by matching | 434 MEDIA_LOG(DEBUG, media_log_) |
433 // CancelPendingSeek() and StartWaitingForSeek() calls. | 435 << "Detected MediaSource seek to same time as in-progress seek to " |
434 return; | 436 << seek_time_ << "."; |
435 } | |
436 } else { | 437 } else { |
437 // Suppress all redundant seeks if unrestricted by media source | 438 // Suppress all redundant seeks if unrestricted by media source |
438 // demuxer API. | 439 // demuxer API. |
439 pending_seek_ = false; | 440 pending_seek_ = false; |
440 return; | 441 return; |
441 } | 442 } |
442 } | 443 } |
443 | 444 |
444 pending_seek_ = true; | 445 pending_seek_ = true; |
445 pending_seek_time_ = new_seek_time; | 446 pending_seek_time_ = new_seek_time; |
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 | 1907 |
1907 bool is_hls = IsHLSStream(); | 1908 bool is_hls = IsHLSStream(); |
1908 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); | 1909 UMA_HISTOGRAM_BOOLEAN("Media.Android.IsHttpLiveStreamingMedia", is_hls); |
1909 if (is_hls) { | 1910 if (is_hls) { |
1910 media::RecordOriginOfHLSPlayback( | 1911 media::RecordOriginOfHLSPlayback( |
1911 GURL(frame_->document().securityOrigin().toString())); | 1912 GURL(frame_->document().securityOrigin().toString())); |
1912 } | 1913 } |
1913 } | 1914 } |
1914 | 1915 |
1915 } // namespace content | 1916 } // namespace content |
OLD | NEW |