| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ | 5 #ifndef MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ |
| 6 #define MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ | 6 #define MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ |
| 7 | 7 |
| 8 #include "media/video/video_encode_accelerator.h" | 8 #include "media/video/video_encode_accelerator.h" |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 | 11 |
| 12 #include "base/memory/weak_ptr.h" |
| 12 #include "media/base/bitstream_buffer.h" | 13 #include "media/base/bitstream_buffer.h" |
| 13 | 14 |
| 15 namespace base { |
| 16 class SingleThreadTaskRunner; |
| 17 } // namespace base |
| 18 |
| 14 namespace media { | 19 namespace media { |
| 15 namespace cast { | 20 namespace cast { |
| 16 namespace test { | 21 namespace test { |
| 17 | 22 |
| 18 class FakeVideoEncodeAccelerator : public VideoEncodeAccelerator { | 23 class FakeVideoEncodeAccelerator : public VideoEncodeAccelerator { |
| 19 public: | 24 public: |
| 20 FakeVideoEncodeAccelerator(); | 25 explicit FakeVideoEncodeAccelerator( |
| 26 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 21 virtual ~FakeVideoEncodeAccelerator(); | 27 virtual ~FakeVideoEncodeAccelerator(); |
| 22 | 28 |
| 23 virtual void Initialize(media::VideoFrame::Format input_format, | 29 virtual bool Initialize(media::VideoFrame::Format input_format, |
| 24 const gfx::Size& input_visible_size, | 30 const gfx::Size& input_visible_size, |
| 25 VideoCodecProfile output_profile, | 31 VideoCodecProfile output_profile, |
| 26 uint32 initial_bitrate, | 32 uint32 initial_bitrate, |
| 27 Client* client) OVERRIDE; | 33 Client* client) OVERRIDE; |
| 28 | 34 |
| 29 virtual void Encode(const scoped_refptr<VideoFrame>& frame, | 35 virtual void Encode(const scoped_refptr<VideoFrame>& frame, |
| 30 bool force_keyframe) OVERRIDE; | 36 bool force_keyframe) OVERRIDE; |
| 31 | 37 |
| 32 virtual void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) OVERRIDE; | 38 virtual void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) OVERRIDE; |
| 33 | 39 |
| 34 virtual void RequestEncodingParametersChange(uint32 bitrate, | 40 virtual void RequestEncodingParametersChange(uint32 bitrate, |
| 35 uint32 framerate) OVERRIDE; | 41 uint32 framerate) OVERRIDE; |
| 36 | 42 |
| 37 virtual void Destroy() OVERRIDE; | 43 virtual void Destroy() OVERRIDE; |
| 38 | 44 |
| 39 private: | 45 private: |
| 46 void DoRequireBitstreamBuffers(unsigned int input_count, |
| 47 const gfx::Size& input_coded_size, |
| 48 size_t output_buffer_size) const; |
| 49 void DoBitstreamBufferReady(int32 bitstream_buffer_id, |
| 50 size_t payload_size, |
| 51 bool key_frame) const; |
| 52 |
| 53 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 54 |
| 40 VideoEncodeAccelerator::Client* client_; | 55 VideoEncodeAccelerator::Client* client_; |
| 41 bool first_; | 56 bool first_; |
| 42 | 57 |
| 43 std::list<int32> available_buffer_ids_; | 58 std::list<int32> available_buffer_ids_; |
| 44 | 59 |
| 60 base::WeakPtrFactory<FakeVideoEncodeAccelerator> weak_this_factory_; |
| 61 |
| 45 DISALLOW_COPY_AND_ASSIGN(FakeVideoEncodeAccelerator); | 62 DISALLOW_COPY_AND_ASSIGN(FakeVideoEncodeAccelerator); |
| 46 }; | 63 }; |
| 47 | 64 |
| 48 } // namespace test | 65 } // namespace test |
| 49 } // namespace cast | 66 } // namespace cast |
| 50 } // namespace media | 67 } // namespace media |
| 51 | 68 |
| 52 #endif // MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ | 69 #endif // MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ |
| OLD | NEW |