Fix resize-on-the-fly by processing memory allocation complete.

This commit is contained in:
Nexarian 2024-01-08 17:59:22 -05:00 committed by Christopher Pitstick
parent 1b6ca2245d
commit 5293f13f39

View File

@ -1665,6 +1665,9 @@ lib_mod_process_message(struct mod *mod, struct stream *s)
int type; int type;
char *phold; char *phold;
int width;
int height;
LOG_DEVEL(LOG_LEVEL_TRACE, "lib_mod_process_message:"); LOG_DEVEL(LOG_LEVEL_TRACE, "lib_mod_process_message:");
in_uint16_le(s, type); in_uint16_le(s, type);
in_uint16_le(s, num_orders); in_uint16_le(s, num_orders);
@ -1674,7 +1677,7 @@ lib_mod_process_message(struct mod *mod, struct stream *s)
rv = 0; rv = 0;
if (type == 1) /* original order list */ if (type == 1) /* original order list */
{ {
for (index = 0; index < num_orders; index++) for (index = 0; index < num_orders; ++index)
{ {
in_uint16_le(s, type); in_uint16_le(s, type);
rv = lib_mod_process_orders(mod, type, s); rv = lib_mod_process_orders(mod, type, s);
@ -1727,6 +1730,29 @@ lib_mod_process_message(struct mod *mod, struct stream *s)
s->p = phold + len; s->p = phold + len;
} }
} }
else if (type == 100) // metadata commands.
{
LOG_DEVEL(LOG_LEVEL_INFO,
"lib_mod_process_message: type 100 len %d", len);
for (index = 0; index < num_orders; ++index)
{
phold = s->p;
in_uint16_le(s, type);
in_uint16_le(s, len);
switch (type)
{
case 3: // memory allocation complete
in_uint16_le(s, width);
in_uint16_le(s, height);
LOG(LOG_LEVEL_INFO, "Received memory_allocation_complete"
" command. width: %d, height: %d",
width, height);
rv = mod->server_reset(mod, width, height, 0);
break;
}
s->p = phold + len;
}
}
else else
{ {
LOG_DEVEL(LOG_LEVEL_TRACE, "unknown type %d", type); LOG_DEVEL(LOG_LEVEL_TRACE, "unknown type %d", type);