| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } else { | 115 } else { |
| 116 // Only process audio/video. | 116 // Only process audio/video. |
| 117 continue; | 117 continue; |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 ASSERT_TRUE(found_audio); | 121 ASSERT_TRUE(found_audio); |
| 122 ASSERT_TRUE(found_video); | 122 ASSERT_TRUE(found_video); |
| 123 } | 123 } |
| 124 | 124 |
| 125 TEST_F(FFmpegCommonTest, OpusAudioDecoderConfig) { | |
| 126 AVCodecContext context = {0}; | |
| 127 context.codec_type = AVMEDIA_TYPE_AUDIO; | |
| 128 context.codec_id = AV_CODEC_ID_OPUS; | |
| 129 context.channel_layout = CHANNEL_LAYOUT_STEREO; | |
| 130 context.channels = 2; | |
| 131 context.sample_fmt = AV_SAMPLE_FMT_FLT; | |
| 132 | |
| 133 // During conversion this sample rate should be changed to 48kHz. | |
| 134 context.sample_rate = 44100; | |
| 135 | |
| 136 AudioDecoderConfig decoder_config; | |
| 137 ASSERT_TRUE(AVCodecContextToAudioDecoderConfig(&context, Unencrypted(), | |
| 138 &decoder_config)); | |
| 139 EXPECT_EQ(48000, decoder_config.samples_per_second()); | |
| 140 } | |
| 141 | |
| 142 TEST_F(FFmpegCommonTest, TimeBaseConversions) { | 125 TEST_F(FFmpegCommonTest, TimeBaseConversions) { |
| 143 const int64_t test_data[][5] = { | 126 const int64_t test_data[][5] = { |
| 144 {1, 2, 1, 500000, 1}, {1, 3, 1, 333333, 1}, {1, 3, 2, 666667, 2}, | 127 {1, 2, 1, 500000, 1}, {1, 3, 1, 333333, 1}, {1, 3, 2, 666667, 2}, |
| 145 }; | 128 }; |
| 146 | 129 |
| 147 for (size_t i = 0; i < arraysize(test_data); ++i) { | 130 for (size_t i = 0; i < arraysize(test_data); ++i) { |
| 148 SCOPED_TRACE(i); | 131 SCOPED_TRACE(i); |
| 149 | 132 |
| 150 AVRational time_base; | 133 AVRational time_base; |
| 151 time_base.num = static_cast<int>(test_data[i][0]); | 134 time_base.num = static_cast<int>(test_data[i][0]); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // values; diff should verify. | 247 // values; diff should verify. |
| 265 #if 0 | 248 #if 0 |
| 266 printf("<enum name=\"FFmpegCodecHashes\" type=\"int\">\n"); | 249 printf("<enum name=\"FFmpegCodecHashes\" type=\"int\">\n"); |
| 267 for (const auto& kv : sorted_hashes) | 250 for (const auto& kv : sorted_hashes) |
| 268 printf(" <int value=\"%d\" label=\"%s\"/>\n", kv.first, kv.second); | 251 printf(" <int value=\"%d\" label=\"%s\"/>\n", kv.first, kv.second); |
| 269 printf("</enum>\n"); | 252 printf("</enum>\n"); |
| 270 #endif | 253 #endif |
| 271 } | 254 } |
| 272 | 255 |
| 273 } // namespace media | 256 } // namespace media |
| OLD | NEW |