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 "content/common/gpu/media/vaapi_video_encode_accelerator.h" | 5 #include "content/common/gpu/media/vaapi_video_encode_accelerator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 struct VaapiVideoEncodeAccelerator::BitstreamBufferRef { | 100 struct VaapiVideoEncodeAccelerator::BitstreamBufferRef { |
101 BitstreamBufferRef(int32 id, scoped_ptr<base::SharedMemory> shm, size_t size) | 101 BitstreamBufferRef(int32 id, scoped_ptr<base::SharedMemory> shm, size_t size) |
102 : id(id), shm(shm.Pass()), size(size) {} | 102 : id(id), shm(shm.Pass()), size(size) {} |
103 const int32 id; | 103 const int32 id; |
104 const scoped_ptr<base::SharedMemory> shm; | 104 const scoped_ptr<base::SharedMemory> shm; |
105 const size_t size; | 105 const size_t size; |
106 }; | 106 }; |
107 | 107 |
108 std::vector<media::VideoEncodeAccelerator::SupportedProfile> | 108 std::vector<media::VideoEncodeAccelerator::SupportedProfile> |
109 VaapiVideoEncodeAccelerator::GetSupportedProfiles() { | 109 VaapiVideoEncodeAccelerator::GetSupportedProfiles() { |
110 std::vector<SupportedProfile> profiles; | |
111 | |
112 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 110 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
113 if (cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) | 111 if (cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) |
Pawel Osciak
2015/03/02 11:00:20
I think we should move this to VaapiWrapper::GetSu
henryhsu
2015/03/03 10:48:01
Done.
| |
114 return profiles; | 112 return std::vector<SupportedProfile>(); |
115 | 113 |
116 std::vector<media::VideoCodecProfile> hw_profiles = | 114 return VaapiWrapper::GetSupportedEncodeProfiles(); |
117 VaapiWrapper::GetSupportedEncodeProfiles(base::Bind(&base::DoNothing)); | |
118 | |
119 media::VideoEncodeAccelerator::SupportedProfile profile; | |
120 profile.max_resolution.SetSize(1920, 1088); | |
121 profile.max_framerate_numerator = kDefaultFramerate; | |
122 profile.max_framerate_denominator = 1; | |
123 for (size_t i = 0; i < hw_profiles.size(); i++) { | |
124 profile.profile = hw_profiles[i]; | |
125 profiles.push_back(profile); | |
126 } | |
127 return profiles; | |
128 } | 115 } |
129 | 116 |
130 static unsigned int Log2OfPowerOf2(unsigned int x) { | 117 static unsigned int Log2OfPowerOf2(unsigned int x) { |
131 CHECK_GT(x, 0u); | 118 CHECK_GT(x, 0u); |
132 DCHECK_EQ(x & (x - 1), 0u); | 119 DCHECK_EQ(x & (x - 1), 0u); |
133 | 120 |
134 int log = 0; | 121 int log = 0; |
135 while (x > 1) { | 122 while (x > 1) { |
136 x >>= 1; | 123 x >>= 1; |
137 ++log; | 124 ++log; |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1080 } | 1067 } |
1081 | 1068 |
1082 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1069 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
1083 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1070 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
1084 } | 1071 } |
1085 | 1072 |
1086 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1073 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
1087 } | 1074 } |
1088 | 1075 |
1089 } // namespace content | 1076 } // namespace content |
OLD | NEW |