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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 is_local_source_(false), | 153 is_local_source_(false), |
154 supports_save_(true), | 154 supports_save_(true), |
155 starting_(false), | 155 starting_(false), |
156 chunk_demuxer_(NULL), | 156 chunk_demuxer_(NULL), |
157 pending_repaint_(false), | 157 pending_repaint_(false), |
158 video_frame_provider_client_(NULL) { | 158 video_frame_provider_client_(NULL) { |
159 media_log_->AddEvent( | 159 media_log_->AddEvent( |
160 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); | 160 media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED)); |
161 | 161 |
162 CHECK(media_thread_.Start()); | 162 CHECK(media_thread_.Start()); |
163 pipeline_ = new media::Pipeline( | 163 pipeline_.reset(new media::Pipeline( |
164 media_thread_.message_loop_proxy(), media_log_); | 164 media_thread_.message_loop_proxy(), media_log_)); |
165 | 165 |
166 // Let V8 know we started new thread if we did not do it yet. | 166 // Let V8 know we started new thread if we did not do it yet. |
167 // Made separate task to avoid deletion of player currently being created. | 167 // Made separate task to avoid deletion of player currently being created. |
168 // Also, delaying GC until after player starts gets rid of starting lag -- | 168 // Also, delaying GC until after player starts gets rid of starting lag -- |
169 // collection happens in parallel with playing. | 169 // collection happens in parallel with playing. |
170 // | 170 // |
171 // TODO(enal): remove when we get rid of per-audio-stream thread. | 171 // TODO(enal): remove when we get rid of per-audio-stream thread. |
172 main_loop_->PostTask( | 172 main_loop_->PostTask( |
173 FROM_HERE, | 173 FROM_HERE, |
174 base::Bind(&WebMediaPlayerImpl::IncrementExternallyAllocatedMemory, | 174 base::Bind(&WebMediaPlayerImpl::IncrementExternallyAllocatedMemory, |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1205 &base::WaitableEvent::Signal, base::Unretained(&waiter))); | 1205 &base::WaitableEvent::Signal, base::Unretained(&waiter))); |
1206 waiter.Wait(); | 1206 waiter.Wait(); |
1207 | 1207 |
1208 // Let V8 know we are not using extra resources anymore. | 1208 // Let V8 know we are not using extra resources anymore. |
1209 if (incremented_externally_allocated_memory_) { | 1209 if (incremented_externally_allocated_memory_) { |
1210 v8::V8::AdjustAmountOfExternalAllocatedMemory(-kPlayerExtraMemory); | 1210 v8::V8::AdjustAmountOfExternalAllocatedMemory(-kPlayerExtraMemory); |
1211 incremented_externally_allocated_memory_ = false; | 1211 incremented_externally_allocated_memory_ = false; |
1212 } | 1212 } |
1213 | 1213 |
1214 media_thread_.Stop(); | 1214 media_thread_.Stop(); |
1215 | 1215 |
acolwell GONE FROM CHROMIUM
2013/04/26 18:30:21
pipeline_.reset() here? It would insure things go
scherkus (not reviewing)
2013/04/30 03:26:38
Done.
| |
1216 // Release any final references now that everything has stopped. | 1216 // Release any final references now that everything has stopped. |
1217 data_source_ = NULL; | 1217 data_source_ = NULL; |
1218 demuxer_.reset(); | 1218 demuxer_.reset(); |
1219 } | 1219 } |
1220 | 1220 |
1221 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { | 1221 WebKit::WebMediaPlayerClient* WebMediaPlayerImpl::GetClient() { |
1222 DCHECK(main_loop_->BelongsToCurrentThread()); | 1222 DCHECK(main_loop_->BelongsToCurrentThread()); |
1223 DCHECK(client_); | 1223 DCHECK(client_); |
1224 return client_; | 1224 return client_; |
1225 } | 1225 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1259 | 1259 |
1260 if (pending_repaint_) | 1260 if (pending_repaint_) |
1261 return; | 1261 return; |
1262 | 1262 |
1263 pending_repaint_ = true; | 1263 pending_repaint_ = true; |
1264 main_loop_->PostTask(FROM_HERE, base::Bind( | 1264 main_loop_->PostTask(FROM_HERE, base::Bind( |
1265 &WebMediaPlayerImpl::Repaint, AsWeakPtr())); | 1265 &WebMediaPlayerImpl::Repaint, AsWeakPtr())); |
1266 } | 1266 } |
1267 | 1267 |
1268 } // namespace webkit_media | 1268 } // namespace webkit_media |
OLD | NEW |