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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return result; | 111 return result; |
112 } | 112 } |
113 | 113 |
114 // TODO(acolwell): Investigate whether the key_system & session_id parameters | 114 // TODO(acolwell): Investigate whether the key_system & session_id parameters |
115 // are really necessary. | 115 // are really necessary. |
116 typedef base::Callback<void(const std::string&, | 116 typedef base::Callback<void(const std::string&, |
117 const std::string&, | 117 const std::string&, |
118 scoped_array<uint8>, | 118 scoped_array<uint8>, |
119 int)> OnNeedKeyCB; | 119 int)> OnNeedKeyCB; |
120 | 120 |
| 121 static void LogMediaSourceError(const scoped_refptr<media::MediaLog>& media_log, |
| 122 const std::string& error) { |
| 123 media_log->AddEvent(media_log->CreateMediaSourceErrorEvent(error)); |
| 124 } |
| 125 |
121 WebMediaPlayerImpl::WebMediaPlayerImpl( | 126 WebMediaPlayerImpl::WebMediaPlayerImpl( |
122 WebKit::WebFrame* frame, | 127 WebKit::WebFrame* frame, |
123 WebKit::WebMediaPlayerClient* client, | 128 WebKit::WebMediaPlayerClient* client, |
124 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 129 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
125 media::FilterCollection* collection, | 130 media::FilterCollection* collection, |
126 WebKit::WebAudioSourceProvider* audio_source_provider, | 131 WebKit::WebAudioSourceProvider* audio_source_provider, |
127 media::AudioRendererSink* audio_renderer_sink, | 132 media::AudioRendererSink* audio_renderer_sink, |
128 media::MessageLoopFactory* message_loop_factory, | 133 media::MessageLoopFactory* message_loop_factory, |
129 MediaStreamClient* media_stream_client, | 134 MediaStreamClient* media_stream_client, |
130 media::MediaLog* media_log) | 135 media::MediaLog* media_log) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 filter_collection_.get())) { | 271 filter_collection_.get())) { |
267 supports_save_ = false; | 272 supports_save_ = false; |
268 StartPipeline(); | 273 StartPipeline(); |
269 return; | 274 return; |
270 } | 275 } |
271 | 276 |
272 // Media source pipelines can start immediately. | 277 // Media source pipelines can start immediately. |
273 if (!url.isEmpty() && url == GetClient()->sourceURL()) { | 278 if (!url.isEmpty() && url == GetClient()->sourceURL()) { |
274 chunk_demuxer_ = new media::ChunkDemuxer( | 279 chunk_demuxer_ = new media::ChunkDemuxer( |
275 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), | 280 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), |
276 BIND_TO_RENDER_LOOP_2(&WebMediaPlayerImpl::OnNeedKey, "", "")); | 281 BIND_TO_RENDER_LOOP_2(&WebMediaPlayerImpl::OnNeedKey, "", ""), |
| 282 base::Bind(&LogMediaSourceError, media_log_)); |
277 | 283 |
278 BuildMediaSourceCollection(chunk_demuxer_, | 284 BuildMediaSourceCollection(chunk_demuxer_, |
279 message_loop, | 285 message_loop, |
280 filter_collection_.get(), | 286 filter_collection_.get(), |
281 decryptor_.get()); | 287 decryptor_.get()); |
282 supports_save_ = false; | 288 supports_save_ = false; |
283 StartPipeline(); | 289 StartPipeline(); |
284 return; | 290 return; |
285 } | 291 } |
286 | 292 |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 return audio_source_provider_; | 1206 return audio_source_provider_; |
1201 } | 1207 } |
1202 | 1208 |
1203 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { | 1209 void WebMediaPlayerImpl::IncrementExternallyAllocatedMemory() { |
1204 DCHECK_EQ(main_loop_, MessageLoop::current()); | 1210 DCHECK_EQ(main_loop_, MessageLoop::current()); |
1205 incremented_externally_allocated_memory_ = true; | 1211 incremented_externally_allocated_memory_ = true; |
1206 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); | 1212 v8::V8::AdjustAmountOfExternalAllocatedMemory(kPlayerExtraMemory); |
1207 } | 1213 } |
1208 | 1214 |
1209 } // namespace webkit_media | 1215 } // namespace webkit_media |
OLD | NEW |