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

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

Issue 10828425: Add support for config changes during playback to FFmpegVideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add config_change_pending_ initializers to constructors. 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 | « no previous file | media/filters/ffmpeg_video_decoder.h » ('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 "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 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 EXPECT_EQ(video_config_1.natural_size().width(), 320); 2049 EXPECT_EQ(video_config_1.natural_size().width(), 320);
2050 EXPECT_EQ(video_config_1.natural_size().height(), 240); 2050 EXPECT_EQ(video_config_1.natural_size().height(), 240);
2051 2051
2052 ExpectRead(stream, 0); 2052 ExpectRead(stream, 0);
2053 2053
2054 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp); 2054 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp);
2055 2055
2056 ASSERT_EQ(status, DemuxerStream::kConfigChanged); 2056 ASSERT_EQ(status, DemuxerStream::kConfigChanged);
2057 EXPECT_EQ(last_timestamp.InMilliseconds(), 501); 2057 EXPECT_EQ(last_timestamp.InMilliseconds(), 501);
2058 2058
2059 // Verify that another read will result in kConfigChanged being returned
2060 // again.
2061 ExpectConfigChanged(stream);
2062
2063 // Fetch the new decoder config. 2059 // Fetch the new decoder config.
2064 const VideoDecoderConfig& video_config_2 = stream->video_decoder_config(); 2060 const VideoDecoderConfig& video_config_2 = stream->video_decoder_config();
2065 ASSERT_TRUE(video_config_2.IsValidConfig()); 2061 ASSERT_TRUE(video_config_2.IsValidConfig());
2066 EXPECT_EQ(video_config_2.natural_size().width(), 640); 2062 EXPECT_EQ(video_config_2.natural_size().width(), 640);
2067 EXPECT_EQ(video_config_2.natural_size().height(), 360); 2063 EXPECT_EQ(video_config_2.natural_size().height(), 360);
2068 2064
2069 ExpectRead(stream, 527); 2065 ExpectRead(stream, 527);
2070 2066
2071 // Read until the next config change. 2067 // Read until the next config change.
2072 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp); 2068 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp);
2073 ASSERT_EQ(status, DemuxerStream::kConfigChanged); 2069 ASSERT_EQ(status, DemuxerStream::kConfigChanged);
2074 EXPECT_EQ(last_timestamp.InMilliseconds(), 793); 2070 EXPECT_EQ(last_timestamp.InMilliseconds(), 793);
2075 2071
2076 // Verify we get another ConfigChanged status.
2077 ExpectConfigChanged(stream);
2078
2079 // Get the new config and verify that it matches the first one. 2072 // Get the new config and verify that it matches the first one.
2080 ASSERT_TRUE(video_config_1.Matches(stream->video_decoder_config())); 2073 ASSERT_TRUE(video_config_1.Matches(stream->video_decoder_config()));
2081 2074
2082 ExpectRead(stream, 801); 2075 ExpectRead(stream, 801);
2083 2076
2084 // Read until the end of the stream just to make sure there aren't any other 2077 // Read until the end of the stream just to make sure there aren't any other
2085 // config changes. 2078 // config changes.
2086 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp); 2079 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp);
2087 ASSERT_EQ(status, DemuxerStream::kOk); 2080 ASSERT_EQ(status, DemuxerStream::kOk);
2088 } 2081 }
(...skipping 14 matching lines...) Expand all
2103 EXPECT_EQ(audio_config_1.samples_per_second(), 44100); 2096 EXPECT_EQ(audio_config_1.samples_per_second(), 44100);
2104 EXPECT_EQ(audio_config_1.extra_data_size(), 3863u); 2097 EXPECT_EQ(audio_config_1.extra_data_size(), 3863u);
2105 2098
2106 ExpectRead(stream, 0); 2099 ExpectRead(stream, 0);
2107 2100
2108 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp); 2101 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp);
2109 2102
2110 ASSERT_EQ(status, DemuxerStream::kConfigChanged); 2103 ASSERT_EQ(status, DemuxerStream::kConfigChanged);
2111 EXPECT_EQ(last_timestamp.InMilliseconds(), 524); 2104 EXPECT_EQ(last_timestamp.InMilliseconds(), 524);
2112 2105
2113 // Verify that another read will result in kConfigChanged being returned
2114 // again.
2115 ExpectConfigChanged(stream);
2116
2117 // Fetch the new decoder config. 2106 // Fetch the new decoder config.
2118 const AudioDecoderConfig& audio_config_2 = stream->audio_decoder_config(); 2107 const AudioDecoderConfig& audio_config_2 = stream->audio_decoder_config();
2119 ASSERT_TRUE(audio_config_2.IsValidConfig()); 2108 ASSERT_TRUE(audio_config_2.IsValidConfig());
2120 EXPECT_EQ(audio_config_2.samples_per_second(), 44100); 2109 EXPECT_EQ(audio_config_2.samples_per_second(), 44100);
2121 EXPECT_EQ(audio_config_2.extra_data_size(), 3935u); 2110 EXPECT_EQ(audio_config_2.extra_data_size(), 3935u);
2122 2111
2123 ExpectRead(stream, 527); 2112 ExpectRead(stream, 527);
2124 2113
2125 // Read until the next config change. 2114 // Read until the next config change.
2126 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp); 2115 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp);
2127 ASSERT_EQ(status, DemuxerStream::kConfigChanged); 2116 ASSERT_EQ(status, DemuxerStream::kConfigChanged);
2128 EXPECT_EQ(last_timestamp.InMilliseconds(), 759); 2117 EXPECT_EQ(last_timestamp.InMilliseconds(), 759);
2129 2118
2130 // Verify we get another ConfigChanged status.
2131 ExpectConfigChanged(stream);
2132
2133 // Get the new config and verify that it matches the first one. 2119 // Get the new config and verify that it matches the first one.
2134 ASSERT_TRUE(audio_config_1.Matches(stream->audio_decoder_config())); 2120 ASSERT_TRUE(audio_config_1.Matches(stream->audio_decoder_config()));
2135 2121
2136 ExpectRead(stream, 779); 2122 ExpectRead(stream, 779);
2137 2123
2138 // Read until the end of the stream just to make sure there aren't any other 2124 // Read until the end of the stream just to make sure there aren't any other
2139 // config changes. 2125 // config changes.
2140 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp); 2126 ReadUntilNotOkOrEndOfStream(stream, &status, &last_timestamp);
2141 ASSERT_EQ(status, DemuxerStream::kOk); 2127 ASSERT_EQ(status, DemuxerStream::kOk);
2142 } 2128 }
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 2323
2338 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster()); 2324 scoped_ptr<Cluster> cluster_a(kDefaultFirstCluster());
2339 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size())); 2325 ASSERT_TRUE(AppendData(cluster_a->data(), cluster_a->size()));
2340 2326
2341 EXPECT_CALL(host_, SetDuration( 2327 EXPECT_CALL(host_, SetDuration(
2342 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp))); 2328 base::TimeDelta::FromMilliseconds(kDefaultFirstClusterEndTimestamp)));
2343 demuxer_->EndOfStream(PIPELINE_OK); 2329 demuxer_->EndOfStream(PIPELINE_OK);
2344 } 2330 }
2345 2331
2346 } // namespace media 2332 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698