-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GFX: add config which to prefer H264 vs RFX #3218
Conversation
d3e7b25
to
90716ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few minor comments.
1f79694
to
dbfbf5e
Compare
xrdp/xrdp_mm.c
Outdated
if (best_pro_index >= 0) | ||
#if defined(XRDP_H264) | ||
struct xrdp_tconfig_gfx_codec_order co = self->wm->gfx_config->codec; | ||
bool_t use_h264 = (best_h264_index >= 0 && (best_pro_index < 0 || (co.h264_idx >= 0 && co.h264_idx < co.rfx_idx))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have 2 codecs for GFX now. It might be more complex when we support a third codec.
@matt335672 Added to use codec order. Can you have a look at the part? Commits will be squashed into 2 parts later, adding configuration and using configuration. |
2459fdf
to
126b686
Compare
126b686
to
2c2585c
Compare
@metalefty - sorry it's taken me a while to get to this, but I wanted to review it properly. I share your concern about working out the codec order, particularly if we add another codec. I think there's a better way to do this by replacing the --- a/xrdp/xrdp_tconfig.h
+++ b/xrdp/xrdp_tconfig.h
@@ -42,10 +42,17 @@ struct xrdp_tconfig_gfx_x264_param
int fps_den;
};
+enum xrdp_tconfig_codecs
+{
+ XTC_H264,
+ XTC_RFX
+};
+
struct xrdp_tconfig_gfx_codec_order
{
- int h264_idx;
- int rfx_idx;
+
+ enum xrdp_tconfig_codecs codecs[2];
+ unsigned int codec_count;
};
struct xrdp_tconfig_gfx Then in xrdp_mm.c we can just iterate over the list and find the first match, ignoring any unsupported codecs. This scales for any number of codecs. I've put together a complete patch (including tests) which illustrates this approach:- Some of the variable names could maybe do with changing. What do you think? |
I like that idea. Could you attach a patch |
Will do. I’ve also just realised the code I added to xrdp_mm.c is complete rubbish! I’ll fix that too, and test it. That will be tomorrow now. |
How's this? 0001-Rework-codec-order-in-tconfig.patch After testing, it occurs to me that for some error conditions (e.g. missing file, badly formatted file) we can default to just "RFX" rather than nothing at all. Then at least we get a match on the codecs. What do you think? |
Agreed. |
Replaced codec idx values with a list of codecs from the config file. Added some logging for debugging
Away from my PC ATM. I’ll fix the build errors and add a patch (and test) to default to RFX tomorrow, time permitting |
Try this one:- 0001-Further-changes-to-selectable-H.264-support.patch.txt Two tests added:-
CI should be fine now. |
PS: Feel free to edit/squash as appropriate. |
- Fix CI errors - tconfig_load_gfx() removes H.264 from the supported codec list if significant errors are found loading the H.264 configuration - tconfig_load_gfx() always produces a usable config, even if the specified file can't be loaded
Thanks, wonderful! LGTM. |
Not implemented to use loaded config yet.
I'd like to get reviewed whether the structure to save codec priority is appropriate.