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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 filter_collection_.get())) { | 272 filter_collection_.get())) { |
268 supports_save_ = false; | 273 supports_save_ = false; |
269 StartPipeline(); | 274 StartPipeline(); |
270 return; | 275 return; |
271 } | 276 } |
272 | 277 |
273 // Media source pipelines can start immediately. | 278 // Media source pipelines can start immediately. |
274 if (!url.isEmpty() && url == GetClient()->sourceURL()) { | 279 if (!url.isEmpty() && url == GetClient()->sourceURL()) { |
275 chunk_demuxer_ = new media::ChunkDemuxer( | 280 chunk_demuxer_ = new media::ChunkDemuxer( |
276 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), | 281 BIND_TO_RENDER_LOOP(&WebMediaPlayerImpl::OnDemuxerOpened), |
277 BIND_TO_RENDER_LOOP_2(&WebMediaPlayerImpl::OnNeedKey, "", "")); | 282 BIND_TO_RENDER_LOOP_2(&WebMediaPlayerImpl::OnNeedKey, "", ""), |
| 283 base::Bind(&LogMediaSourceError, media_log_)); |
278 | 284 |
279 BuildMediaSourceCollection(chunk_demuxer_, | 285 BuildMediaSourceCollection(chunk_demuxer_, |
280 message_loop, | 286 message_loop, |
281 filter_collection_.get(), | 287 filter_collection_.get(), |
282 decryptor_.get()); | 288 decryptor_.get()); |
283 supports_save_ = false; | 289 supports_save_ = false; |
284 StartPipeline(); | 290 StartPipeline(); |
285 return; | 291 return; |
286 } | 292 } |
287 | 293 |
(...skipping 912 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 |