| 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, AVStreamToAudioDecoderConfig_OpusAmbisonics) { |
| 129 base::MemoryMappedFile file; |
| 130 // TODO (flim): Upload this ogg file |
| 131 file.Initialize(GetTestDataFilePath("4ch-opus-channel-mapping-2.ogg")); |
| 132 InMemoryUrlProtocol protocol(file.data(), file.length(), false); |
| 133 FFmpegGlue glue(&protocol); |
| 134 ASSERT_TRUE(glue.OpenContext()); |
| 135 |
| 136 AVFormatContext* format_context = glue.format_context(); |
| 137 EXPECT_EQ(static_cast<unsigned int>(1), format_context->nb_streams); |
| 138 AVStream* stream = format_context->streams[0]; |
| 139 |
| 140 AVCodecParameters* codec_parameters = stream->codecpar; |
| 141 EXPECT_EQ(AVMEDIA_TYPE_AUDIO, codec_parameters->codec_type); |
| 142 |
| 143 AudioDecoderConfig audio_config; |
| 144 ASSERT_TRUE(AVStreamToAudioDecoderConfig(stream, &audio_config)); |
| 145 |
| 146 EXPECT_EQ(kCodecOpus, audio_config.codec()); |
| 147 EXPECT_EQ(CHANNEL_LAYOUT_DISCRETE, audio_config.channel_layout()); |
| 148 EXPECT_EQ(4, audio_config.channels()); |
| 149 } |
| 150 |
| 128 TEST_F(FFmpegCommonTest, TimeBaseConversions) { | 151 TEST_F(FFmpegCommonTest, TimeBaseConversions) { |
| 129 const int64_t test_data[][5] = { | 152 const int64_t test_data[][5] = { |
| 130 {1, 2, 1, 500000, 1}, {1, 3, 1, 333333, 1}, {1, 3, 2, 666667, 2}, | 153 {1, 2, 1, 500000, 1}, {1, 3, 1, 333333, 1}, {1, 3, 2, 666667, 2}, |
| 131 }; | 154 }; |
| 132 | 155 |
| 133 for (size_t i = 0; i < arraysize(test_data); ++i) { | 156 for (size_t i = 0; i < arraysize(test_data); ++i) { |
| 134 SCOPED_TRACE(i); | 157 SCOPED_TRACE(i); |
| 135 | 158 |
| 136 AVRational time_base; | 159 AVRational time_base; |
| 137 time_base.num = static_cast<int>(test_data[i][0]); | 160 time_base.num = static_cast<int>(test_data[i][0]); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // values; diff should verify. | 220 // values; diff should verify. |
| 198 #if 0 | 221 #if 0 |
| 199 printf("<enum name=\"FFmpegCodecHashes\" type=\"int\">\n"); | 222 printf("<enum name=\"FFmpegCodecHashes\" type=\"int\">\n"); |
| 200 for (const auto& kv : sorted_hashes) | 223 for (const auto& kv : sorted_hashes) |
| 201 printf(" <int value=\"%d\" label=\"%s\"/>\n", kv.first, kv.second); | 224 printf(" <int value=\"%d\" label=\"%s\"/>\n", kv.first, kv.second); |
| 202 printf("</enum>\n"); | 225 printf("</enum>\n"); |
| 203 #endif | 226 #endif |
| 204 } | 227 } |
| 205 | 228 |
| 206 } // namespace media | 229 } // namespace media |
| OLD | NEW |