| 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" | |
| 39 #include "media/base/video_decoder_config.h" | 38 #include "media/base/video_decoder_config.h" |
| 40 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 41 | 40 |
| 42 namespace chromecast { | 41 namespace chromecast { |
| 43 namespace media { | 42 namespace media { |
| 44 | 43 |
| 45 class AudioVideoPipelineDeviceTest; | 44 class AudioVideoPipelineDeviceTest; |
| 46 | 45 |
| 47 namespace { | 46 namespace { |
| 48 | 47 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 62 default_config.bytes_per_channel = 2; | 61 default_config.bytes_per_channel = 2; |
| 63 default_config.samples_per_second = 48000; | 62 default_config.samples_per_second = 48000; |
| 64 return default_config; | 63 return default_config; |
| 65 } | 64 } |
| 66 | 65 |
| 67 VideoConfig DefaultVideoConfig() { | 66 VideoConfig DefaultVideoConfig() { |
| 68 VideoConfig default_config; | 67 VideoConfig default_config; |
| 69 default_config.codec = kCodecH264; | 68 default_config.codec = kCodecH264; |
| 70 default_config.profile = kH264Main; | 69 default_config.profile = kH264Main; |
| 71 default_config.additional_config = nullptr; | 70 default_config.additional_config = nullptr; |
| 72 default_config.encryption_scheme = Unencrypted(); | 71 default_config.is_encrypted = false; |
| 73 return default_config; | 72 return default_config; |
| 74 } | 73 } |
| 75 | 74 |
| 76 base::FilePath GetTestDataFilePath(const std::string& name) { | 75 base::FilePath GetTestDataFilePath(const std::string& name) { |
| 77 base::FilePath file_path; | 76 base::FilePath file_path; |
| 78 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); | 77 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); |
| 79 | 78 |
| 80 file_path = file_path.Append(FILE_PATH_LITERAL("media")) | 79 file_path = file_path.Append(FILE_PATH_LITERAL("media")) |
| 81 .Append(FILE_PATH_LITERAL("test")).Append(FILE_PATH_LITERAL("data")) | 80 .Append(FILE_PATH_LITERAL("test")).Append(FILE_PATH_LITERAL("data")) |
| 82 .AppendASCII(name); | 81 .AppendASCII(name); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 base::FilePath file_path = GetTestDataFilePath(filename); | 557 base::FilePath file_path = GetTestDataFilePath(filename); |
| 559 base::MemoryMappedFile video_stream; | 558 base::MemoryMappedFile video_stream; |
| 560 CHECK(video_stream.Initialize(file_path)) << "Couldn't open stream file: " | 559 CHECK(video_stream.Initialize(file_path)) << "Couldn't open stream file: " |
| 561 << file_path.MaybeAsASCII(); | 560 << file_path.MaybeAsASCII(); |
| 562 buffers = H264SegmenterForTest(video_stream.data(), video_stream.length()); | 561 buffers = H264SegmenterForTest(video_stream.data(), video_stream.length()); |
| 563 | 562 |
| 564 // TODO(erickung): Either pull data from stream or make caller specify value | 563 // TODO(erickung): Either pull data from stream or make caller specify value |
| 565 video_config.codec = kCodecH264; | 564 video_config.codec = kCodecH264; |
| 566 video_config.profile = kH264Main; | 565 video_config.profile = kH264Main; |
| 567 video_config.additional_config = nullptr; | 566 video_config.additional_config = nullptr; |
| 568 video_config.encryption_scheme = Unencrypted(); | 567 video_config.is_encrypted = false; |
| 569 } else { | 568 } else { |
| 570 base::FilePath file_path = GetTestDataFilePath(filename); | 569 base::FilePath file_path = GetTestDataFilePath(filename); |
| 571 DemuxResult demux_result = FFmpegDemuxForTest(file_path, false /* audio */); | 570 DemuxResult demux_result = FFmpegDemuxForTest(file_path, false /* audio */); |
| 572 buffers = demux_result.frames; | 571 buffers = demux_result.frames; |
| 573 video_config = DecoderConfigAdapter::ToCastVideoConfig( | 572 video_config = DecoderConfigAdapter::ToCastVideoConfig( |
| 574 kPrimary, demux_result.video_config); | 573 kPrimary, demux_result.video_config); |
| 575 } | 574 } |
| 576 | 575 |
| 577 MediaPipelineBackend::VideoDecoder* decoder = backend->CreateVideoDecoder(); | 576 MediaPipelineBackend::VideoDecoder* decoder = backend->CreateVideoDecoder(); |
| 578 CHECK(decoder); | 577 CHECK(decoder); |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 set_sync_type(MediaPipelineDeviceParams::kModeIgnorePtsAndVSync); | 1160 set_sync_type(MediaPipelineDeviceParams::kModeIgnorePtsAndVSync); |
| 1162 ConfigureForFile("bear-640x360.webm"); | 1161 ConfigureForFile("bear-640x360.webm"); |
| 1163 PauseBeforeEos(); | 1162 PauseBeforeEos(); |
| 1164 AddEffectsStreams(); | 1163 AddEffectsStreams(); |
| 1165 Start(); | 1164 Start(); |
| 1166 message_loop->Run(); | 1165 message_loop->Run(); |
| 1167 } | 1166 } |
| 1168 | 1167 |
| 1169 } // namespace media | 1168 } // namespace media |
| 1170 } // namespace chromecast | 1169 } // namespace chromecast |
| OLD | NEW |