OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "media/base/data_buffer.h" | 7 #include "media/base/data_buffer.h" |
8 #include "media/base/mock_task.h" | 8 #include "media/base/mock_task.h" |
9 #include "media/base/pipeline.h" | 9 #include "media/base/pipeline.h" |
10 #include "media/base/test_data_util.h" | 10 #include "media/base/test_data_util.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 VideoCodecInfo info; | 169 VideoCodecInfo info; |
170 EXPECT_CALL(*this, OnInitializeComplete(_)) | 170 EXPECT_CALL(*this, OnInitializeComplete(_)) |
171 .WillOnce(SaveArg<0>(&info)); | 171 .WillOnce(SaveArg<0>(&info)); |
172 test_engine_->Initialize(MessageLoop::current(), this, NULL, config); | 172 test_engine_->Initialize(MessageLoop::current(), this, NULL, config); |
173 EXPECT_FALSE(info.success); | 173 EXPECT_FALSE(info.success); |
174 } | 174 } |
175 | 175 |
176 TEST_F(FFmpegVideoDecodeEngineTest, DecodeFrame_Normal) { | 176 TEST_F(FFmpegVideoDecodeEngineTest, DecodeFrame_Normal) { |
177 Initialize(); | 177 Initialize(); |
178 | 178 |
179 // We rely on FFmpeg for timestamp and duration reporting. | |
180 const base::TimeDelta kTimestamp = base::TimeDelta::FromMicroseconds(0); | |
181 const base::TimeDelta kDuration = base::TimeDelta::FromMicroseconds(10000); | |
182 | |
183 // Simulate decoding a single frame. | 179 // Simulate decoding a single frame. |
184 scoped_refptr<VideoFrame> video_frame; | 180 scoped_refptr<VideoFrame> video_frame; |
185 DecodeASingleFrame(i_frame_buffer_, &video_frame); | 181 DecodeASingleFrame(i_frame_buffer_, &video_frame); |
186 | 182 |
187 // |video_frame| timestamp is 0 because we set the timestamp based off | 183 // |video_frame| timestamp is 0 because we set the timestamp based off |
188 // the buffer timestamp. | 184 // the buffer timestamp. |
189 ASSERT_TRUE(video_frame); | 185 ASSERT_TRUE(video_frame); |
190 EXPECT_EQ(0, video_frame->GetTimestamp().ToInternalValue()); | 186 EXPECT_EQ(0, video_frame->GetTimestamp().ToInternalValue()); |
191 EXPECT_EQ(kDuration.ToInternalValue(), | 187 EXPECT_EQ(10000, video_frame->GetDuration().ToInternalValue()); |
192 video_frame->GetDuration().ToInternalValue()); | |
193 } | 188 } |
194 | 189 |
195 | 190 |
196 // Verify current behavior for 0 byte frames. FFmpeg simply ignores | 191 // Verify current behavior for 0 byte frames. FFmpeg simply ignores |
197 // the 0 byte frames. | 192 // the 0 byte frames. |
198 TEST_F(FFmpegVideoDecodeEngineTest, DecodeFrame_0ByteFrame) { | 193 TEST_F(FFmpegVideoDecodeEngineTest, DecodeFrame_0ByteFrame) { |
199 Initialize(); | 194 Initialize(); |
200 | 195 |
201 scoped_refptr<DataBuffer> zero_byte_buffer = new DataBuffer(1); | 196 scoped_refptr<DataBuffer> zero_byte_buffer = new DataBuffer(1); |
202 | 197 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // DecodeIFrameThenTestFile("vp8-I-frame-320x480"); | 271 // DecodeIFrameThenTestFile("vp8-I-frame-320x480"); |
277 //} | 272 //} |
278 | 273 |
279 // Decode |i_frame_buffer_| and then a frame with a smaller height and verify | 274 // Decode |i_frame_buffer_| and then a frame with a smaller height and verify |
280 // the output size didn't change. | 275 // the output size didn't change. |
281 TEST_F(FFmpegVideoDecodeEngineTest, DecodeFrame_SmallerHeight) { | 276 TEST_F(FFmpegVideoDecodeEngineTest, DecodeFrame_SmallerHeight) { |
282 DecodeIFrameThenTestFile("vp8-I-frame-320x120"); | 277 DecodeIFrameThenTestFile("vp8-I-frame-320x120"); |
283 } | 278 } |
284 | 279 |
285 } // namespace media | 280 } // namespace media |
OLD | NEW |