Chromium Code Reviews| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 url, static_cast<BufferedResourceLoader::CORSMode>(cors_mode), | 267 url, static_cast<BufferedResourceLoader::CORSMode>(cors_mode), |
| 268 base::Bind( | 268 base::Bind( |
| 269 &WebMediaPlayerImpl::DataSourceInitialized, | 269 &WebMediaPlayerImpl::DataSourceInitialized, |
| 270 AsWeakPtr(), gurl)); | 270 AsWeakPtr(), gurl)); |
| 271 | 271 |
| 272 is_local_source_ = !gurl.SchemeIs("http") && !gurl.SchemeIs("https"); | 272 is_local_source_ = !gurl.SchemeIs("http") && !gurl.SchemeIs("https"); |
| 273 | 273 |
| 274 BuildDefaultCollection(proxy_->data_source(), | 274 BuildDefaultCollection(proxy_->data_source(), |
| 275 message_loop_factory_.get(), | 275 message_loop_factory_.get(), |
| 276 filter_collection_.get(), | 276 filter_collection_.get(), |
| 277 &decryptor_); | 277 &decryptor_, |
| 278 base::Bind(&WebMediaPlayerImpl::SendNeedKey, | |
| 279 base::Unretained(this))); | |
| 278 } | 280 } |
| 279 | 281 |
| 280 void WebMediaPlayerImpl::cancelLoad() { | 282 void WebMediaPlayerImpl::cancelLoad() { |
| 281 DCHECK_EQ(main_loop_, MessageLoop::current()); | 283 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 282 } | 284 } |
| 283 | 285 |
| 284 void WebMediaPlayerImpl::play() { | 286 void WebMediaPlayerImpl::play() { |
| 285 DCHECK_EQ(main_loop_, MessageLoop::current()); | 287 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 286 | 288 |
| 287 paused_ = false; | 289 paused_ = false; |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 881 | 883 |
| 882 GetClient()->sourceOpened(); | 884 GetClient()->sourceOpened(); |
| 883 } | 885 } |
| 884 | 886 |
| 885 void WebMediaPlayerImpl::OnKeyAdded(const std::string& key_system, | 887 void WebMediaPlayerImpl::OnKeyAdded(const std::string& key_system, |
| 886 const std::string& session_id) { | 888 const std::string& session_id) { |
| 887 DCHECK_EQ(main_loop_, MessageLoop::current()); | 889 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 888 | 890 |
| 889 GetClient()->keyAdded(WebString::fromUTF8(key_system), | 891 GetClient()->keyAdded(WebString::fromUTF8(key_system), |
| 890 WebString::fromUTF8(session_id)); | 892 WebString::fromUTF8(session_id)); |
| 893 pipeline_->KeyAdded(); | |
| 891 } | 894 } |
| 892 | 895 |
| 893 void WebMediaPlayerImpl::OnNeedKey(const std::string& key_system, | 896 void WebMediaPlayerImpl::OnNeedKey(const std::string& key_system, |
| 894 const std::string& session_id, | 897 const std::string& session_id, |
| 895 scoped_array<uint8> init_data, | 898 scoped_array<uint8> init_data, |
| 896 int init_data_size) { | 899 int init_data_size) { |
| 897 DCHECK_EQ(main_loop_, MessageLoop::current()); | 900 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 898 | 901 |
| 899 GetClient()->keyNeeded(WebString::fromUTF8(key_system), | 902 GetClient()->keyNeeded(WebString::fromUTF8(key_system), |
| 900 WebString::fromUTF8(session_id), | 903 WebString::fromUTF8(session_id), |
| 901 init_data.get(), | 904 init_data.get(), |
| 902 init_data_size); | 905 init_data_size); |
| 903 } | 906 } |
| 904 | 907 |
| 908 bool WebMediaPlayerImpl::SendNeedKey(scoped_array<uint8> init_data, | |
| 909 int init_data_size) { | |
| 910 proxy_->DemuxerNeedKey(init_data.Pass(), init_data_size); | |
|
ddorwin
2012/08/22 23:20:29
Why is this different from the above? Isn't the ch
fgalligan1
2012/08/23 02:39:11
Because right now the the interface is defined in
ddorwin
2012/08/24 00:20:30
Okay, maybe a media/base version of ChunkDemuxerCl
fgalligan1
2012/08/24 20:01:26
Removed SendNeedKey
| |
| 911 return true; | |
| 912 } | |
| 913 | |
| 905 #define COMPILE_ASSERT_MATCHING_ENUM(name) \ | 914 #define COMPILE_ASSERT_MATCHING_ENUM(name) \ |
| 906 COMPILE_ASSERT(static_cast<int>(WebKit::WebMediaPlayerClient::name) == \ | 915 COMPILE_ASSERT(static_cast<int>(WebKit::WebMediaPlayerClient::name) == \ |
| 907 static_cast<int>(media::Decryptor::k ## name), \ | 916 static_cast<int>(media::Decryptor::k ## name), \ |
| 908 mismatching_enums) | 917 mismatching_enums) |
| 909 COMPILE_ASSERT_MATCHING_ENUM(UnknownError); | 918 COMPILE_ASSERT_MATCHING_ENUM(UnknownError); |
| 910 COMPILE_ASSERT_MATCHING_ENUM(ClientError); | 919 COMPILE_ASSERT_MATCHING_ENUM(ClientError); |
| 911 COMPILE_ASSERT_MATCHING_ENUM(ServiceError); | 920 COMPILE_ASSERT_MATCHING_ENUM(ServiceError); |
| 912 COMPILE_ASSERT_MATCHING_ENUM(OutputError); | 921 COMPILE_ASSERT_MATCHING_ENUM(OutputError); |
| 913 COMPILE_ASSERT_MATCHING_ENUM(HardwareChangeError); | 922 COMPILE_ASSERT_MATCHING_ENUM(HardwareChangeError); |
| 914 COMPILE_ASSERT_MATCHING_ENUM(DomainError); | 923 COMPILE_ASSERT_MATCHING_ENUM(DomainError); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1050 return audio_source_provider_; | 1059 return audio_source_provider_; |
| 1051 } | 1060 } |
| 1052 | 1061 |
| 1053 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1062 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
| 1054 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1063 DCHECK_EQ(main_loop_, MessageLoop::current()); |
| 1055 incremented_externally_allocated_memory_ = true; | 1064 incremented_externally_allocated_memory_ = true; |
| 1056 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1065 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
| 1057 } | 1066 } |
| 1058 | 1067 |
| 1059 } // namespace webkit_media | 1068 } // namespace webkit_media |
| OLD | NEW |