| 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 <sstream> | 5 #include <sstream> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "media/base/stream_parser_buffer.h" | 13 #include "media/base/stream_parser_buffer.h" |
| 14 #include "media/base/video_decoder_config.h" | 14 #include "media/base/video_decoder_config.h" |
| 15 #include "media/formats/mp2t/es_adapter_video.h" | 15 #include "media/formats/mp2t/es_adapter_video.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace media { | 18 namespace media { |
| 19 namespace mp2t { | 19 namespace mp2t { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 VideoDecoderConfig CreateFakeVideoConfig() { | 23 VideoDecoderConfig CreateFakeVideoConfig() { |
| 24 gfx::Size coded_size(320, 240); | 24 gfx::Size coded_size(320, 240); |
| 25 gfx::Rect visible_rect(0, 0, 320, 240); | 25 gfx::Rect visible_rect(0, 0, 320, 240); |
| 26 gfx::Size natural_size(320, 240); | 26 gfx::Size natural_size(320, 240); |
| 27 return VideoDecoderConfig(kCodecH264, H264PROFILE_MAIN, PIXEL_FORMAT_I420, | 27 return VideoDecoderConfig(kCodecH264, H264PROFILE_MAIN, PIXEL_FORMAT_I420, |
| 28 coded_size, visible_rect, natural_size, NULL, 0, | 28 COLOR_SPACE_UNSPECIFIED, coded_size, visible_rect, |
| 29 false); | 29 natural_size, NULL, 0, false); |
| 30 } | 30 } |
| 31 | 31 |
| 32 StreamParserBuffer::BufferQueue | 32 StreamParserBuffer::BufferQueue |
| 33 GenerateFakeBuffers(const int* frame_pts_ms, | 33 GenerateFakeBuffers(const int* frame_pts_ms, |
| 34 const bool* is_key_frame, | 34 const bool* is_key_frame, |
| 35 size_t frame_count) { | 35 size_t frame_count) { |
| 36 uint8 dummy_buffer[] = {0, 0, 0, 0}; | 36 uint8 dummy_buffer[] = {0, 0, 0, 0}; |
| 37 | 37 |
| 38 StreamParserBuffer::BufferQueue buffers(frame_count); | 38 StreamParserBuffer::BufferQueue buffers(frame_count); |
| 39 for (size_t k = 0; k < frame_count; k++) { | 39 for (size_t k = 0; k < frame_count; k++) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 bool is_key_frame[] = {false, false, false, true, false, false}; | 157 bool is_key_frame[] = {false, false, false, true, false, false}; |
| 158 StreamParserBuffer::BufferQueue buffer_queue = | 158 StreamParserBuffer::BufferQueue buffer_queue = |
| 159 GenerateFakeBuffers(pts_ms, is_key_frame, arraysize(pts_ms)); | 159 GenerateFakeBuffers(pts_ms, is_key_frame, arraysize(pts_ms)); |
| 160 | 160 |
| 161 EXPECT_EQ("(70,Y) (30,Y) (30,N) (30,N)", | 161 EXPECT_EQ("(70,Y) (30,Y) (30,N) (30,N)", |
| 162 RunAdapterTest(buffer_queue)); | 162 RunAdapterTest(buffer_queue)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace mp2t | 165 } // namespace mp2t |
| 166 } // namespace media | 166 } // namespace media |
| OLD | NEW |