| 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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 | 821 |
| 823 SetCdm(BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnCdmAttached), | 822 SetCdm(BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnCdmAttached), |
| 824 ToWebContentDecryptionModuleImpl(cdm)->GetCdmContext()); | 823 ToWebContentDecryptionModuleImpl(cdm)->GetCdmContext()); |
| 825 } | 824 } |
| 826 | 825 |
| 827 void WebMediaPlayerImpl::OnEncryptedMediaInitData( | 826 void WebMediaPlayerImpl::OnEncryptedMediaInitData( |
| 828 EmeInitDataType init_data_type, | 827 EmeInitDataType init_data_type, |
| 829 const std::vector<uint8_t>& init_data) { | 828 const std::vector<uint8_t>& init_data) { |
| 830 DCHECK(init_data_type != EmeInitDataType::UNKNOWN); | 829 DCHECK(init_data_type != EmeInitDataType::UNKNOWN); |
| 831 | 830 |
| 832 // Do not fire the "encrypted" event if Encrypted Media is not enabled. | |
| 833 // EME may not be enabled on Android Jelly Bean. | |
| 834 if (!blink::WebRuntimeFeatures::isEncryptedMediaEnabled()) { | |
| 835 return; | |
| 836 } | |
| 837 | |
| 838 // TODO(xhwang): Update this UMA name. https://crbug.com/589251 | 831 // TODO(xhwang): Update this UMA name. https://crbug.com/589251 |
| 839 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1); | 832 UMA_HISTOGRAM_COUNTS("Media.EME.NeedKey", 1); |
| 840 | 833 |
| 841 encrypted_client_->encrypted( | 834 encrypted_client_->encrypted( |
| 842 ConvertToWebInitDataType(init_data_type), init_data.data(), | 835 ConvertToWebInitDataType(init_data_type), init_data.data(), |
| 843 base::saturated_cast<unsigned int>(init_data.size())); | 836 base::saturated_cast<unsigned int>(init_data.size())); |
| 844 } | 837 } |
| 845 | 838 |
| 846 void WebMediaPlayerImpl::OnWaitingForDecryptionKey() { | 839 void WebMediaPlayerImpl::OnWaitingForDecryptionKey() { |
| 847 encrypted_client_->didBlockPlaybackWaitingForKey(); | 840 encrypted_client_->didBlockPlaybackWaitingForKey(); |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 << ", Video: " << stats.video_memory_usage << ", DataSource: " | 1573 << ", Video: " << stats.video_memory_usage << ", DataSource: " |
| 1581 << (data_source_ ? data_source_->GetMemoryUsage() : 0) | 1574 << (data_source_ ? data_source_->GetMemoryUsage() : 0) |
| 1582 << ", Demuxer: " << demuxer_memory_usage; | 1575 << ", Demuxer: " << demuxer_memory_usage; |
| 1583 | 1576 |
| 1584 const int64_t delta = current_memory_usage - last_reported_memory_usage_; | 1577 const int64_t delta = current_memory_usage - last_reported_memory_usage_; |
| 1585 last_reported_memory_usage_ = current_memory_usage; | 1578 last_reported_memory_usage_ = current_memory_usage; |
| 1586 adjust_allocated_memory_cb_.Run(delta); | 1579 adjust_allocated_memory_cb_.Run(delta); |
| 1587 } | 1580 } |
| 1588 | 1581 |
| 1589 } // namespace media | 1582 } // namespace media |
| OLD | NEW |