mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
vtenc: Fix checking for certain CPU variants when running in VMs
These checks were introduced to prevent exposing ARGB64/RGBA64 in the caps when running on M1 Pro/Max with macOS <13 because of a bug in VideoToolbox. Unfortunately, the initial buffer size of 15 is too short when running in a VM - the CPU brand string there looks like "Apple M1 Pro (Virtual)", which due to its length causes sysctlbyname to return -1, resulting in broken formats still showing up in the caps. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4080>
This commit is contained in:
parent
00988e70ac
commit
b3830b08fd
1 changed files with 7 additions and 3 deletions
|
@ -234,8 +234,8 @@ gst_vtenc_base_init (GstVTEncClass * klass)
|
||||||
#ifndef HAVE_IOS
|
#ifndef HAVE_IOS
|
||||||
gboolean enable_argb = TRUE;
|
gboolean enable_argb = TRUE;
|
||||||
int retval;
|
int retval;
|
||||||
char cpu_name[15];
|
char cpu_name[30];
|
||||||
size_t cpu_len = 15;
|
size_t cpu_len = 30;
|
||||||
|
|
||||||
if (__builtin_available (macOS 13.0, *)) {
|
if (__builtin_available (macOS 13.0, *)) {
|
||||||
/* Can't negate a __builtin_available check */
|
/* Can't negate a __builtin_available check */
|
||||||
|
@ -247,9 +247,13 @@ gst_vtenc_base_init (GstVTEncClass * klass)
|
||||||
|
|
||||||
if (retval == 0 &&
|
if (retval == 0 &&
|
||||||
(strstr (cpu_name, "M1 Pro") != NULL ||
|
(strstr (cpu_name, "M1 Pro") != NULL ||
|
||||||
strstr (cpu_name, "M1 Max") != NULL))
|
strstr (cpu_name, "M1 Max") != NULL)) {
|
||||||
|
GST_WARNING
|
||||||
|
("Disabling ARGB64/RGBA64 caps due to a bug in VideoToolbox "
|
||||||
|
"on M1 Pro/Max running macOS < 13.0.");
|
||||||
enable_argb = FALSE;
|
enable_argb = FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (enable_argb) {
|
if (enable_argb) {
|
||||||
caps = gst_vtutil_caps_append_video_format (caps, "ARGB64_BE");
|
caps = gst_vtutil_caps_append_video_format (caps, "ARGB64_BE");
|
||||||
|
|
Loading…
Reference in a new issue