| OLD | NEW |
| 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 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 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, | 5 // TODO(scherkus): clean up PipelineImpl... too many crazy function names, |
| 6 // potential deadlocks, etc... | 6 // potential deadlocks, etc... |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/condition_variable.h" | 9 #include "base/condition_variable.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 230 } |
| 231 | 231 |
| 232 void PipelineImpl::GetVideoSize(size_t* width_out, size_t* height_out) const { | 232 void PipelineImpl::GetVideoSize(size_t* width_out, size_t* height_out) const { |
| 233 CHECK(width_out); | 233 CHECK(width_out); |
| 234 CHECK(height_out); | 234 CHECK(height_out); |
| 235 AutoLock auto_lock(lock_); | 235 AutoLock auto_lock(lock_); |
| 236 *width_out = video_width_; | 236 *width_out = video_width_; |
| 237 *height_out = video_height_; | 237 *height_out = video_height_; |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool PipelineImpl::IsStreaming() const { |
| 241 AutoLock auto_lock(lock_); |
| 242 return streaming_; |
| 243 } |
| 244 |
| 240 PipelineError PipelineImpl::GetError() const { | 245 PipelineError PipelineImpl::GetError() const { |
| 241 AutoLock auto_lock(lock_); | 246 AutoLock auto_lock(lock_); |
| 242 return error_; | 247 return error_; |
| 243 } | 248 } |
| 244 | 249 |
| 245 void PipelineImpl::ResetState() { | 250 void PipelineImpl::ResetState() { |
| 246 AutoLock auto_lock(lock_); | 251 AutoLock auto_lock(lock_); |
| 247 const base::TimeDelta kZero; | 252 const base::TimeDelta kZero; |
| 248 running_ = false; | 253 running_ = false; |
| 249 duration_ = kZero; | 254 duration_ = kZero; |
| 250 buffered_time_ = kZero; | 255 buffered_time_ = kZero; |
| 251 buffered_bytes_ = 0; | 256 buffered_bytes_ = 0; |
| 257 streaming_ = false; |
| 252 total_bytes_ = 0; | 258 total_bytes_ = 0; |
| 253 video_width_ = 0; | 259 video_width_ = 0; |
| 254 video_height_ = 0; | 260 video_height_ = 0; |
| 255 volume_ = 1.0f; | 261 volume_ = 1.0f; |
| 256 playback_rate_ = 0.0f; | 262 playback_rate_ = 0.0f; |
| 257 error_ = PIPELINE_OK; | 263 error_ = PIPELINE_OK; |
| 258 clock_.SetTime(kZero); | 264 clock_.SetTime(kZero); |
| 259 rendered_mime_types_.clear(); | 265 rendered_mime_types_.clear(); |
| 260 } | 266 } |
| 261 | 267 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 buffered_bytes_ = buffered_bytes; | 342 buffered_bytes_ = buffered_bytes; |
| 337 } | 343 } |
| 338 | 344 |
| 339 void PipelineImpl::SetVideoSize(size_t width, size_t height) { | 345 void PipelineImpl::SetVideoSize(size_t width, size_t height) { |
| 340 DCHECK(IsRunning()); | 346 DCHECK(IsRunning()); |
| 341 AutoLock auto_lock(lock_); | 347 AutoLock auto_lock(lock_); |
| 342 video_width_ = width; | 348 video_width_ = width; |
| 343 video_height_ = height; | 349 video_height_ = height; |
| 344 } | 350 } |
| 345 | 351 |
| 352 void PipelineImpl::SetStreaming(bool streaming) { |
| 353 DCHECK(IsRunning()); |
| 354 AutoLock auto_lock(lock_); |
| 355 streaming_ = streaming; |
| 356 } |
| 357 |
| 346 void PipelineImpl::InsertRenderedMimeType(const std::string& major_mime_type) { | 358 void PipelineImpl::InsertRenderedMimeType(const std::string& major_mime_type) { |
| 347 DCHECK(IsRunning()); | 359 DCHECK(IsRunning()); |
| 348 AutoLock auto_lock(lock_); | 360 AutoLock auto_lock(lock_); |
| 349 rendered_mime_types_.insert(major_mime_type); | 361 rendered_mime_types_.insert(major_mime_type); |
| 350 } | 362 } |
| 351 | 363 |
| 352 bool PipelineImpl::HasRenderedMimeTypes() const { | 364 bool PipelineImpl::HasRenderedMimeTypes() const { |
| 353 DCHECK(IsRunning()); | 365 DCHECK(IsRunning()); |
| 354 AutoLock auto_lock(lock_); | 366 AutoLock auto_lock(lock_); |
| 355 return !rendered_mime_types_.empty(); | 367 return !rendered_mime_types_.empty(); |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 | 820 |
| 809 // Reset the pipeline, which will decrement a reference to this object. | 821 // Reset the pipeline, which will decrement a reference to this object. |
| 810 // We will get destroyed as soon as the remaining tasks finish executing. | 822 // We will get destroyed as soon as the remaining tasks finish executing. |
| 811 // To be safe, we'll set our pipeline reference to NULL. | 823 // To be safe, we'll set our pipeline reference to NULL. |
| 812 filters_.clear(); | 824 filters_.clear(); |
| 813 filter_types_.clear(); | 825 filter_types_.clear(); |
| 814 STLDeleteElements(&filter_threads_); | 826 STLDeleteElements(&filter_threads_); |
| 815 } | 827 } |
| 816 | 828 |
| 817 } // namespace media | 829 } // namespace media |
| OLD | NEW |