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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2642 ASSERT_FALSE(demuxer_->SetTimestampOffset( | 2642 ASSERT_FALSE(demuxer_->SetTimestampOffset( |
2643 kSourceId, base::TimeDelta::FromSeconds(25))); | 2643 kSourceId, base::TimeDelta::FromSeconds(25))); |
2644 | 2644 |
2645 demuxer_->Abort(kSourceId); | 2645 demuxer_->Abort(kSourceId); |
2646 // After Abort(), setting a timestamp should succeed since we're no longer | 2646 // After Abort(), setting a timestamp should succeed since we're no longer |
2647 // in the middle of a cluster | 2647 // in the middle of a cluster |
2648 ASSERT_TRUE(demuxer_->SetTimestampOffset( | 2648 ASSERT_TRUE(demuxer_->SetTimestampOffset( |
2649 kSourceId, base::TimeDelta::FromSeconds(25))); | 2649 kSourceId, base::TimeDelta::FromSeconds(25))); |
2650 } | 2650 } |
2651 | 2651 |
2652 TEST_F(ChunkDemuxerTest, SetSequenceModeMidParse) { | |
acolwell GONE FROM CHROMIUM
2014/01/11 01:24:36
nit: s/MidParse/MidMediaSegment/ here and the test
wolenetz
2014/01/11 02:15:05
Done.
| |
2653 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | |
2654 | |
2655 scoped_ptr<Cluster> cluster = GenerateCluster(0, 2); | |
2656 // Append only part of the cluster data. | |
2657 AppendData(cluster->data(), cluster->size() - 13); | |
2658 | |
2659 // Setting append mode should fail because we're in the middle of a cluster. | |
2660 ASSERT_FALSE(demuxer_->SetSequenceMode(kSourceId, true)); | |
2661 ASSERT_FALSE(demuxer_->SetSequenceMode(kSourceId, false)); | |
2662 | |
2663 demuxer_->Abort(kSourceId); | |
2664 // After Abort(), setting append mode should succeed since we're no longer | |
2665 // in the middle of a cluster. | |
2666 ASSERT_TRUE(demuxer_->SetSequenceMode(kSourceId, true)); | |
2667 ASSERT_TRUE(demuxer_->SetSequenceMode(kSourceId, false)); | |
2668 } | |
2669 | |
2652 TEST_F(ChunkDemuxerTest, DurationChange) { | 2670 TEST_F(ChunkDemuxerTest, DurationChange) { |
2653 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); | 2671 ASSERT_TRUE(InitDemuxer(HAS_AUDIO | HAS_VIDEO)); |
2654 const int kStreamDuration = kDefaultDuration().InMilliseconds(); | 2672 const int kStreamDuration = kDefaultDuration().InMilliseconds(); |
2655 | 2673 |
2656 // Add data leading up to the currently set duration. | 2674 // Add data leading up to the currently set duration. |
2657 AppendCluster(GenerateCluster(kStreamDuration - kAudioBlockDuration, | 2675 AppendCluster(GenerateCluster(kStreamDuration - kAudioBlockDuration, |
2658 kStreamDuration - kVideoBlockDuration, | 2676 kStreamDuration - kVideoBlockDuration, |
2659 2)); | 2677 2)); |
2660 | 2678 |
2661 CheckExpectedRanges(kSourceId, "{ [201191,201224) }"); | 2679 CheckExpectedRanges(kSourceId, "{ [201191,201224) }"); |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3088 // NOTE: we start at 175 here because the buffer at 125 was returned | 3106 // NOTE: we start at 175 here because the buffer at 125 was returned |
3089 // to the pending read initiated above. | 3107 // to the pending read initiated above. |
3090 CheckExpectedBuffers(text_stream, "175 225"); | 3108 CheckExpectedBuffers(text_stream, "175 225"); |
3091 | 3109 |
3092 // Verify that audio & video streams contiue to return expected values. | 3110 // Verify that audio & video streams contiue to return expected values. |
3093 CheckExpectedBuffers(audio_stream, "160 180"); | 3111 CheckExpectedBuffers(audio_stream, "160 180"); |
3094 CheckExpectedBuffers(video_stream, "180 210"); | 3112 CheckExpectedBuffers(video_stream, "180 210"); |
3095 } | 3113 } |
3096 | 3114 |
3097 } // namespace media | 3115 } // namespace media |
OLD | NEW |