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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "media/base/audio_decoder_config.h" | 6 #include "media/base/audio_decoder_config.h" |
7 #include "media/base/decoder_buffer.h" | 7 #include "media/base/decoder_buffer.h" |
8 #include "media/base/mock_callback.h" | 8 #include "media/base/mock_callback.h" |
9 #include "media/base/mock_demuxer_host.h" | 9 #include "media/base/mock_demuxer_host.h" |
10 #include "media/base/test_data_util.h" | 10 #include "media/base/test_data_util.h" |
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2123 TEST_F(ChunkDemuxerTest, TestTimestampOffsetMidParse) { | 2123 TEST_F(ChunkDemuxerTest, TestTimestampOffsetMidParse) { |
2124 ASSERT_TRUE(InitDemuxer(true, true, false)); | 2124 ASSERT_TRUE(InitDemuxer(true, true, false)); |
2125 | 2125 |
2126 scoped_ptr<Cluster> cluster = GenerateCluster(0, 2); | 2126 scoped_ptr<Cluster> cluster = GenerateCluster(0, 2); |
2127 // Append only part of the cluster data. | 2127 // Append only part of the cluster data. |
2128 ASSERT_TRUE(AppendData(cluster->data(), cluster->size() - 13)); | 2128 ASSERT_TRUE(AppendData(cluster->data(), cluster->size() - 13)); |
2129 | 2129 |
2130 // Setting a timestamp should fail because we're in the middle of a cluster. | 2130 // Setting a timestamp should fail because we're in the middle of a cluster. |
2131 ASSERT_FALSE(demuxer_->SetTimestampOffset(kSourceId, 25)); | 2131 ASSERT_FALSE(demuxer_->SetTimestampOffset(kSourceId, 25)); |
2132 } | 2132 } |
2133 | |
2134 TEST_F(ChunkDemuxerTest, TestDurationChange) { | |
2135 ASSERT_TRUE(InitDemuxer(true, true, false)); | |
2136 | |
2137 // Add data leading up to the currently set duration. | |
2138 scoped_ptr<Cluster> first_cluster = GenerateCluster( | |
2139 kDefaultDuration().InMilliseconds() - kAudioBlockDuration, | |
2140 kDefaultDuration().InMilliseconds() - kVideoBlockDuration, 2); | |
2141 ASSERT_TRUE(AppendData(first_cluster->data(), first_cluster->size())); | |
2142 | |
2143 // Now add data past the duration and expect a new duration to be signalled. | |
2144 scoped_ptr<Cluster> second_cluster = GenerateCluster( | |
2145 kDefaultDuration().InMilliseconds(), 4); | |
2146 EXPECT_CALL(host_, SetDuration( | |
2147 kDefaultDuration() + base::TimeDelta::FromMilliseconds( | |
2148 kAudioBlockDuration * 2))); | |
vrk (LEFT CHROMIUM)
2012/07/28 01:42:06
These values here and below are a bit weird... pro
| |
2149 ASSERT_TRUE(AppendData(second_cluster->data(), second_cluster->size())); | |
2150 } | |
2151 | |
2152 TEST_F(ChunkDemuxerTest, TestDurationChangeTimestampOffset) { | |
2153 ASSERT_TRUE(InitDemuxer(true, true, false)); | |
2154 | |
2155 ASSERT_TRUE(demuxer_->SetTimestampOffset(kSourceId, | |
2156 kDefaultDuration().InSecondsF())); | |
2157 scoped_ptr<Cluster> cluster = GenerateCluster(0, 4); | |
2158 | |
2159 EXPECT_CALL(host_, SetDuration( | |
2160 kDefaultDuration() + base::TimeDelta::FromMilliseconds( | |
2161 kAudioBlockDuration * 2))); | |
2162 ASSERT_TRUE(AppendData(cluster->data(), cluster->size())); | |
2163 } | |
2164 | |
2133 } // namespace media | 2165 } // namespace media |
OLD | NEW |