OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <cstring> | 8 #include <cstring> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } else { | 118 } else { |
119 // Only process audio/video. | 119 // Only process audio/video. |
120 continue; | 120 continue; |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 ASSERT_TRUE(found_audio); | 124 ASSERT_TRUE(found_audio); |
125 ASSERT_TRUE(found_video); | 125 ASSERT_TRUE(found_video); |
126 } | 126 } |
127 | 127 |
128 TEST_F(FFmpegCommonTest, OpusAudioDecoderConfig) { | |
129 AVCodecContext context = {0}; | |
130 context.codec_type = AVMEDIA_TYPE_AUDIO; | |
131 context.codec_id = AV_CODEC_ID_OPUS; | |
132 context.channel_layout = CHANNEL_LAYOUT_STEREO; | |
133 context.channels = 2; | |
134 context.sample_fmt = AV_SAMPLE_FMT_FLT; | |
135 | |
136 // During conversion this sample rate should be changed to 48kHz. | |
137 context.sample_rate = 44100; | |
138 | |
139 AudioDecoderConfig decoder_config; | |
140 ASSERT_TRUE(AVCodecContextToAudioDecoderConfig(&context, Unencrypted(), | |
141 &decoder_config)); | |
142 EXPECT_EQ(48000, decoder_config.samples_per_second()); | |
143 } | |
144 | |
145 TEST_F(FFmpegCommonTest, TimeBaseConversions) { | 128 TEST_F(FFmpegCommonTest, TimeBaseConversions) { |
146 const int64_t test_data[][5] = { | 129 const int64_t test_data[][5] = { |
147 {1, 2, 1, 500000, 1}, {1, 3, 1, 333333, 1}, {1, 3, 2, 666667, 2}, | 130 {1, 2, 1, 500000, 1}, {1, 3, 1, 333333, 1}, {1, 3, 2, 666667, 2}, |
148 }; | 131 }; |
149 | 132 |
150 for (size_t i = 0; i < arraysize(test_data); ++i) { | 133 for (size_t i = 0; i < arraysize(test_data); ++i) { |
151 SCOPED_TRACE(i); | 134 SCOPED_TRACE(i); |
152 | 135 |
153 AVRational time_base; | 136 AVRational time_base; |
154 time_base.num = static_cast<int>(test_data[i][0]); | 137 time_base.num = static_cast<int>(test_data[i][0]); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // values; diff should verify. | 197 // values; diff should verify. |
215 #if 0 | 198 #if 0 |
216 printf("<enum name=\"FFmpegCodecHashes\" type=\"int\">\n"); | 199 printf("<enum name=\"FFmpegCodecHashes\" type=\"int\">\n"); |
217 for (const auto& kv : sorted_hashes) | 200 for (const auto& kv : sorted_hashes) |
218 printf(" <int value=\"%d\" label=\"%s\"/>\n", kv.first, kv.second); | 201 printf(" <int value=\"%d\" label=\"%s\"/>\n", kv.first, kv.second); |
219 printf("</enum>\n"); | 202 printf("</enum>\n"); |
220 #endif | 203 #endif |
221 } | 204 } |
222 | 205 |
223 } // namespace media | 206 } // namespace media |
OLD | NEW |