| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // ffmpeg_unittests verify that the parts of the FFmpeg API that Chromium uses | 5 // ffmpeg_unittests verify that the parts of the FFmpeg API that Chromium uses |
| 6 // function as advertised for each media format that Chromium supports. This | 6 // function as advertised for each media format that Chromium supports. This |
| 7 // mostly includes stuff like reporting proper timestamps, seeking to | 7 // mostly includes stuff like reporting proper timestamps, seeking to |
| 8 // keyframes, and supporting certain features like reordered_opaque. | 8 // keyframes, and supporting certain features like reordered_opaque. |
| 9 // | 9 // |
| 10 // Known failures as of r54591: | 10 // Known failures as of r54591: |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 | 266 |
| 267 EXPECT_GE(result, 0) << "Audio decode error."; | 267 EXPECT_GE(result, 0) << "Audio decode error."; |
| 268 if (result < 0 || (size_out == 0 && end_of_stream)) { | 268 if (result < 0 || (size_out == 0 && end_of_stream)) { |
| 269 return false; | 269 return false; |
| 270 } | 270 } |
| 271 | 271 |
| 272 if (result > 0) { | 272 if (result > 0) { |
| 273 // TODO(scherkus): move this to ffmpeg_util.h and dedup. | 273 // TODO(scherkus): move this to ffmpeg_util.h and dedup. |
| 274 int64 denominator = av_audio_context()->channels * | 274 int64 denominator = av_audio_context()->channels * |
| 275 av_get_bits_per_sample_format(av_audio_context()->sample_fmt) / 8 * | 275 av_get_bits_per_sample_fmt(av_audio_context()->sample_fmt) / 8 * |
| 276 av_audio_context()->sample_rate; | 276 av_audio_context()->sample_rate; |
| 277 double microseconds = size_out / | 277 double microseconds = size_out / |
| 278 (denominator / | 278 (denominator / |
| 279 static_cast<double>(base::Time::kMicrosecondsPerSecond)); | 279 static_cast<double>(base::Time::kMicrosecondsPerSecond)); |
| 280 decoded_audio_duration_ = static_cast<int64>(microseconds); | 280 decoded_audio_duration_ = static_cast<int64>(microseconds); |
| 281 | 281 |
| 282 if (packet.pts == static_cast<int64>(AV_NOPTS_VALUE)) { | 282 if (packet.pts == static_cast<int64>(AV_NOPTS_VALUE)) { |
| 283 EXPECT_NE(decoded_audio_time_, static_cast<int64>(AV_NOPTS_VALUE)) | 283 EXPECT_NE(decoded_audio_time_, static_cast<int64>(AV_NOPTS_VALUE)) |
| 284 << "We never received an initial timestamped audio packet! " | 284 << "We never received an initial timestamped audio packet! " |
| 285 << "Looks like there's a seeking/parsing bug in FFmpeg."; | 285 << "Looks like there's a seeking/parsing bug in FFmpeg."; |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 SeekTo(0.4); | 647 SeekTo(0.4); |
| 648 ReadRemainingFile(); | 648 ReadRemainingFile(); |
| 649 EXPECT_TRUE(StepDecodeVideo()); | 649 EXPECT_TRUE(StepDecodeVideo()); |
| 650 VLOG(1) << decoded_video_time(); | 650 VLOG(1) << decoded_video_time(); |
| 651 | 651 |
| 652 CloseCodecs(); | 652 CloseCodecs(); |
| 653 CloseFile(); | 653 CloseFile(); |
| 654 } | 654 } |
| 655 | 655 |
| 656 } // namespace media | 656 } // namespace media |
| OLD | NEW |