| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chromecast/media/cma/base/decoder_config_adapter.h" | 28 #include "chromecast/media/cma/base/decoder_config_adapter.h" |
| 29 #include "chromecast/media/cma/test/frame_segmenter_for_test.h" | 29 #include "chromecast/media/cma/test/frame_segmenter_for_test.h" |
| 30 #include "chromecast/public/cast_media_shlib.h" | 30 #include "chromecast/public/cast_media_shlib.h" |
| 31 #include "chromecast/public/media/cast_decoder_buffer.h" | 31 #include "chromecast/public/media/cast_decoder_buffer.h" |
| 32 #include "chromecast/public/media/decoder_config.h" | 32 #include "chromecast/public/media/decoder_config.h" |
| 33 #include "chromecast/public/media/media_pipeline_backend.h" | 33 #include "chromecast/public/media/media_pipeline_backend.h" |
| 34 #include "chromecast/public/media/media_pipeline_device_params.h" | 34 #include "chromecast/public/media/media_pipeline_device_params.h" |
| 35 #include "media/base/audio_decoder_config.h" | 35 #include "media/base/audio_decoder_config.h" |
| 36 #include "media/base/audio_timestamp_helper.h" | 36 #include "media/base/audio_timestamp_helper.h" |
| 37 #include "media/base/decoder_buffer.h" | 37 #include "media/base/decoder_buffer.h" |
| 38 #include "media/base/encryption_scheme.h" |
| 38 #include "media/base/video_decoder_config.h" | 39 #include "media/base/video_decoder_config.h" |
| 39 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
| 40 | 41 |
| 41 namespace chromecast { | 42 namespace chromecast { |
| 42 namespace media { | 43 namespace media { |
| 43 | 44 |
| 44 class AudioVideoPipelineDeviceTest; | 45 class AudioVideoPipelineDeviceTest; |
| 45 | 46 |
| 46 namespace { | 47 namespace { |
| 47 | 48 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 default_config.bytes_per_channel = 2; | 62 default_config.bytes_per_channel = 2; |
| 62 default_config.samples_per_second = 48000; | 63 default_config.samples_per_second = 48000; |
| 63 return default_config; | 64 return default_config; |
| 64 } | 65 } |
| 65 | 66 |
| 66 VideoConfig DefaultVideoConfig() { | 67 VideoConfig DefaultVideoConfig() { |
| 67 VideoConfig default_config; | 68 VideoConfig default_config; |
| 68 default_config.codec = kCodecH264; | 69 default_config.codec = kCodecH264; |
| 69 default_config.profile = kH264Main; | 70 default_config.profile = kH264Main; |
| 70 default_config.additional_config = nullptr; | 71 default_config.additional_config = nullptr; |
| 71 default_config.is_encrypted = false; | 72 default_config.encryption_scheme = EncryptionScheme::unencrypted(); |
| 72 return default_config; | 73 return default_config; |
| 73 } | 74 } |
| 74 | 75 |
| 75 base::FilePath GetTestDataFilePath(const std::string& name) { | 76 base::FilePath GetTestDataFilePath(const std::string& name) { |
| 76 base::FilePath file_path; | 77 base::FilePath file_path; |
| 77 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); | 78 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); |
| 78 | 79 |
| 79 file_path = file_path.Append(FILE_PATH_LITERAL("media")) | 80 file_path = file_path.Append(FILE_PATH_LITERAL("media")) |
| 80 .Append(FILE_PATH_LITERAL("test")).Append(FILE_PATH_LITERAL("data")) | 81 .Append(FILE_PATH_LITERAL("test")).Append(FILE_PATH_LITERAL("data")) |
| 81 .AppendASCII(name); | 82 .AppendASCII(name); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 base::FilePath file_path = GetTestDataFilePath(filename); | 558 base::FilePath file_path = GetTestDataFilePath(filename); |
| 558 base::MemoryMappedFile video_stream; | 559 base::MemoryMappedFile video_stream; |
| 559 CHECK(video_stream.Initialize(file_path)) << "Couldn't open stream file: " | 560 CHECK(video_stream.Initialize(file_path)) << "Couldn't open stream file: " |
| 560 << file_path.MaybeAsASCII(); | 561 << file_path.MaybeAsASCII(); |
| 561 buffers = H264SegmenterForTest(video_stream.data(), video_stream.length()); | 562 buffers = H264SegmenterForTest(video_stream.data(), video_stream.length()); |
| 562 | 563 |
| 563 // TODO(erickung): Either pull data from stream or make caller specify value | 564 // TODO(erickung): Either pull data from stream or make caller specify value |
| 564 video_config.codec = kCodecH264; | 565 video_config.codec = kCodecH264; |
| 565 video_config.profile = kH264Main; | 566 video_config.profile = kH264Main; |
| 566 video_config.additional_config = nullptr; | 567 video_config.additional_config = nullptr; |
| 567 video_config.is_encrypted = false; | 568 video_config.encryption_scheme = EncryptionScheme::unencrypted(); |
| 568 } else { | 569 } else { |
| 569 base::FilePath file_path = GetTestDataFilePath(filename); | 570 base::FilePath file_path = GetTestDataFilePath(filename); |
| 570 DemuxResult demux_result = FFmpegDemuxForTest(file_path, false /* audio */); | 571 DemuxResult demux_result = FFmpegDemuxForTest(file_path, false /* audio */); |
| 571 buffers = demux_result.frames; | 572 buffers = demux_result.frames; |
| 572 video_config = DecoderConfigAdapter::ToCastVideoConfig( | 573 video_config = DecoderConfigAdapter::ToCastVideoConfig( |
| 573 kPrimary, demux_result.video_config); | 574 kPrimary, demux_result.video_config); |
| 574 } | 575 } |
| 575 | 576 |
| 576 MediaPipelineBackend::VideoDecoder* decoder = backend->CreateVideoDecoder(); | 577 MediaPipelineBackend::VideoDecoder* decoder = backend->CreateVideoDecoder(); |
| 577 CHECK(decoder); | 578 CHECK(decoder); |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 set_sync_type(MediaPipelineDeviceParams::kModeIgnorePtsAndVSync); | 1151 set_sync_type(MediaPipelineDeviceParams::kModeIgnorePtsAndVSync); |
| 1151 ConfigureForFile("bear-640x360.webm"); | 1152 ConfigureForFile("bear-640x360.webm"); |
| 1152 PauseBeforeEos(); | 1153 PauseBeforeEos(); |
| 1153 AddEffectsStreams(); | 1154 AddEffectsStreams(); |
| 1154 Start(); | 1155 Start(); |
| 1155 message_loop->Run(); | 1156 message_loop->Run(); |
| 1156 } | 1157 } |
| 1157 | 1158 |
| 1158 } // namespace media | 1159 } // namespace media |
| 1159 } // namespace chromecast | 1160 } // namespace chromecast |
| OLD | NEW |