Chromium Code Reviews| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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; | 110 std::vector<SupportedProfile> profiles; |
| 111 | 111 |
| 112 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 112 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 113 if (cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) | 113 if (cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) |
| 114 return profiles; | 114 return profiles; |
| 115 | 115 |
| 116 std::vector<media::VideoCodecProfile> hw_profiles = | 116 profiles = VaapiWrapper::GetSupportedEncodeProfiles(); |
| 117 VaapiWrapper::GetSupportedEncodeProfiles(base::Bind(&base::DoNothing)); | |
| 118 | 117 |
| 119 media::VideoEncodeAccelerator::SupportedProfile profile; | 118 for (size_t i = 0; i < profiles.size(); i++) { |
| 120 profile.max_resolution.SetSize(1920, 1088); | 119 profiles[i].max_framerate_numerator = kDefaultFramerate; |
|
wuchengli
2015/02/13 15:38:54
Let's move setting framerate and make a copy of kD
henryhsu
2015/02/13 17:24:28
Done.
| |
| 121 profile.max_framerate_numerator = kDefaultFramerate; | 120 profiles[i].max_framerate_denominator = 1; |
| 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 } | 121 } |
| 127 return profiles; | 122 return profiles; |
| 128 } | 123 } |
| 129 | 124 |
| 130 static unsigned int Log2OfPowerOf2(unsigned int x) { | 125 static unsigned int Log2OfPowerOf2(unsigned int x) { |
| 131 CHECK_GT(x, 0u); | 126 CHECK_GT(x, 0u); |
| 132 DCHECK_EQ(x & (x - 1), 0u); | 127 DCHECK_EQ(x & (x - 1), 0u); |
| 133 | 128 |
| 134 int log = 0; | 129 int log = 0; |
| 135 while (x > 1) { | 130 while (x > 1) { |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1080 } | 1075 } |
| 1081 | 1076 |
| 1082 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1077 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
| 1083 : coded_buffer(VA_INVALID_ID), keyframe(false) { | 1078 : coded_buffer(VA_INVALID_ID), keyframe(false) { |
| 1084 } | 1079 } |
| 1085 | 1080 |
| 1086 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { | 1081 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() { |
| 1087 } | 1082 } |
| 1088 | 1083 |
| 1089 } // namespace content | 1084 } // namespace content |
| OLD | NEW |