| 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/renderers/audio_renderer_impl.h" | 5 #include "media/renderers/audio_renderer_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 void DecodeDecoder(const scoped_refptr<DecoderBuffer>& buffer, | 408 void DecodeDecoder(const scoped_refptr<DecoderBuffer>& buffer, |
| 409 const AudioDecoder::DecodeCB& decode_cb) { | 409 const AudioDecoder::DecodeCB& decode_cb) { |
| 410 // TODO(scherkus): Make this a DCHECK after threading semantics are fixed. | 410 // TODO(scherkus): Make this a DCHECK after threading semantics are fixed. |
| 411 if (base::MessageLoop::current() != &message_loop_) { | 411 if (base::MessageLoop::current() != &message_loop_) { |
| 412 message_loop_.task_runner()->PostTask( | 412 message_loop_.task_runner()->PostTask( |
| 413 FROM_HERE, base::Bind(&AudioRendererImplTest::DecodeDecoder, | 413 FROM_HERE, base::Bind(&AudioRendererImplTest::DecodeDecoder, |
| 414 base::Unretained(this), buffer, decode_cb)); | 414 base::Unretained(this), buffer, decode_cb)); |
| 415 return; | 415 return; |
| 416 } | 416 } |
| 417 | 417 |
| 418 CHECK(decode_cb_.is_null()) << "Overlapping decodes are not permitted"; | 418 // Overlapping decodes are not permitted |
| 419 CHECK(decode_cb_.is_null()); |
| 419 decode_cb_ = decode_cb; | 420 decode_cb_ = decode_cb; |
| 420 | 421 |
| 421 // Wake up WaitForPendingRead() if needed. | 422 // Wake up WaitForPendingRead() if needed. |
| 422 if (!wait_for_pending_decode_cb_.is_null()) | 423 if (!wait_for_pending_decode_cb_.is_null()) |
| 423 base::ResetAndReturn(&wait_for_pending_decode_cb_).Run(); | 424 base::ResetAndReturn(&wait_for_pending_decode_cb_).Run(); |
| 424 } | 425 } |
| 425 | 426 |
| 426 void ResetDecoder(const base::Closure& reset_cb) { | 427 void ResetDecoder(const base::Closure& reset_cb) { |
| 427 if (!decode_cb_.is_null()) { | 428 if (!decode_cb_.is_null()) { |
| 428 // |reset_cb| will be called in DeliverBuffer(), after the decoder is | 429 // |reset_cb| will be called in DeliverBuffer(), after the decoder is |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 // Advance far enough that we shouldn't be clamped to current time (tested | 1064 // Advance far enough that we shouldn't be clamped to current time (tested |
| 1064 // already above). | 1065 // already above). |
| 1065 tick_clock_->Advance(kOneSecond); | 1066 tick_clock_->Advance(kOneSecond); |
| 1066 EXPECT_EQ( | 1067 EXPECT_EQ( |
| 1067 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), | 1068 current_time + timestamp_helper.GetFrameDuration(frames_to_consume.value), |
| 1068 CurrentMediaWallClockTime(&is_time_moving)); | 1069 CurrentMediaWallClockTime(&is_time_moving)); |
| 1069 EXPECT_TRUE(is_time_moving); | 1070 EXPECT_TRUE(is_time_moving); |
| 1070 } | 1071 } |
| 1071 | 1072 |
| 1072 } // namespace media | 1073 } // namespace media |
| OLD | NEW |