Compare commits

...

4 Commits
5.7.0 ... 5.7.2

Author SHA1 Message Date
dec05eba
cb8104d107 5.7.2 2025-09-23 19:41:01 +02:00
dec05eba
7b64f10eaf x11: fix incorrect screen ratio in recording when recording the first monitor 2025-09-23 19:38:44 +02:00
dec05eba
037b215b44 5.7.1 2025-09-23 17:36:30 +02:00
dec05eba
8cf1a98c33 Codec resolution check: treat 0, 0 as no limit
Some devices such as Intel Xeon E3-1200 don't report max video
resolution. In such cases assume there is no limit and instead let
ffmepg (vaapi) fail when recording, if the resolution isn't supported.
2025-09-23 17:33:44 +02:00
6 changed files with 19 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
project('gpu-screen-recorder', ['c', 'cpp'], version : '5.7.0', default_options : ['warning_level=2'])
project('gpu-screen-recorder', ['c', 'cpp'], version : '5.7.2', default_options : ['warning_level=2'])
add_project_arguments('-Wshadow', language : ['c', 'cpp'])
if get_option('buildtype') == 'debug'

View File

@@ -1,7 +1,7 @@
[package]
name = "gpu-screen-recorder"
type = "executable"
version = "5.7.0"
version = "5.7.2"
platforms = ["posix"]
[config]

View File

@@ -622,7 +622,6 @@ static int gsr_capture_kms_capture(gsr_capture *cap, gsr_capture_metadata *captu
gsr_kms_set_hdr_metadata(self, drm_fd);
self->capture_size = rotate_capture_size_if_rotated(self, (vec2i){ drm_fd->crtc_w, drm_fd->crtc_h });
const vec2i original_frame_size = self->capture_size;
if(self->params.region_size.x > 0 && self->params.region_size.y > 0)
self->capture_size = self->params.region_size;
@@ -654,7 +653,7 @@ static int gsr_capture_kms_capture(gsr_capture *cap, gsr_capture_metadata *captu
gsr_color_conversion_draw(color_conversion, self->external_texture_fallback ? self->external_input_texture_id : self->input_texture_id,
target_pos, output_size,
capture_pos, self->capture_size, original_frame_size,
capture_pos, self->capture_size, (vec2i){ drm_fd->width, drm_fd->height },
gsr_monitor_rotation_to_rotation(rotation), GSR_SOURCE_COLOR_RGB, self->external_texture_fallback, false);
if(self->params.record_cursor) {

View File

@@ -87,7 +87,7 @@ static vec2i profile_entrypoint_get_max_resolution(VADisplay va_dpy, VAProfile p
.type = VAConfigAttribMaxPictureHeight,
}
};
if(vaGetConfigAttributes(va_dpy, profile, entrypoint, attribs, 2) != VA_STATUS_SUCCESS)
if(vaGetConfigAttributes(va_dpy, profile, entrypoint, attribs, 2) != VA_STATUS_SUCCESS || (attribs[0].value & VA_ATTRIB_NOT_SUPPORTED) || (attribs[1].value & VA_ATTRIB_NOT_SUPPORTED))
return (vec2i){0, 0};
return (vec2i){ attribs[0].value, attribs[1].value };

View File

@@ -476,7 +476,10 @@ static void gsr_color_conversion_swizzle_reset(gsr_color_conversion *self, gsr_s
}
}
static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsigned int texture_id, bool external_texture, float rotation_matrix[2][2], vec2i source_position, vec2i source_size, vec2i destination_pos, vec2i texture_size, vec2f scale, gsr_source_color source_color) {
static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsigned int texture_id, bool external_texture, gsr_rotation rotation, float rotation_matrix[2][2], vec2i source_position, vec2i source_size, vec2i destination_pos, vec2i texture_size, vec2f scale, gsr_source_color source_color) {
if(source_size.x == 0 || source_size.y == 0)
return;
const vec2i dest_texture_size = self->params.destination_textures_size[0];
const int texture_target = external_texture ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
@@ -498,11 +501,18 @@ static void gsr_color_conversion_draw_graphics(gsr_color_conversion *self, unsig
(float)source_position.y / (texture_size.y == 0 ? 1.0f : (float)texture_size.y),
};
const vec2f texture_size_norm = {
vec2f texture_size_norm = {
(float)source_size.x / (texture_size.x == 0 ? 1.0f : (float)texture_size.x),
(float)source_size.y / (texture_size.y == 0 ? 1.0f : (float)texture_size.y),
};
if(rotation == GSR_ROT_90 || rotation == GSR_ROT_270) {
const float ratio_x = (double)source_size.x / (double)source_size.y;
const float ratio_y = (double)source_size.y / (double)source_size.x;
texture_size_norm.x *= ratio_y;
texture_size_norm.y *= ratio_x;
}
const float vertices[] = {
-1.0f + 0.0f, -1.0f + 0.0f + size_norm.y, texture_pos_norm.x, texture_pos_norm.y + texture_size_norm.y,
-1.0f + 0.0f, -1.0f + 0.0f, texture_pos_norm.x, texture_pos_norm.y,
@@ -585,7 +595,7 @@ void gsr_color_conversion_draw(gsr_color_conversion *self, unsigned int texture_
source_position.x += source_pos.x;
source_position.y += source_pos.y;
gsr_color_conversion_draw_graphics(self, texture_id, external_texture, rotation_matrix, source_position, source_size, destination_pos, texture_size, scale, source_color);
gsr_color_conversion_draw_graphics(self, texture_id, external_texture, rotation, rotation_matrix, source_position, source_size, destination_pos, texture_size, scale, source_color);
self->params.egl->glFlush();
// TODO: Use the minimal barrier required

View File

@@ -2701,6 +2701,8 @@ static vec2i codec_get_max_resolution(gsr_video_codec video_codec, bool use_soft
}
static bool codec_supports_resolution(vec2i codec_max_resolution, vec2i capture_resolution) {
if(codec_max_resolution.x == 0 || codec_max_resolution.y == 0)
return true;
return codec_max_resolution.x >= capture_resolution.x && codec_max_resolution.y >= capture_resolution.y;
}