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
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_
6 #define MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_
8 #include "media/video/video_encode_accelerator.h"
12 #include "base/memory/weak_ptr.h"
13 #include "media/base/bitstream_buffer.h"
16 class SingleThreadTaskRunner
;
23 class FakeVideoEncodeAccelerator
: public VideoEncodeAccelerator
{
25 explicit FakeVideoEncodeAccelerator(
26 const scoped_refptr
<base::SingleThreadTaskRunner
>& task_runner
);
27 virtual ~FakeVideoEncodeAccelerator();
29 virtual bool Initialize(media::VideoFrame::Format input_format
,
30 const gfx::Size
& input_visible_size
,
31 VideoCodecProfile output_profile
,
32 uint32 initial_bitrate
,
33 Client
* client
) OVERRIDE
;
35 virtual void Encode(const scoped_refptr
<VideoFrame
>& frame
,
36 bool force_keyframe
) OVERRIDE
;
38 virtual void UseOutputBitstreamBuffer(const BitstreamBuffer
& buffer
) OVERRIDE
;
40 virtual void RequestEncodingParametersChange(uint32 bitrate
,
41 uint32 framerate
) OVERRIDE
;
43 virtual void Destroy() OVERRIDE
;
45 void SendDummyFrameForTesting(bool key_frame
);
48 void DoRequireBitstreamBuffers(unsigned int input_count
,
49 const gfx::Size
& input_coded_size
,
50 size_t output_buffer_size
) const;
51 void DoBitstreamBufferReady(int32 bitstream_buffer_id
,
53 bool key_frame
) const;
55 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner_
;
57 VideoEncodeAccelerator::Client
* client_
;
60 std::list
<int32
> available_buffer_ids_
;
62 base::WeakPtrFactory
<FakeVideoEncodeAccelerator
> weak_this_factory_
;
64 DISALLOW_COPY_AND_ASSIGN(FakeVideoEncodeAccelerator
);
71 #endif // MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_