| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "media/base/pipeline_impl.h" | 8 #include "media/base/pipeline_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 int64 PipelineImpl::GetBufferedBytes() const { | 303 int64 PipelineImpl::GetBufferedBytes() const { |
| 304 base::AutoLock auto_lock(lock_); | 304 base::AutoLock auto_lock(lock_); |
| 305 return buffered_bytes_; | 305 return buffered_bytes_; |
| 306 } | 306 } |
| 307 | 307 |
| 308 int64 PipelineImpl::GetTotalBytes() const { | 308 int64 PipelineImpl::GetTotalBytes() const { |
| 309 base::AutoLock auto_lock(lock_); | 309 base::AutoLock auto_lock(lock_); |
| 310 return total_bytes_; | 310 return total_bytes_; |
| 311 } | 311 } |
| 312 | 312 |
| 313 void PipelineImpl::GetVideoSize(size_t* width_out, size_t* height_out) const { | 313 void PipelineImpl::GetNaturalVideoSize(gfx::Size* out_size) const { |
| 314 CHECK(width_out); | 314 CHECK(out_size); |
| 315 CHECK(height_out); | |
| 316 base::AutoLock auto_lock(lock_); | 315 base::AutoLock auto_lock(lock_); |
| 317 *width_out = video_width_; | 316 *out_size = natural_size_; |
| 318 *height_out = video_height_; | |
| 319 } | 317 } |
| 320 | 318 |
| 321 bool PipelineImpl::IsStreaming() const { | 319 bool PipelineImpl::IsStreaming() const { |
| 322 base::AutoLock auto_lock(lock_); | 320 base::AutoLock auto_lock(lock_); |
| 323 return streaming_; | 321 return streaming_; |
| 324 } | 322 } |
| 325 | 323 |
| 326 bool PipelineImpl::IsLoaded() const { | 324 bool PipelineImpl::IsLoaded() const { |
| 327 base::AutoLock auto_lock(lock_); | 325 base::AutoLock auto_lock(lock_); |
| 328 return loaded_; | 326 return loaded_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 seek_pending_ = false; | 362 seek_pending_ = false; |
| 365 tearing_down_ = false; | 363 tearing_down_ = false; |
| 366 error_caused_teardown_ = false; | 364 error_caused_teardown_ = false; |
| 367 playback_rate_change_pending_ = false; | 365 playback_rate_change_pending_ = false; |
| 368 duration_ = kZero; | 366 duration_ = kZero; |
| 369 buffered_time_ = kZero; | 367 buffered_time_ = kZero; |
| 370 buffered_bytes_ = 0; | 368 buffered_bytes_ = 0; |
| 371 streaming_ = false; | 369 streaming_ = false; |
| 372 loaded_ = false; | 370 loaded_ = false; |
| 373 total_bytes_ = 0; | 371 total_bytes_ = 0; |
| 374 video_width_ = 0; | 372 natural_size_.SetSize(0, 0); |
| 375 video_height_ = 0; | |
| 376 volume_ = 1.0f; | 373 volume_ = 1.0f; |
| 377 preload_ = AUTO; | 374 preload_ = AUTO; |
| 378 playback_rate_ = 0.0f; | 375 playback_rate_ = 0.0f; |
| 379 pending_playback_rate_ = 0.0f; | 376 pending_playback_rate_ = 0.0f; |
| 380 status_ = PIPELINE_OK; | 377 status_ = PIPELINE_OK; |
| 381 has_audio_ = false; | 378 has_audio_ = false; |
| 382 has_video_ = false; | 379 has_video_ = false; |
| 383 waiting_for_clock_update_ = false; | 380 waiting_for_clock_update_ = false; |
| 384 audio_disabled_ = false; | 381 audio_disabled_ = false; |
| 385 clock_->SetTime(kZero); | 382 clock_->SetTime(kZero); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 void PipelineImpl::SetBufferedBytes(int64 buffered_bytes) { | 526 void PipelineImpl::SetBufferedBytes(int64 buffered_bytes) { |
| 530 DCHECK(IsRunning()); | 527 DCHECK(IsRunning()); |
| 531 base::AutoLock auto_lock(lock_); | 528 base::AutoLock auto_lock(lock_); |
| 532 | 529 |
| 533 // See comments in SetCurrentReadPosition() about capping. | 530 // See comments in SetCurrentReadPosition() about capping. |
| 534 if (buffered_bytes < current_bytes_) | 531 if (buffered_bytes < current_bytes_) |
| 535 current_bytes_ = buffered_bytes; | 532 current_bytes_ = buffered_bytes; |
| 536 buffered_bytes_ = buffered_bytes; | 533 buffered_bytes_ = buffered_bytes; |
| 537 } | 534 } |
| 538 | 535 |
| 539 void PipelineImpl::SetVideoSize(size_t width, size_t height) { | 536 void PipelineImpl::SetNaturalVideoSize(const gfx::Size& size) { |
| 540 DCHECK(IsRunning()); | 537 DCHECK(IsRunning()); |
| 541 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent(width, height)); | 538 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent( |
| 539 size.width(), size.height())); |
| 542 | 540 |
| 543 base::AutoLock auto_lock(lock_); | 541 base::AutoLock auto_lock(lock_); |
| 544 video_width_ = width; | 542 natural_size_ = size; |
| 545 video_height_ = height; | |
| 546 } | 543 } |
| 547 | 544 |
| 548 void PipelineImpl::SetStreaming(bool streaming) { | 545 void PipelineImpl::SetStreaming(bool streaming) { |
| 549 DCHECK(IsRunning()); | 546 DCHECK(IsRunning()); |
| 550 media_log_->AddEvent( | 547 media_log_->AddEvent( |
| 551 media_log_->CreateBooleanEvent( | 548 media_log_->CreateBooleanEvent( |
| 552 MediaLogEvent::STREAMING_SET, "streaming", streaming)); | 549 MediaLogEvent::STREAMING_SET, "streaming", streaming)); |
| 553 | 550 |
| 554 base::AutoLock auto_lock(lock_); | 551 base::AutoLock auto_lock(lock_); |
| 555 streaming_ = streaming; | 552 streaming_ = streaming; |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 | 1366 |
| 1370 if (status == PIPELINE_OK && pipeline_filter_) { | 1367 if (status == PIPELINE_OK && pipeline_filter_) { |
| 1371 pipeline_filter_->Seek(seek_timestamp, done_cb); | 1368 pipeline_filter_->Seek(seek_timestamp, done_cb); |
| 1372 return; | 1369 return; |
| 1373 } | 1370 } |
| 1374 | 1371 |
| 1375 done_cb.Run(status); | 1372 done_cb.Run(status); |
| 1376 } | 1373 } |
| 1377 | 1374 |
| 1378 } // namespace media | 1375 } // namespace media |
| OLD | NEW |