| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "media/base/android/media_codec_audio_decoder.h" | 9 #include "media/base/android/media_codec_audio_decoder.h" |
| 10 #include "media/base/android/media_codec_bridge.h" | 10 #include "media/base/android/media_codec_bridge.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 EXPECT_TRUE(decoder_->Start(base::TimeDelta::FromMilliseconds(0))); | 486 EXPECT_TRUE(decoder_->Start(base::TimeDelta::FromMilliseconds(0))); |
| 487 | 487 |
| 488 EXPECT_TRUE(WaitForCondition( | 488 EXPECT_TRUE(WaitForCondition( |
| 489 base::Bind(&MediaCodecDecoderTest::is_stopped, base::Unretained(this)), | 489 base::Bind(&MediaCodecDecoderTest::is_stopped, base::Unretained(this)), |
| 490 timeout)); | 490 timeout)); |
| 491 | 491 |
| 492 EXPECT_TRUE(decoder_->IsStopped()); | 492 EXPECT_TRUE(decoder_->IsStopped()); |
| 493 EXPECT_TRUE(decoder_->IsCompleted()); | 493 EXPECT_TRUE(decoder_->IsCompleted()); |
| 494 | 494 |
| 495 // Last buffered timestamp should be no less than PTS. | 495 // Last buffered timestamp should be no less than PTS. |
| 496 EXPECT_EQ(22, pts_stat_.num_values()); | 496 // The number of hits in pts_stat_ depends on the preroll implementation. |
| 497 // We might not report the time for the first buffer after preroll that |
| 498 // is written to the audio track. pts_stat_.num_values() is either 21 or 22. |
| 499 EXPECT_LE(21, pts_stat_.num_values()); |
| 497 EXPECT_LE(data_factory_->last_pts(), pts_stat_.max()); | 500 EXPECT_LE(data_factory_->last_pts(), pts_stat_.max()); |
| 498 | 501 |
| 499 DVLOG(0) << "AudioPlayTillCompletion stopping"; | 502 DVLOG(0) << "AudioPlayTillCompletion stopping"; |
| 500 } | 503 } |
| 501 | 504 |
| 502 TEST_F(MediaCodecDecoderTest, VideoPlayTillCompletion) { | 505 TEST_F(MediaCodecDecoderTest, VideoPlayTillCompletion) { |
| 503 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); | 506 SKIP_TEST_IF_MEDIA_CODEC_BRIDGE_IS_NOT_AVAILABLE(); |
| 504 | 507 |
| 505 CreateVideoDecoder(); | 508 CreateVideoDecoder(); |
| 506 | 509 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 decoder_->RequestToStop(); | 650 decoder_->RequestToStop(); |
| 648 | 651 |
| 649 EXPECT_TRUE(WaitForCondition( | 652 EXPECT_TRUE(WaitForCondition( |
| 650 base::Bind(&MediaCodecDecoderTest::is_stopped, base::Unretained(this)))); | 653 base::Bind(&MediaCodecDecoderTest::is_stopped, base::Unretained(this)))); |
| 651 | 654 |
| 652 EXPECT_TRUE(decoder_->IsStopped()); | 655 EXPECT_TRUE(decoder_->IsStopped()); |
| 653 EXPECT_FALSE(decoder_->IsCompleted()); | 656 EXPECT_FALSE(decoder_->IsCompleted()); |
| 654 } | 657 } |
| 655 | 658 |
| 656 } // namespace media | 659 } // namespace media |
| OLD | NEW |