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 #include "media/video/fake_video_encode_accelerator.h" | 5 #include "media/video/fake_video_encode_accelerator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 static const unsigned int kMinimumInputCount = 1; | 14 static const unsigned int kMinimumInputCount = 1; |
15 static const size_t kMinimumOutputBufferSize = 123456; | 15 static const size_t kMinimumOutputBufferSize = 123456; |
16 | 16 |
17 FakeVideoEncodeAccelerator::FakeVideoEncodeAccelerator( | 17 FakeVideoEncodeAccelerator::FakeVideoEncodeAccelerator( |
18 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) | 18 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) |
19 : task_runner_(task_runner), | 19 : task_runner_(task_runner), |
20 will_initialization_succeed_(true), | 20 will_initialization_succeed_(true), |
21 client_(NULL), | 21 client_(NULL), |
22 next_frame_is_first_frame_(true), | 22 next_frame_is_first_frame_(true), |
23 weak_this_factory_(this) {} | 23 weak_this_factory_(this) {} |
24 | 24 |
25 FakeVideoEncodeAccelerator::~FakeVideoEncodeAccelerator() { | 25 FakeVideoEncodeAccelerator::~FakeVideoEncodeAccelerator() { |
26 weak_this_factory_.InvalidateWeakPtrs(); | 26 weak_this_factory_.InvalidateWeakPtrs(); |
27 } | 27 } |
28 | 28 |
29 std::vector<VideoEncodeAccelerator::SupportedProfile> | 29 VideoEncodeAccelerator::SupportedProfiles |
30 FakeVideoEncodeAccelerator::GetSupportedProfiles() { | 30 FakeVideoEncodeAccelerator::GetSupportedProfiles() { |
31 std::vector<VideoEncodeAccelerator::SupportedProfile> profiles; | 31 SupportedProfiles profiles; |
32 SupportedProfile profile; | 32 SupportedProfile profile; |
33 profile.max_resolution.SetSize(1920, 1088); | 33 profile.max_resolution.SetSize(1920, 1088); |
34 profile.max_framerate_numerator = 30; | 34 profile.max_framerate_numerator = 30; |
35 profile.max_framerate_denominator = 1; | 35 profile.max_framerate_denominator = 1; |
36 | 36 |
37 profile.profile = media::H264PROFILE_MAIN; | 37 profile.profile = media::H264PROFILE_MAIN; |
38 profiles.push_back(profile); | 38 profiles.push_back(profile); |
39 profile.profile = media::VP8PROFILE_ANY; | 39 profile.profile = media::VP8PROFILE_ANY; |
40 profiles.push_back(profile); | 40 profiles.push_back(profile); |
41 return profiles; | 41 return profiles; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 void FakeVideoEncodeAccelerator::DoBitstreamBufferReady( | 131 void FakeVideoEncodeAccelerator::DoBitstreamBufferReady( |
132 int32 bitstream_buffer_id, | 132 int32 bitstream_buffer_id, |
133 size_t payload_size, | 133 size_t payload_size, |
134 bool key_frame) const { | 134 bool key_frame) const { |
135 client_->BitstreamBufferReady(bitstream_buffer_id, | 135 client_->BitstreamBufferReady(bitstream_buffer_id, |
136 payload_size, | 136 payload_size, |
137 key_frame); | 137 key_frame); |
138 } | 138 } |
139 | 139 |
140 } // namespace media | 140 } // namespace media |
OLD | NEW |