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( | 27 return VideoDecoderConfig(kCodecH264, H264PROFILE_MAIN, VideoFrame::I420, |
28 kCodecH264, | 28 VideoFrame::COLOR_SPACE_UNSPECIFIED, coded_size, |
29 H264PROFILE_MAIN, | 29 visible_rect, natural_size, NULL, 0, false); |
30 VideoFrame::I420, | |
31 coded_size, | |
32 visible_rect, | |
33 natural_size, | |
34 NULL, 0, false); | |
35 } | 30 } |
36 | 31 |
37 StreamParserBuffer::BufferQueue | 32 StreamParserBuffer::BufferQueue |
38 GenerateFakeBuffers(const int* frame_pts_ms, | 33 GenerateFakeBuffers(const int* frame_pts_ms, |
39 const bool* is_key_frame, | 34 const bool* is_key_frame, |
40 size_t frame_count) { | 35 size_t frame_count) { |
41 uint8 dummy_buffer[] = {0, 0, 0, 0}; | 36 uint8 dummy_buffer[] = {0, 0, 0, 0}; |
42 | 37 |
43 StreamParserBuffer::BufferQueue buffers(frame_count); | 38 StreamParserBuffer::BufferQueue buffers(frame_count); |
44 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... |
162 bool is_key_frame[] = {false, false, false, true, false, false}; | 157 bool is_key_frame[] = {false, false, false, true, false, false}; |
163 StreamParserBuffer::BufferQueue buffer_queue = | 158 StreamParserBuffer::BufferQueue buffer_queue = |
164 GenerateFakeBuffers(pts_ms, is_key_frame, arraysize(pts_ms)); | 159 GenerateFakeBuffers(pts_ms, is_key_frame, arraysize(pts_ms)); |
165 | 160 |
166 EXPECT_EQ("(70,Y) (30,Y) (30,N) (30,N)", | 161 EXPECT_EQ("(70,Y) (30,Y) (30,N) (30,N)", |
167 RunAdapterTest(buffer_queue)); | 162 RunAdapterTest(buffer_queue)); |
168 } | 163 } |
169 | 164 |
170 } // namespace mp2t | 165 } // namespace mp2t |
171 } // namespace media | 166 } // namespace media |
OLD | NEW |