Skip to content

Commit 0c0d76d

Browse files
committed
Fixed a long standing bug where a FAX that has to return to the DCS/TCF sequence, due to something like a change of
page size mid-FAX, messed up the TCF sequence, and stepped down to a lower speed.
1 parent 4a73bd7 commit 0c0d76d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/t38_non_ecm_buffer.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,19 @@ SPAN_DECLARE(void) t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_st
366366

367367
SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, bool image_mode, int min_bits_per_row)
368368
{
369+
bool old_mode;
370+
371+
old_mode = s->image_data_mode;
369372
s->image_data_mode = image_mode;
370373
s->min_bits_per_row = min_bits_per_row;
374+
375+
/* If we are changing modes, we need to restart the buffer to initialise the new mode. Usually the buffer will
376+
restart as it empties at the end of a TCF or image operation. However, something like a change of page size,
377+
which will cause a new DCS and TCF sequence, will only detect the need for a mode change from image to
378+
TCF after the buffer has reset automatically at the end of the last image. */
379+
if (image_mode != old_mode)
380+
restart_buffer(s);
381+
/*endif*/
371382
}
372383
/*- End of function --------------------------------------------------------*/
373384

0 commit comments

Comments
 (0)