| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 virtual ~FFmpegTest() { | 99 virtual ~FFmpegTest() { |
| 100 } | 100 } |
| 101 | 101 |
| 102 void OpenAndReadFile(const std::string& name) { | 102 void OpenAndReadFile(const std::string& name) { |
| 103 OpenFile(name); | 103 OpenFile(name); |
| 104 OpenCodecs(); | 104 OpenCodecs(); |
| 105 ReadRemainingFile(); | 105 ReadRemainingFile(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void OpenFile(const std::string& name) { | 108 void OpenFile(const std::string& name) { |
| 109 FilePath path; | 109 base::FilePath path; |
| 110 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 110 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 111 path = path.AppendASCII("media") | 111 path = path.AppendASCII("media") |
| 112 .AppendASCII("test") | 112 .AppendASCII("test") |
| 113 .AppendASCII("data") | 113 .AppendASCII("data") |
| 114 .AppendASCII("content") | 114 .AppendASCII("content") |
| 115 .AppendASCII(name.c_str()); | 115 .AppendASCII(name.c_str()); |
| 116 EXPECT_TRUE(file_util::PathExists(path)); | 116 EXPECT_TRUE(file_util::PathExists(path)); |
| 117 | 117 |
| 118 CHECK(file_data_.Initialize(path)); | 118 CHECK(file_data_.Initialize(path)); |
| 119 protocol_.reset(new InMemoryUrlProtocol( | 119 protocol_.reset(new InMemoryUrlProtocol( |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 return av_video_stream()->codec; | 362 return av_video_stream()->codec; |
| 363 } | 363 } |
| 364 | 364 |
| 365 private: | 365 private: |
| 366 void InitializeFFmpeg() { | 366 void InitializeFFmpeg() { |
| 367 static bool initialized = false; | 367 static bool initialized = false; |
| 368 if (initialized) { | 368 if (initialized) { |
| 369 return; | 369 return; |
| 370 } | 370 } |
| 371 | 371 |
| 372 FilePath path; | 372 base::FilePath path; |
| 373 PathService::Get(base::DIR_MODULE, &path); | 373 PathService::Get(base::DIR_MODULE, &path); |
| 374 EXPECT_TRUE(InitializeMediaLibrary(path)) | 374 EXPECT_TRUE(InitializeMediaLibrary(path)) |
| 375 << "Could not initialize media library."; | 375 << "Could not initialize media library."; |
| 376 | 376 |
| 377 initialized = true; | 377 initialized = true; |
| 378 } | 378 } |
| 379 | 379 |
| 380 AVFormatContext* av_format_context_; | 380 AVFormatContext* av_format_context_; |
| 381 int audio_stream_index_; | 381 int audio_stream_index_; |
| 382 int video_stream_index_; | 382 int video_stream_index_; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 EXPECT_TRUE(StepDecodeVideo()); | 581 EXPECT_TRUE(StepDecodeVideo()); |
| 582 VLOG(1) << decoded_video_time(); | 582 VLOG(1) << decoded_video_time(); |
| 583 | 583 |
| 584 SeekTo(0.4); | 584 SeekTo(0.4); |
| 585 ReadRemainingFile(); | 585 ReadRemainingFile(); |
| 586 EXPECT_TRUE(StepDecodeVideo()); | 586 EXPECT_TRUE(StepDecodeVideo()); |
| 587 VLOG(1) << decoded_video_time(); | 587 VLOG(1) << decoded_video_time(); |
| 588 } | 588 } |
| 589 | 589 |
| 590 } // namespace media | 590 } // namespace media |
| OLD | NEW |