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 "media/base/pipeline.h" | 5 #include "media/base/pipeline.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 MediaLogEvent::DURATION_SET, "duration", duration)); | 367 MediaLogEvent::DURATION_SET, "duration", duration)); |
368 UMA_HISTOGRAM_LONG_TIMES("Media.Duration", duration); | 368 UMA_HISTOGRAM_LONG_TIMES("Media.Duration", duration); |
369 | 369 |
370 base::AutoLock auto_lock(lock_); | 370 base::AutoLock auto_lock(lock_); |
371 clock_->SetDuration(duration); | 371 clock_->SetDuration(duration); |
372 if (!duration_change_cb_.is_null()) | 372 if (!duration_change_cb_.is_null()) |
373 duration_change_cb_.Run(); | 373 duration_change_cb_.Run(); |
374 } | 374 } |
375 | 375 |
376 void Pipeline::SetTotalBytes(int64 total_bytes) { | 376 void Pipeline::SetTotalBytes(int64 total_bytes) { |
377 DCHECK(IsRunning()); | |
378 media_log_->AddEvent( | 377 media_log_->AddEvent( |
379 media_log_->CreateStringEvent( | 378 media_log_->CreateStringEvent( |
380 MediaLogEvent::TOTAL_BYTES_SET, "total_bytes", | 379 MediaLogEvent::TOTAL_BYTES_SET, "total_bytes", |
381 base::Int64ToString(total_bytes))); | 380 base::Int64ToString(total_bytes))); |
382 int64 total_mbytes = total_bytes >> 20; | 381 int64 total_mbytes = total_bytes >> 20; |
383 if (total_mbytes > kint32max) | 382 if (total_mbytes > kint32max) |
384 total_mbytes = kint32max; | 383 total_mbytes = kint32max; |
385 UMA_HISTOGRAM_CUSTOM_COUNTS( | 384 UMA_HISTOGRAM_CUSTOM_COUNTS( |
386 "Media.TotalMBytes", static_cast<int32>(total_mbytes), 1, kint32max, 50); | 385 "Media.TotalMBytes", static_cast<int32>(total_mbytes), 1, kint32max, 50); |
387 | 386 |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 // executing |stop_cb_|. | 677 // executing |stop_cb_|. |
679 return; | 678 return; |
680 } | 679 } |
681 if (!error_cb_.is_null()) { | 680 if (!error_cb_.is_null()) { |
682 DCHECK_NE(status_, PIPELINE_OK); | 681 DCHECK_NE(status_, PIPELINE_OK); |
683 base::ResetAndReturn(&error_cb_).Run(status_); | 682 base::ResetAndReturn(&error_cb_).Run(status_); |
684 } | 683 } |
685 } | 684 } |
686 | 685 |
687 void Pipeline::AddBufferedByteRange(int64 start, int64 end) { | 686 void Pipeline::AddBufferedByteRange(int64 start, int64 end) { |
688 DCHECK(IsRunning()); | |
689 base::AutoLock auto_lock(lock_); | 687 base::AutoLock auto_lock(lock_); |
690 buffered_byte_ranges_.Add(start, end); | 688 buffered_byte_ranges_.Add(start, end); |
691 did_loading_progress_ = true; | 689 did_loading_progress_ = true; |
692 } | 690 } |
693 | 691 |
694 void Pipeline::AddBufferedTimeRange(base::TimeDelta start, | 692 void Pipeline::AddBufferedTimeRange(base::TimeDelta start, |
695 base::TimeDelta end) { | 693 base::TimeDelta end) { |
696 DCHECK(IsRunning()); | 694 DCHECK(IsRunning()); |
697 base::AutoLock auto_lock(lock_); | 695 base::AutoLock auto_lock(lock_); |
698 buffered_time_ranges_.Add(start, end); | 696 buffered_time_ranges_.Add(start, end); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { | 986 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { |
989 lock_.AssertAcquired(); | 987 lock_.AssertAcquired(); |
990 if (!waiting_for_clock_update_) | 988 if (!waiting_for_clock_update_) |
991 return; | 989 return; |
992 | 990 |
993 waiting_for_clock_update_ = false; | 991 waiting_for_clock_update_ = false; |
994 clock_->Play(); | 992 clock_->Play(); |
995 } | 993 } |
996 | 994 |
997 } // namespace media | 995 } // namespace media |
OLD | NEW |