| 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 "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" | 50 #include "third_party/WebKit/public/platform/WebMediaPlayerEncryptedMediaClient.
h" |
| 51 #include "third_party/WebKit/public/platform/WebMediaSource.h" | 51 #include "third_party/WebKit/public/platform/WebMediaSource.h" |
| 52 #include "third_party/WebKit/public/platform/WebRect.h" | 52 #include "third_party/WebKit/public/platform/WebRect.h" |
| 53 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 53 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
| 54 #include "third_party/WebKit/public/platform/WebSize.h" | 54 #include "third_party/WebKit/public/platform/WebSize.h" |
| 55 #include "third_party/WebKit/public/platform/WebString.h" | 55 #include "third_party/WebKit/public/platform/WebString.h" |
| 56 #include "third_party/WebKit/public/platform/WebURL.h" | 56 #include "third_party/WebKit/public/platform/WebURL.h" |
| 57 #include "third_party/WebKit/public/web/WebDocument.h" | 57 #include "third_party/WebKit/public/web/WebDocument.h" |
| 58 #include "third_party/WebKit/public/web/WebFrame.h" | 58 #include "third_party/WebKit/public/web/WebFrame.h" |
| 59 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 59 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 60 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | |
| 61 #include "third_party/WebKit/public/web/WebView.h" | 60 #include "third_party/WebKit/public/web/WebView.h" |
| 62 | 61 |
| 63 using blink::WebCanvas; | 62 using blink::WebCanvas; |
| 64 using blink::WebMediaPlayer; | 63 using blink::WebMediaPlayer; |
| 65 using blink::WebRect; | 64 using blink::WebRect; |
| 66 using blink::WebSize; | 65 using blink::WebSize; |
| 67 using blink::WebString; | 66 using blink::WebString; |
| 68 using gpu::gles2::GLES2Interface; | 67 using gpu::gles2::GLES2Interface; |
| 69 | 68 |
| 70 #define STATIC_ASSERT_ENUM(a, b) \ | 69 #define STATIC_ASSERT_ENUM(a, b) \ |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 | 782 |
| 784 SetCdm(BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnCdmAttached), | 783 SetCdm(BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnCdmAttached), |
| 785 ToWebContentDecryptionModuleImpl(cdm)->GetCdmContext()); | 784 ToWebContentDecryptionModuleImpl(cdm)->GetCdmContext()); |
| 786 } | 785 } |
| 787 | 786 |
| 788 void WebMediaPlayerImpl::OnEncryptedMediaInitData( | 787 void WebMediaPlayerImpl::OnEncryptedMediaInitData( |
| 789 EmeInitDataType init_data_type, | 788 EmeInitDataType init_data_type, |
| 790 const std::vector<uint8_t>& init_data) { | 789 const std::vector<uint8_t>& init_data) { |
| 791 DCHECK(init_data_type != EmeInitDataType::UNKNOWN); | 790 DCHECK(init_data_type != EmeInitDataType::UNKNOWN); |
| 792 | 791 |
| 793 // Do not fire the "encrypted" event if Encrypted Media is not enabled. | |
| 794 // EME may not be enabled on Android Jelly Bean. | |
| 795 if (!blink::WebRuntimeFeatures::isEncryptedMediaEnabled()) { | |
| 796 return; | |
| 797 } | |
| 798 | |
| 799 // TODO(xhwang): Update this UMA name. https://crbug.com/589251 | 792 // TODO(xhwang): Update this UMA name. https://crbug.com/589251 |
| 800 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1); | 793 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1); |
| 801 | 794 |
| 802 encrypted_client_->encrypted( | 795 encrypted_client_->encrypted( |
| 803 ConvertToWebInitDataType(init_data_type), init_data.data(), | 796 ConvertToWebInitDataType(init_data_type), init_data.data(), |
| 804 base::saturated_cast<unsigned int>(init_data.size())); | 797 base::saturated_cast<unsigned int>(init_data.size())); |
| 805 } | 798 } |
| 806 | 799 |
| 807 void WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated( | 800 void WebMediaPlayerImpl::OnFFmpegMediaTracksUpdated( |
| 808 scoped_ptr<MediaTracks> tracks) { | 801 scoped_ptr<MediaTracks> tracks) { |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1419 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
| 1427 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1420 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
| 1428 << ", Demuxer: " << demuxer_memory_usage; | 1421 << ", Demuxer: " << demuxer_memory_usage; |
| 1429 | 1422 |
| 1430 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1423 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
| 1431 last_reported_memory_usage_ = current_memory_usage; | 1424 last_reported_memory_usage_ = current_memory_usage; |
| 1432 adjust_allocated_memory_cb_.Run(delta); | 1425 adjust_allocated_memory_cb_.Run(delta); |
| 1433 } | 1426 } |
| 1434 | 1427 |
| 1435 } // namespace media | 1428 } // namespace media |
| OLD | NEW |