Chromium Code Reviews| Index: media/video/fake_video_encode_accelerator.h |
| diff --git a/media/cast/test/fake_video_encode_accelerator.h b/media/video/fake_video_encode_accelerator.h |
| similarity index 69% |
| rename from media/cast/test/fake_video_encode_accelerator.h |
| rename to media/video/fake_video_encode_accelerator.h |
| index 65cc36c3abd9cd7cc0b3ff447b323f8ebfdfd463..bcbd76aed7e0113085e29d0d5d9b80ca7311f20e 100644 |
| --- a/media/cast/test/fake_video_encode_accelerator.h |
| +++ b/media/video/fake_video_encode_accelerator.h |
| @@ -2,56 +2,53 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ |
| -#define MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ |
| - |
| -#include "media/video/video_encode_accelerator.h" |
| +#ifndef MEDIA_VIDEO_FAKE_VIDEO_ENCODE_ACCELERATOR_H_ |
| +#define MEDIA_VIDEO_FAKE_VIDEO_ENCODE_ACCELERATOR_H_ |
| #include <list> |
| #include <vector> |
| #include "base/memory/weak_ptr.h" |
| #include "media/base/bitstream_buffer.h" |
| +#include "media/video/video_encode_accelerator.h" |
| namespace base { |
| + |
| class SingleThreadTaskRunner; |
| + |
| } // namespace base |
| namespace media { |
| -namespace cast { |
| -namespace test { |
| class FakeVideoEncodeAccelerator : public VideoEncodeAccelerator { |
| public: |
| - explicit FakeVideoEncodeAccelerator( |
| + FakeVideoEncodeAccelerator( |
| const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| - std::vector<uint32>* stored_bitrates); |
| + const std::vector<uint32>& stored_bitrates); |
|
wuchengli
2014/12/09 14:29:25
This constructor parameter is not needed because y
hellner1
2014/12/10 22:38:59
Done.
|
| ~FakeVideoEncodeAccelerator() override; |
| std::vector<VideoEncodeAccelerator::SupportedProfile> GetSupportedProfiles() |
| override; |
| - bool Initialize(media::VideoFrame::Format input_format, |
| + bool Initialize(VideoFrame::Format input_format, |
| const gfx::Size& input_visible_size, |
| VideoCodecProfile output_profile, |
| uint32 initial_bitrate, |
| Client* client) override; |
| - |
| void Encode(const scoped_refptr<VideoFrame>& frame, |
| bool force_keyframe) override; |
| - |
| void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) override; |
| - |
| void RequestEncodingParametersChange(uint32 bitrate, |
| uint32 framerate) override; |
| - |
| void Destroy() override; |
| - void SendDummyFrameForTesting(bool key_frame); |
| - void SetWillInitializationSucceed(bool will_initialization_succeed) { |
| - will_initialization_succeed_ = will_initialization_succeed; |
| + const std::vector<uint32>& stored_bitrates() { |
| + return stored_bitrates_; |
| } |
| - |
| + void SendDummyFrameForTesting(bool key_frame); |
| + void SetWillInitializationSucceed(bool will_initialization_succeed); |
| private: |
| + struct BitstreamBufferRef; |
| + |
| void DoRequireBitstreamBuffers(unsigned int input_count, |
| const gfx::Size& input_coded_size, |
| size_t output_buffer_size) const; |
| @@ -59,21 +56,24 @@ class FakeVideoEncodeAccelerator : public VideoEncodeAccelerator { |
| size_t payload_size, |
| bool key_frame) const; |
| - const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| - std::vector<uint32>* const stored_bitrates_; |
| + // Our original calling message loop for the child thread. |
| + const scoped_refptr<base::SingleThreadTaskRunner> child_message_loop_proxy_; |
| + std::vector<uint32> stored_bitrates_; |
| + bool will_initialization_succeed_; |
| + |
| VideoEncodeAccelerator::Client* client_; |
| + // Keeps track of if the current frame is the first encoded frame. This |
| + // is used to force a fake key frame for the first encoded frame. |
| bool first_; |
| - bool will_initialization_succeed_; |
| - std::list<int32> available_buffer_ids_; |
| + // A list of buffers available for putting fake encoded frames in. |
| + std::list<scoped_ptr<BitstreamBufferRef> > available_buffers_; |
| base::WeakPtrFactory<FakeVideoEncodeAccelerator> weak_this_factory_; |
| DISALLOW_COPY_AND_ASSIGN(FakeVideoEncodeAccelerator); |
| }; |
| -} // namespace test |
| -} // namespace cast |
| } // namespace media |
| -#endif // MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ |
| +#endif // MEDIA_VIDEO_FAKE_VIDEO_ENCODE_ACCELERATOR_H_ |