| 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 "webkit/media/webmediaplayer_impl.h" | 5 #include "webkit/media/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 // We do not support run-time switching between key systems for now. | 717 // We do not support run-time switching between key systems for now. |
| 718 if (current_key_system_.isEmpty()) | 718 if (current_key_system_.isEmpty()) |
| 719 current_key_system_ = key_system; | 719 current_key_system_ = key_system; |
| 720 else if (key_system != current_key_system_) | 720 else if (key_system != current_key_system_) |
| 721 return WebKit::WebMediaPlayer::MediaKeyExceptionInvalidPlayerState; | 721 return WebKit::WebMediaPlayer::MediaKeyExceptionInvalidPlayerState; |
| 722 | 722 |
| 723 DVLOG(1) << "generateKeyRequest: " << key_system.utf8().data() << ": " | 723 DVLOG(1) << "generateKeyRequest: " << key_system.utf8().data() << ": " |
| 724 << std::string(reinterpret_cast<const char*>(init_data), | 724 << std::string(reinterpret_cast<const char*>(init_data), |
| 725 static_cast<size_t>(init_data_length)); | 725 static_cast<size_t>(init_data_length)); |
| 726 | 726 |
| 727 decryptor_.GenerateKeyRequest(key_system.utf8(), | 727 if (!decryptor_.GenerateKeyRequest(key_system.utf8(), |
| 728 init_data, init_data_length); | 728 init_data, init_data_length)) { |
| 729 current_key_system_.reset(); |
| 730 return WebKit::WebMediaPlayer::MediaKeyExceptionKeySystemNotSupported; |
| 731 } |
| 732 |
| 729 return WebKit::WebMediaPlayer::MediaKeyExceptionNoError; | 733 return WebKit::WebMediaPlayer::MediaKeyExceptionNoError; |
| 730 } | 734 } |
| 731 | 735 |
| 732 WebKit::WebMediaPlayer::MediaKeyException WebMediaPlayerImpl::addKey( | 736 WebKit::WebMediaPlayer::MediaKeyException WebMediaPlayerImpl::addKey( |
| 733 const WebString& key_system, | 737 const WebString& key_system, |
| 734 const unsigned char* key, | 738 const unsigned char* key, |
| 735 unsigned key_length, | 739 unsigned key_length, |
| 736 const unsigned char* init_data, | 740 const unsigned char* init_data, |
| 737 unsigned init_data_length, | 741 unsigned init_data_length, |
| 738 const WebString& session_id) { | 742 const WebString& session_id) { |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 return audio_source_provider_; | 1064 return audio_source_provider_; |
| 1061 } | 1065 } |
| 1062 | 1066 |
| 1063 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1067 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 1064 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1068 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 1065 incremented_externally_allocated_memory_ = true; | 1069 incremented_externally_allocated_memory_ = true; |
| 1066 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1070 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 1067 } | 1071 } |
| 1068 | 1072 |
| 1069 } // namespace webkit_media | 1073 } // namespace webkit_media |
| OLD | NEW |