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/webmediaplayer_impl.h" | 5 #include "content/renderer/media/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/callback_helpers.h" | 14 #include "base/callback_helpers.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/debug/alias.h" | 16 #include "base/debug/alias.h" |
17 #include "base/debug/crash_logging.h" | 17 #include "base/debug/crash_logging.h" |
18 #include "base/debug/trace_event.h" | 18 #include "base/debug/trace_event.h" |
19 #include "base/message_loop/message_loop_proxy.h" | 19 #include "base/message_loop/message_loop_proxy.h" |
20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/utf_string_conversions.h" |
22 #include "base/synchronization/waitable_event.h" | 23 #include "base/synchronization/waitable_event.h" |
23 #include "cc/layers/video_layer.h" | 24 #include "cc/layers/video_layer.h" |
24 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
25 #include "content/public/renderer/render_frame.h" | 26 #include "content/public/renderer/render_frame.h" |
26 #include "content/renderer/media/buffered_data_source.h" | 27 #include "content/renderer/media/buffered_data_source.h" |
27 #include "content/renderer/media/crypto/key_systems.h" | 28 #include "content/renderer/media/crypto/key_systems.h" |
28 #include "content/renderer/media/render_media_log.h" | 29 #include "content/renderer/media/render_media_log.h" |
29 #include "content/renderer/media/texttrack_impl.h" | 30 #include "content/renderer/media/texttrack_impl.h" |
30 #include "content/renderer/media/webaudiosourceprovider_impl.h" | 31 #include "content/renderer/media/webaudiosourceprovider_impl.h" |
31 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" | 32 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 WebMediaPlayer::MediaKeyException e) { | 741 WebMediaPlayer::MediaKeyException e) { |
741 MediaKeyException result_id = MediaKeyExceptionForUMA(e); | 742 MediaKeyException result_id = MediaKeyExceptionForUMA(e); |
742 DCHECK_NE(result_id, kUnknownResultId) << e; | 743 DCHECK_NE(result_id, kUnknownResultId) << e; |
743 EmeUMAHistogramEnumeration( | 744 EmeUMAHistogramEnumeration( |
744 key_system, method, result_id, kMaxMediaKeyException); | 745 key_system, method, result_id, kMaxMediaKeyException); |
745 } | 746 } |
746 | 747 |
747 // Convert a WebString to ASCII, falling back on an empty string in the case | 748 // Convert a WebString to ASCII, falling back on an empty string in the case |
748 // of a non-ASCII string. | 749 // of a non-ASCII string. |
749 static std::string ToASCIIOrEmpty(const blink::WebString& string) { | 750 static std::string ToASCIIOrEmpty(const blink::WebString& string) { |
750 return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); | 751 return IsStringASCII(string) ? base::UTF16ToASCII(string) : std::string(); |
751 } | 752 } |
752 | 753 |
753 WebMediaPlayer::MediaKeyException | 754 WebMediaPlayer::MediaKeyException |
754 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system, | 755 WebMediaPlayerImpl::generateKeyRequest(const WebString& key_system, |
755 const unsigned char* init_data, | 756 const unsigned char* init_data, |
756 unsigned init_data_length) { | 757 unsigned init_data_length) { |
757 DVLOG(1) << "generateKeyRequest: " << base::string16(key_system) << ": " | 758 DVLOG(1) << "generateKeyRequest: " << base::string16(key_system) << ": " |
758 << std::string(reinterpret_cast<const char*>(init_data), | 759 << std::string(reinterpret_cast<const char*>(init_data), |
759 static_cast<size_t>(init_data_length)); | 760 static_cast<size_t>(init_data_length)); |
760 | 761 |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 | 1323 |
1323 if (web_cdm_) { | 1324 if (web_cdm_) { |
1324 decryptor_ready_cb.Run(web_cdm_->GetDecryptor()); | 1325 decryptor_ready_cb.Run(web_cdm_->GetDecryptor()); |
1325 return; | 1326 return; |
1326 } | 1327 } |
1327 | 1328 |
1328 decryptor_ready_cb_ = decryptor_ready_cb; | 1329 decryptor_ready_cb_ = decryptor_ready_cb; |
1329 } | 1330 } |
1330 | 1331 |
1331 } // namespace content | 1332 } // namespace content |
OLD | NEW |