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 "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "media/base/audio_decoder_config.h" | 7 #include "media/base/audio_decoder_config.h" |
8 #include "media/base/decoder_buffer.h" | 8 #include "media/base/decoder_buffer.h" |
9 #include "media/base/mock_callback.h" | 9 #include "media/base/mock_callback.h" |
10 #include "media/base/mock_demuxer_host.h" | 10 #include "media/base/mock_demuxer_host.h" |
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2253 TEST_F(ChunkDemuxerTest, TestTimestampOffsetMidParse) { | 2253 TEST_F(ChunkDemuxerTest, TestTimestampOffsetMidParse) { |
2254 ASSERT_TRUE(InitDemuxer(true, true, false)); | 2254 ASSERT_TRUE(InitDemuxer(true, true, false)); |
2255 | 2255 |
2256 scoped_ptr<Cluster> cluster = GenerateCluster(0, 2); | 2256 scoped_ptr<Cluster> cluster = GenerateCluster(0, 2); |
2257 // Append only part of the cluster data. | 2257 // Append only part of the cluster data. |
2258 ASSERT_TRUE(AppendData(cluster->data(), cluster->size() - 13)); | 2258 ASSERT_TRUE(AppendData(cluster->data(), cluster->size() - 13)); |
2259 | 2259 |
2260 // Setting a timestamp should fail because we're in the middle of a cluster. | 2260 // Setting a timestamp should fail because we're in the middle of a cluster. |
2261 ASSERT_FALSE(demuxer_->SetTimestampOffset( | 2261 ASSERT_FALSE(demuxer_->SetTimestampOffset( |
2262 kSourceId, base::TimeDelta::FromSeconds(25))); | 2262 kSourceId, base::TimeDelta::FromSeconds(25))); |
2263 | |
2264 demuxer_->Abort(kSourceId); | |
2265 // After reset, setting a timestamp should succeed since we're no longer | |
acolwell GONE FROM CHROMIUM
2012/09/11 11:31:45
nit: s/reset/Abort()
strobe_
2012/09/11 14:26:53
Done.
| |
2266 // in the middle of a cluster | |
2267 ASSERT_TRUE(demuxer_->SetTimestampOffset( | |
2268 kSourceId, base::TimeDelta::FromSeconds(25))); | |
2263 } | 2269 } |
2264 | 2270 |
2265 TEST_F(ChunkDemuxerTest, TestDurationChange) { | 2271 TEST_F(ChunkDemuxerTest, TestDurationChange) { |
2266 ASSERT_TRUE(InitDemuxer(true, true, false)); | 2272 ASSERT_TRUE(InitDemuxer(true, true, false)); |
2267 static const int kStreamDuration = kDefaultDuration().InMilliseconds(); | 2273 static const int kStreamDuration = kDefaultDuration().InMilliseconds(); |
2268 | 2274 |
2269 // Add data leading up to the currently set duration. | 2275 // Add data leading up to the currently set duration. |
2270 scoped_ptr<Cluster> first_cluster = GenerateCluster( | 2276 scoped_ptr<Cluster> first_cluster = GenerateCluster( |
2271 kStreamDuration - kAudioBlockDuration, | 2277 kStreamDuration - kAudioBlockDuration, |
2272 kStreamDuration - kVideoBlockDuration, 2); | 2278 kStreamDuration - kVideoBlockDuration, 2); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2313 | 2319 |
2314 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster()); | 2320 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster()); |
2315 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); | 2321 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); |
2316 | 2322 |
2317 EXPECT_CALL(host_, SetDuration( | 2323 EXPECT_CALL(host_, SetDuration( |
2318 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp))); | 2324 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp))); |
2319 demuxer_->EndOfStream(PIPELINE_OK); | 2325 demuxer_->EndOfStream(PIPELINE_OK); |
2320 } | 2326 } |
2321 | 2327 |
2322 } // namespace media | 2328 } // namespace media |
OLD | NEW |