Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: media/filters/chunk_demuxer_unittest.cc

Issue 10800041: Update media duration if data is appended after the previous duration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase ToT Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | webkit/media/webmediaplayer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)));
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
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | webkit/media/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698