OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_ptr.h" | 5 #include "base/scoped_ptr.h" |
6 #include "media/base/data_buffer.h" | 6 #include "media/base/data_buffer.h" |
7 #include "media/base/mock_ffmpeg.h" | 7 #include "media/base/mock_ffmpeg.h" |
8 #include "media/base/mock_task.h" | 8 #include "media/base/mock_task.h" |
9 #include "media/filters/ffmpeg_video_decode_engine.h" | 9 #include "media/filters/ffmpeg_video_decode_engine.h" |
10 #include "media/filters/ffmpeg_video_decoder.h" | 10 #include "media/filters/ffmpeg_video_decoder.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // Expect a bunch of avcodec calls. | 198 // Expect a bunch of avcodec calls. |
199 EXPECT_CALL(mock_ffmpeg_, AVInitPacket(_)); | 199 EXPECT_CALL(mock_ffmpeg_, AVInitPacket(_)); |
200 EXPECT_CALL(mock_ffmpeg_, | 200 EXPECT_CALL(mock_ffmpeg_, |
201 AVCodecDecodeVideo2(&codec_context_, &yuv_frame_, _, _)) | 201 AVCodecDecodeVideo2(&codec_context_, &yuv_frame_, _, _)) |
202 .WillOnce(DoAll(SetArgumentPointee<2>(1), // Simulate 1 byte frame. | 202 .WillOnce(DoAll(SetArgumentPointee<2>(1), // Simulate 1 byte frame. |
203 Return(0))); | 203 Return(0))); |
204 | 204 |
205 EXPECT_CALL(*this, OnDecodeComplete(_)) | 205 EXPECT_CALL(*this, OnDecodeComplete(_)) |
206 .WillOnce(DecodeComplete(this)); | 206 .WillOnce(DecodeComplete(this)); |
207 test_engine_->EmptyThisBuffer(buffer_); | 207 test_engine_->EmptyThisBuffer(buffer_); |
208 EXPECT_EQ(kTimestamp.InMicroseconds(), | 208 |
209 video_frame_->GetTimestamp().ToInternalValue()); | 209 // |video_frame_| timestamp is 0 because we set the timestamp based off |
| 210 // the buffer timestamp. |
| 211 EXPECT_EQ(0, video_frame_->GetTimestamp().ToInternalValue()); |
210 EXPECT_EQ(kDuration.ToInternalValue(), | 212 EXPECT_EQ(kDuration.ToInternalValue(), |
211 video_frame_->GetDuration().ToInternalValue()); | 213 video_frame_->GetDuration().ToInternalValue()); |
212 } | 214 } |
213 | 215 |
214 TEST_F(FFmpegVideoDecodeEngineTest, DecodeFrame_0ByteFrame) { | 216 TEST_F(FFmpegVideoDecodeEngineTest, DecodeFrame_0ByteFrame) { |
215 Initialize(); | 217 Initialize(); |
216 | 218 |
217 // Expect a bunch of avcodec calls. | 219 // Expect a bunch of avcodec calls. |
218 EXPECT_CALL(mock_ffmpeg_, AVInitPacket(_)); | 220 EXPECT_CALL(mock_ffmpeg_, AVInitPacket(_)); |
219 EXPECT_CALL(mock_ffmpeg_, | 221 EXPECT_CALL(mock_ffmpeg_, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 EXPECT_EQ(VideoFrame::YV16, test_engine_->GetSurfaceFormat()); | 256 EXPECT_EQ(VideoFrame::YV16, test_engine_->GetSurfaceFormat()); |
255 codec_context_.pix_fmt = PIX_FMT_YUVJ422P; | 257 codec_context_.pix_fmt = PIX_FMT_YUVJ422P; |
256 EXPECT_EQ(VideoFrame::YV16, test_engine_->GetSurfaceFormat()); | 258 EXPECT_EQ(VideoFrame::YV16, test_engine_->GetSurfaceFormat()); |
257 | 259 |
258 // Invalid value. | 260 // Invalid value. |
259 codec_context_.pix_fmt = PIX_FMT_NONE; | 261 codec_context_.pix_fmt = PIX_FMT_NONE; |
260 EXPECT_EQ(VideoFrame::INVALID, test_engine_->GetSurfaceFormat()); | 262 EXPECT_EQ(VideoFrame::INVALID, test_engine_->GetSurfaceFormat()); |
261 } | 263 } |
262 | 264 |
263 } // namespace media | 265 } // namespace media |
OLD | NEW |