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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 302 } |
303 | 303 |
304 void PipelineImpl::GetNaturalVideoSize(gfx::Size* out_size) const { | 304 void PipelineImpl::GetNaturalVideoSize(gfx::Size* out_size) const { |
305 CHECK(out_size); | 305 CHECK(out_size); |
306 base::AutoLock auto_lock(lock_); | 306 base::AutoLock auto_lock(lock_); |
307 *out_size = natural_size_; | 307 *out_size = natural_size_; |
308 } | 308 } |
309 | 309 |
310 bool PipelineImpl::IsStreaming() const { | 310 bool PipelineImpl::IsStreaming() const { |
311 base::AutoLock auto_lock(lock_); | 311 base::AutoLock auto_lock(lock_); |
312 return streaming_; | 312 return streaming_ || media_stream_; |
313 } | 313 } |
314 | 314 |
315 bool PipelineImpl::IsLoaded() const { | 315 bool PipelineImpl::IsLoaded() const { |
316 base::AutoLock auto_lock(lock_); | 316 base::AutoLock auto_lock(lock_); |
317 return loaded_; | 317 return loaded_; |
318 } | 318 } |
319 | 319 |
320 PipelineStatistics PipelineImpl::GetStatistics() const { | 320 PipelineStatistics PipelineImpl::GetStatistics() const { |
321 base::AutoLock auto_lock(lock_); | 321 base::AutoLock auto_lock(lock_); |
322 return statistics_; | 322 return statistics_; |
(...skipping 28 matching lines...) Expand all Loading... |
351 running_ = false; | 351 running_ = false; |
352 stop_pending_ = false; | 352 stop_pending_ = false; |
353 seek_pending_ = false; | 353 seek_pending_ = false; |
354 tearing_down_ = false; | 354 tearing_down_ = false; |
355 error_caused_teardown_ = false; | 355 error_caused_teardown_ = false; |
356 playback_rate_change_pending_ = false; | 356 playback_rate_change_pending_ = false; |
357 duration_ = kZero; | 357 duration_ = kZero; |
358 buffered_time_ = kZero; | 358 buffered_time_ = kZero; |
359 buffered_bytes_ = 0; | 359 buffered_bytes_ = 0; |
360 streaming_ = false; | 360 streaming_ = false; |
| 361 media_stream_ = false; |
361 loaded_ = false; | 362 loaded_ = false; |
362 total_bytes_ = 0; | 363 total_bytes_ = 0; |
363 natural_size_.SetSize(0, 0); | 364 natural_size_.SetSize(0, 0); |
364 volume_ = 1.0f; | 365 volume_ = 1.0f; |
365 preload_ = AUTO; | 366 preload_ = AUTO; |
366 playback_rate_ = 0.0f; | 367 playback_rate_ = 0.0f; |
367 pending_playback_rate_ = 0.0f; | 368 pending_playback_rate_ = 0.0f; |
368 status_ = PIPELINE_OK; | 369 status_ = PIPELINE_OK; |
369 has_audio_ = false; | 370 has_audio_ = false; |
370 has_video_ = false; | 371 has_video_ = false; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 541 |
541 void PipelineImpl::SetNaturalVideoSize(const gfx::Size& size) { | 542 void PipelineImpl::SetNaturalVideoSize(const gfx::Size& size) { |
542 DCHECK(IsRunning()); | 543 DCHECK(IsRunning()); |
543 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent( | 544 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent( |
544 size.width(), size.height())); | 545 size.width(), size.height())); |
545 | 546 |
546 base::AutoLock auto_lock(lock_); | 547 base::AutoLock auto_lock(lock_); |
547 natural_size_ = size; | 548 natural_size_ = size; |
548 } | 549 } |
549 | 550 |
| 551 void PipelineImpl::SetMediaStream(bool is_media_stream) { |
| 552 base::AutoLock auto_lock(lock_); |
| 553 media_stream_ = is_media_stream; |
| 554 download_rate_monitor_.set_media_stream(media_stream_); |
| 555 } |
| 556 |
550 void PipelineImpl::SetStreaming(bool streaming) { | 557 void PipelineImpl::SetStreaming(bool streaming) { |
551 DCHECK(IsRunning()); | 558 DCHECK(IsRunning()); |
552 media_log_->AddEvent( | 559 media_log_->AddEvent( |
553 media_log_->CreateBooleanEvent( | 560 media_log_->CreateBooleanEvent( |
554 MediaLogEvent::STREAMING_SET, "streaming", streaming)); | 561 MediaLogEvent::STREAMING_SET, "streaming", streaming)); |
555 | 562 |
556 base::AutoLock auto_lock(lock_); | 563 base::AutoLock auto_lock(lock_); |
557 streaming_ = streaming; | 564 streaming_ = streaming; |
| 565 download_rate_monitor_.set_streaming(streaming_); |
558 } | 566 } |
559 | 567 |
560 void PipelineImpl::NotifyEnded() { | 568 void PipelineImpl::NotifyEnded() { |
561 DCHECK(IsRunning()); | 569 DCHECK(IsRunning()); |
562 message_loop_->PostTask(FROM_HERE, | 570 message_loop_->PostTask(FROM_HERE, |
563 base::Bind(&PipelineImpl::NotifyEndedTask, this)); | 571 base::Bind(&PipelineImpl::NotifyEndedTask, this)); |
564 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::ENDED)); | 572 media_log_->AddEvent(media_log_->CreateEvent(MediaLogEvent::ENDED)); |
565 } | 573 } |
566 | 574 |
567 void PipelineImpl::SetLoaded(bool loaded) { | 575 void PipelineImpl::SetLoaded(bool loaded) { |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 message_loop_->PostTask(FROM_HERE, | 1439 message_loop_->PostTask(FROM_HERE, |
1432 base::Bind(&PipelineImpl::NotifyCanPlayThrough, this)); | 1440 base::Bind(&PipelineImpl::NotifyCanPlayThrough, this)); |
1433 } | 1441 } |
1434 | 1442 |
1435 void PipelineImpl::NotifyCanPlayThrough() { | 1443 void PipelineImpl::NotifyCanPlayThrough() { |
1436 DCHECK_EQ(MessageLoop::current(), message_loop_); | 1444 DCHECK_EQ(MessageLoop::current(), message_loop_); |
1437 NotifyNetworkEventTask(CAN_PLAY_THROUGH); | 1445 NotifyNetworkEventTask(CAN_PLAY_THROUGH); |
1438 } | 1446 } |
1439 | 1447 |
1440 } // namespace media | 1448 } // namespace media |
OLD | NEW |