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" |
11 #include "base/files/memory_mapped_file.h" | 11 #include "base/files/memory_mapped_file.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "media/base/audio_decoder_config.h" | 15 #include "media/base/audio_decoder_config.h" |
16 #include "media/base/media.h" | 16 #include "media/base/media.h" |
| 17 #include "media/base/media_util.h" |
17 #include "media/base/test_data_util.h" | 18 #include "media/base/test_data_util.h" |
18 #include "media/base/video_decoder_config.h" | 19 #include "media/base/video_decoder_config.h" |
19 #include "media/ffmpeg/ffmpeg_common.h" | 20 #include "media/ffmpeg/ffmpeg_common.h" |
20 #include "media/filters/ffmpeg_glue.h" | 21 #include "media/filters/ffmpeg_glue.h" |
21 #include "media/filters/in_memory_url_protocol.h" | 22 #include "media/filters/in_memory_url_protocol.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
23 | 24 |
24 namespace media { | 25 namespace media { |
25 | 26 |
26 class FFmpegCommonTest : public testing::Test { | 27 class FFmpegCommonTest : public testing::Test { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 context.codec_type = AVMEDIA_TYPE_AUDIO; | 128 context.codec_type = AVMEDIA_TYPE_AUDIO; |
128 context.codec_id = AV_CODEC_ID_OPUS; | 129 context.codec_id = AV_CODEC_ID_OPUS; |
129 context.channel_layout = CHANNEL_LAYOUT_STEREO; | 130 context.channel_layout = CHANNEL_LAYOUT_STEREO; |
130 context.channels = 2; | 131 context.channels = 2; |
131 context.sample_fmt = AV_SAMPLE_FMT_FLT; | 132 context.sample_fmt = AV_SAMPLE_FMT_FLT; |
132 | 133 |
133 // During conversion this sample rate should be changed to 48kHz. | 134 // During conversion this sample rate should be changed to 48kHz. |
134 context.sample_rate = 44100; | 135 context.sample_rate = 44100; |
135 | 136 |
136 AudioDecoderConfig decoder_config; | 137 AudioDecoderConfig decoder_config; |
137 ASSERT_TRUE(AVCodecContextToAudioDecoderConfig(&context, false, | 138 ASSERT_TRUE(AVCodecContextToAudioDecoderConfig(&context, Unencrypted(), |
138 &decoder_config)); | 139 &decoder_config)); |
139 EXPECT_EQ(48000, decoder_config.samples_per_second()); | 140 EXPECT_EQ(48000, decoder_config.samples_per_second()); |
140 } | 141 } |
141 | 142 |
142 TEST_F(FFmpegCommonTest, TimeBaseConversions) { | 143 TEST_F(FFmpegCommonTest, TimeBaseConversions) { |
143 const int64_t test_data[][5] = { | 144 const int64_t test_data[][5] = { |
144 {1, 2, 1, 500000, 1}, {1, 3, 1, 333333, 1}, {1, 3, 2, 666667, 2}, | 145 {1, 2, 1, 500000, 1}, {1, 3, 1, 333333, 1}, {1, 3, 2, 666667, 2}, |
145 }; | 146 }; |
146 | 147 |
147 for (size_t i = 0; i < arraysize(test_data); ++i) { | 148 for (size_t i = 0; i < arraysize(test_data); ++i) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 // values; diff should verify. | 265 // values; diff should verify. |
265 #if 0 | 266 #if 0 |
266 printf("<enum name=\"FFmpegCodecHashes\" type=\"int\">\n"); | 267 printf("<enum name=\"FFmpegCodecHashes\" type=\"int\">\n"); |
267 for (const auto& kv : sorted_hashes) | 268 for (const auto& kv : sorted_hashes) |
268 printf(" <int value=\"%d\" label=\"%s\"/>\n", kv.first, kv.second); | 269 printf(" <int value=\"%d\" label=\"%s\"/>\n", kv.first, kv.second); |
269 printf("</enum>\n"); | 270 printf("</enum>\n"); |
270 #endif | 271 #endif |
271 } | 272 } |
272 | 273 |
273 } // namespace media | 274 } // namespace media |
OLD | NEW |