Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1171)

Side by Side Diff: media/cast/test/fake_video_encode_accelerator.h

Issue 185403020: Make VEA client of command buffer; move sync. IPC to VDA/VEA::Initialize() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 85629196 fischman@ comments. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 27
22 virtual void Initialize(media::VideoFrame::Format input_format, 28 virtual bool Initialize(media::VideoFrame::Format input_format,
23 const gfx::Size& input_visible_size, 29 const gfx::Size& input_visible_size,
24 VideoCodecProfile output_profile, 30 VideoCodecProfile output_profile,
25 uint32 initial_bitrate, 31 uint32 initial_bitrate,
26 Client* client) OVERRIDE; 32 Client* client) OVERRIDE;
27 33
28 virtual void Encode(const scoped_refptr<VideoFrame>& frame, 34 virtual void Encode(const scoped_refptr<VideoFrame>& frame,
29 bool force_keyframe) OVERRIDE; 35 bool force_keyframe) OVERRIDE;
30 36
31 virtual void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) OVERRIDE; 37 virtual void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) OVERRIDE;
32 38
33 virtual void RequestEncodingParametersChange(uint32 bitrate, 39 virtual void RequestEncodingParametersChange(uint32 bitrate,
34 uint32 framerate) OVERRIDE; 40 uint32 framerate) OVERRIDE;
35 41
36 virtual void Destroy() OVERRIDE; 42 virtual void Destroy() OVERRIDE;
37 43
38 private: 44 private:
39 virtual ~FakeVideoEncodeAccelerator(); 45 virtual ~FakeVideoEncodeAccelerator();
40 46
47 void DoRequireBitstreamBuffers(unsigned int input_count,
48 const gfx::Size& input_coded_size,
49 size_t output_buffer_size) const;
50 void DoBitstreamBufferReady(int32 bitstream_buffer_id,
51 size_t payload_size,
52 bool key_frame) const;
53
54 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
55
41 VideoEncodeAccelerator::Client* client_; 56 VideoEncodeAccelerator::Client* client_;
42 bool first_; 57 bool first_;
43 58
44 std::list<int32> available_buffer_ids_; 59 std::list<int32> available_buffer_ids_;
45 60
61 base::WeakPtrFactory<FakeVideoEncodeAccelerator> weak_this_factory_;
62
46 DISALLOW_COPY_AND_ASSIGN(FakeVideoEncodeAccelerator); 63 DISALLOW_COPY_AND_ASSIGN(FakeVideoEncodeAccelerator);
47 }; 64 };
48 65
49 } // namespace test 66 } // namespace test
50 } // namespace cast 67 } // namespace cast
51 } // namespace media 68 } // namespace media
52 69
53 #endif // MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ 70 #endif // MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698