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

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

Issue 439863003: Cast: Use fixed bitrate and set it once for hardware encoder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cooments Created 6 years, 4 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 #include <vector>
11 12
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "media/base/bitstream_buffer.h" 14 #include "media/base/bitstream_buffer.h"
14 15
15 namespace base { 16 namespace base {
16 class SingleThreadTaskRunner; 17 class SingleThreadTaskRunner;
17 } // namespace base 18 } // namespace base
18 19
19 namespace media { 20 namespace media {
20 namespace cast { 21 namespace cast {
21 namespace test { 22 namespace test {
22 23
23 class FakeVideoEncodeAccelerator : public VideoEncodeAccelerator { 24 class FakeVideoEncodeAccelerator : public VideoEncodeAccelerator {
24 public: 25 public:
25 explicit FakeVideoEncodeAccelerator( 26 explicit FakeVideoEncodeAccelerator(
26 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 27 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
28 std::vector<uint32>* stored_bitrates);
27 virtual ~FakeVideoEncodeAccelerator(); 29 virtual ~FakeVideoEncodeAccelerator();
28 30
29 virtual bool Initialize(media::VideoFrame::Format input_format, 31 virtual bool Initialize(media::VideoFrame::Format input_format,
30 const gfx::Size& input_visible_size, 32 const gfx::Size& input_visible_size,
31 VideoCodecProfile output_profile, 33 VideoCodecProfile output_profile,
32 uint32 initial_bitrate, 34 uint32 initial_bitrate,
33 Client* client) OVERRIDE; 35 Client* client) OVERRIDE;
34 36
35 virtual void Encode(const scoped_refptr<VideoFrame>& frame, 37 virtual void Encode(const scoped_refptr<VideoFrame>& frame,
36 bool force_keyframe) OVERRIDE; 38 bool force_keyframe) OVERRIDE;
37 39
38 virtual void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) OVERRIDE; 40 virtual void UseOutputBitstreamBuffer(const BitstreamBuffer& buffer) OVERRIDE;
39 41
40 virtual void RequestEncodingParametersChange(uint32 bitrate, 42 virtual void RequestEncodingParametersChange(uint32 bitrate,
41 uint32 framerate) OVERRIDE; 43 uint32 framerate) OVERRIDE;
42 44
43 virtual void Destroy() OVERRIDE; 45 virtual void Destroy() OVERRIDE;
44 46
45 void SendDummyFrameForTesting(bool key_frame); 47 void SendDummyFrameForTesting(bool key_frame);
46 48
47 private: 49 private:
48 void DoRequireBitstreamBuffers(unsigned int input_count, 50 void DoRequireBitstreamBuffers(unsigned int input_count,
49 const gfx::Size& input_coded_size, 51 const gfx::Size& input_coded_size,
50 size_t output_buffer_size) const; 52 size_t output_buffer_size) const;
51 void DoBitstreamBufferReady(int32 bitstream_buffer_id, 53 void DoBitstreamBufferReady(int32 bitstream_buffer_id,
52 size_t payload_size, 54 size_t payload_size,
53 bool key_frame) const; 55 bool key_frame) const;
54 56
55 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 57 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
miu 2014/08/05 21:52:07 Can you make these two members const?
Alpha Left Google 2014/08/06 01:24:54 Done.
58 std::vector<uint32>* stored_bitrates_;
56 59
57 VideoEncodeAccelerator::Client* client_; 60 VideoEncodeAccelerator::Client* client_;
58 bool first_; 61 bool first_;
59 62
60 std::list<int32> available_buffer_ids_; 63 std::list<int32> available_buffer_ids_;
61 64
62 base::WeakPtrFactory<FakeVideoEncodeAccelerator> weak_this_factory_; 65 base::WeakPtrFactory<FakeVideoEncodeAccelerator> weak_this_factory_;
63 66
64 DISALLOW_COPY_AND_ASSIGN(FakeVideoEncodeAccelerator); 67 DISALLOW_COPY_AND_ASSIGN(FakeVideoEncodeAccelerator);
65 }; 68 };
66 69
67 } // namespace test 70 } // namespace test
68 } // namespace cast 71 } // namespace cast
69 } // namespace media 72 } // namespace media
70 73
71 #endif // MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_ 74 #endif // MEDIA_CAST_TEST_FAKE_MOCK_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698