| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 ScopedVector<VideoDecoder> decoders; | 60 ScopedVector<VideoDecoder> decoders; |
| 61 decoders.push_back(decoder_); | 61 decoders.push_back(decoder_); |
| 62 | 62 |
| 63 null_video_sink_.reset(new NullVideoSink( | 63 null_video_sink_.reset(new NullVideoSink( |
| 64 false, base::TimeDelta::FromSecondsD(1.0 / 60), | 64 false, base::TimeDelta::FromSecondsD(1.0 / 60), |
| 65 base::Bind(&MockCB::FrameReceived, base::Unretained(&mock_cb_)), | 65 base::Bind(&MockCB::FrameReceived, base::Unretained(&mock_cb_)), |
| 66 message_loop_.task_runner())); | 66 message_loop_.task_runner())); |
| 67 | 67 |
| 68 renderer_.reset(new VideoRendererImpl( | 68 renderer_.reset(new VideoRendererImpl( |
| 69 message_loop_.task_runner(), message_loop_.task_runner().get(), | 69 message_loop_.task_runner(), message_loop_.task_runner().get(), |
| 70 null_video_sink_.get(), decoders.Pass(), true, | 70 null_video_sink_.get(), std::move(decoders), true, |
| 71 nullptr, // gpu_factories | 71 nullptr, // gpu_factories |
| 72 new MediaLog())); | 72 new MediaLog())); |
| 73 renderer_->SetTickClockForTesting(scoped_ptr<base::TickClock>(tick_clock_)); | 73 renderer_->SetTickClockForTesting(scoped_ptr<base::TickClock>(tick_clock_)); |
| 74 null_video_sink_->set_tick_clock_for_testing(tick_clock_); | 74 null_video_sink_->set_tick_clock_for_testing(tick_clock_); |
| 75 time_source_.set_tick_clock_for_testing(tick_clock_); | 75 time_source_.set_tick_clock_for_testing(tick_clock_); |
| 76 | 76 |
| 77 // Start wallclock time at a non-zero value. | 77 // Start wallclock time at a non-zero value. |
| 78 AdvanceWallclockTimeInMs(12345); | 78 AdvanceWallclockTimeInMs(12345); |
| 79 | 79 |
| 80 demuxer_stream_.set_video_decoder_config(TestVideoConfig::Normal()); | 80 demuxer_stream_.set_video_decoder_config(TestVideoConfig::Normal()); |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); | 741 EXPECT_CALL(mock_cb_, BufferingStateChange(BUFFERING_HAVE_ENOUGH)); |
| 742 WaitForEnded(); | 742 WaitForEnded(); |
| 743 Destroy(); | 743 Destroy(); |
| 744 } | 744 } |
| 745 | 745 |
| 746 class VideoRendererImplAsyncAddFrameReadyTest : public VideoRendererImplTest { | 746 class VideoRendererImplAsyncAddFrameReadyTest : public VideoRendererImplTest { |
| 747 public: | 747 public: |
| 748 VideoRendererImplAsyncAddFrameReadyTest() { | 748 VideoRendererImplAsyncAddFrameReadyTest() { |
| 749 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool( | 749 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool( |
| 750 new MockGpuMemoryBufferVideoFramePool(&frame_ready_cbs_)); | 750 new MockGpuMemoryBufferVideoFramePool(&frame_ready_cbs_)); |
| 751 renderer_->SetGpuMemoryBufferVideoForTesting(gpu_memory_buffer_pool.Pass()); | 751 renderer_->SetGpuMemoryBufferVideoForTesting( |
| 752 std::move(gpu_memory_buffer_pool)); |
| 752 } | 753 } |
| 753 | 754 |
| 754 protected: | 755 protected: |
| 755 std::vector<base::Closure> frame_ready_cbs_; | 756 std::vector<base::Closure> frame_ready_cbs_; |
| 756 }; | 757 }; |
| 757 | 758 |
| 758 TEST_F(VideoRendererImplAsyncAddFrameReadyTest, InitializeAndStartPlayingFrom) { | 759 TEST_F(VideoRendererImplAsyncAddFrameReadyTest, InitializeAndStartPlayingFrom) { |
| 759 Initialize(); | 760 Initialize(); |
| 760 QueueFrames("0 10 20 30"); | 761 QueueFrames("0 10 20 30"); |
| 761 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(0))); | 762 EXPECT_CALL(mock_cb_, FrameReceived(HasTimestamp(0))); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 776 QueueFrames("0 10 20 30"); | 777 QueueFrames("0 10 20 30"); |
| 777 StartPlayingFrom(0); | 778 StartPlayingFrom(0); |
| 778 Flush(); | 779 Flush(); |
| 779 ASSERT_EQ(1u, frame_ready_cbs_.size()); | 780 ASSERT_EQ(1u, frame_ready_cbs_.size()); |
| 780 // This frame will be discarded. | 781 // This frame will be discarded. |
| 781 frame_ready_cbs_.front().Run(); | 782 frame_ready_cbs_.front().Run(); |
| 782 Destroy(); | 783 Destroy(); |
| 783 } | 784 } |
| 784 | 785 |
| 785 } // namespace media | 786 } // namespace media |
| OLD | NEW |