| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 static const gfx::Rect kVisibleRect(320, 240); | 39 static const gfx::Rect kVisibleRect(320, 240); |
| 40 static const gfx::Size kNaturalSize(320, 240); | 40 static const gfx::Size kNaturalSize(320, 240); |
| 41 | 41 |
| 42 ACTION_P(ReturnBuffer, buffer) { | 42 ACTION_P(ReturnBuffer, buffer) { |
| 43 arg0.Run(buffer.get() ? DemuxerStream::kOk : DemuxerStream::kAborted, buffer); | 43 arg0.Run(buffer.get() ? DemuxerStream::kOk : DemuxerStream::kAborted, buffer); |
| 44 } | 44 } |
| 45 | 45 |
| 46 class FFmpegVideoDecoderTest : public testing::Test { | 46 class FFmpegVideoDecoderTest : public testing::Test { |
| 47 public: | 47 public: |
| 48 FFmpegVideoDecoderTest() | 48 FFmpegVideoDecoderTest() |
| 49 : decoder_(new FFmpegVideoDecoder(message_loop_.message_loop_proxy())), | 49 : decoder_(new FFmpegVideoDecoder(message_loop_.message_loop_proxy(), |
| 50 FFmpegVideoDecoder::THREADING_FRAME)), |
| 50 decode_cb_(base::Bind(&FFmpegVideoDecoderTest::FrameReady, | 51 decode_cb_(base::Bind(&FFmpegVideoDecoderTest::FrameReady, |
| 51 base::Unretained(this))) { | 52 base::Unretained(this))) { |
| 52 FFmpegGlue::InitializeFFmpeg(); | 53 FFmpegGlue::InitializeFFmpeg(); |
| 53 | 54 |
| 54 // Initialize various test buffers. | 55 // Initialize various test buffers. |
| 55 frame_buffer_.reset(new uint8[kCodedSize.GetArea()]); | 56 frame_buffer_.reset(new uint8[kCodedSize.GetArea()]); |
| 56 end_of_stream_buffer_ = DecoderBuffer::CreateEOSBuffer(); | 57 end_of_stream_buffer_ = DecoderBuffer::CreateEOSBuffer(); |
| 57 i_frame_buffer_ = ReadTestDataFile("vp8-I-frame-320x240"); | 58 i_frame_buffer_ = ReadTestDataFile("vp8-I-frame-320x240"); |
| 58 corrupt_i_frame_buffer_ = ReadTestDataFile("vp8-corrupt-I-frame"); | 59 corrupt_i_frame_buffer_ = ReadTestDataFile("vp8-corrupt-I-frame"); |
| 59 } | 60 } |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 488 |
| 488 // Test stopping when decoder has hit end of stream. | 489 // Test stopping when decoder has hit end of stream. |
| 489 TEST_F(FFmpegVideoDecoderTest, Stop_EndOfStream) { | 490 TEST_F(FFmpegVideoDecoderTest, Stop_EndOfStream) { |
| 490 Initialize(); | 491 Initialize(); |
| 491 EnterDecodingState(); | 492 EnterDecodingState(); |
| 492 EnterEndOfStreamState(); | 493 EnterEndOfStreamState(); |
| 493 Stop(); | 494 Stop(); |
| 494 } | 495 } |
| 495 | 496 |
| 496 } // namespace media | 497 } // namespace media |
| OLD | NEW |