| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 void Pipeline::OnAudioTimeUpdate(TimeDelta time, TimeDelta max_time) { | 353 void Pipeline::OnAudioTimeUpdate(TimeDelta time, TimeDelta max_time) { |
| 354 DCHECK_LE(time.InMicroseconds(), max_time.InMicroseconds()); | 354 DCHECK_LE(time.InMicroseconds(), max_time.InMicroseconds()); |
| 355 DCHECK(IsRunning()); | 355 DCHECK(IsRunning()); |
| 356 base::AutoLock auto_lock(lock_); | 356 base::AutoLock auto_lock(lock_); |
| 357 | 357 |
| 358 if (!has_audio_) | 358 if (!has_audio_) |
| 359 return; | 359 return; |
| 360 if (waiting_for_clock_update_ && time < clock_->Elapsed()) | 360 if (waiting_for_clock_update_ && time < clock_->Elapsed()) |
| 361 return; | 361 return; |
| 362 | 362 |
| 363 // TODO(scherkus): |state_| should only be accessed on pipeline thread, see |
| 364 // http://crbug.com/137973 |
| 363 if (state_ == kSeeking) | 365 if (state_ == kSeeking) |
| 364 return; | 366 return; |
| 365 | 367 |
| 366 clock_->SetTime(time, max_time); | 368 clock_->SetTime(time, max_time); |
| 367 StartClockIfWaitingForTimeUpdate_Locked(); | 369 StartClockIfWaitingForTimeUpdate_Locked(); |
| 368 } | 370 } |
| 369 | 371 |
| 370 void Pipeline::OnVideoTimeUpdate(TimeDelta max_time) { | 372 void Pipeline::OnVideoTimeUpdate(TimeDelta max_time) { |
| 371 DCHECK(IsRunning()); | 373 DCHECK(IsRunning()); |
| 372 base::AutoLock auto_lock(lock_); | 374 base::AutoLock auto_lock(lock_); |
| 373 | 375 |
| 374 if (has_audio_) | 376 if (has_audio_) |
| 375 return; | 377 return; |
| 376 | 378 |
| 379 // TODO(scherkus): |state_| should only be accessed on pipeline thread, see |
| 380 // http://crbug.com/137973 |
| 377 if (state_ == kSeeking) | 381 if (state_ == kSeeking) |
| 378 return; | 382 return; |
| 379 | 383 |
| 380 DCHECK(!waiting_for_clock_update_); | 384 DCHECK(!waiting_for_clock_update_); |
| 381 clock_->SetMaxTime(max_time); | 385 clock_->SetMaxTime(max_time); |
| 382 } | 386 } |
| 383 | 387 |
| 384 void Pipeline::SetDuration(TimeDelta duration) { | 388 void Pipeline::SetDuration(TimeDelta duration) { |
| 385 DCHECK(IsRunning()); | 389 DCHECK(IsRunning()); |
| 386 media_log_->AddEvent( | 390 media_log_->AddEvent( |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { | 959 void Pipeline::StartClockIfWaitingForTimeUpdate_Locked() { |
| 956 lock_.AssertAcquired(); | 960 lock_.AssertAcquired(); |
| 957 if (!waiting_for_clock_update_) | 961 if (!waiting_for_clock_update_) |
| 958 return; | 962 return; |
| 959 | 963 |
| 960 waiting_for_clock_update_ = false; | 964 waiting_for_clock_update_ = false; |
| 961 clock_->Play(); | 965 clock_->Play(); |
| 962 } | 966 } |
| 963 | 967 |
| 964 } // namespace media | 968 } // namespace media |
| OLD | NEW |