From 3b2545cf82d71413af78f4ac4549ce83de575254 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Fri, 13 Jan 2017 14:06:49 +0300 Subject: [PATCH] Fixed timing bug catching in CEA-708 --- src/lib_ccx/ccx_decoders_708_output.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lib_ccx/ccx_decoders_708_output.c b/src/lib_ccx/ccx_decoders_708_output.c index 463da5d5..f19e5de3 100644 --- a/src/lib_ccx/ccx_decoders_708_output.c +++ b/src/lib_ccx/ccx_decoders_708_output.c @@ -119,14 +119,15 @@ void _dtvcc_write_row(ccx_dtvcc_writer_ctx *writer, ccx_dtvcc_service_decoder *d ccx_dtvcc_pen_attribs pen_attribs = ccx_dtvcc_default_pen_attribs; _dtvcc_get_write_interval(decoder->tv, row_index, &first, &last); - if (decoder->windows[decoder->current_window].col_count <= last) - { - ccx_common_logging.log_ftn("[CEA-708] _dtvcc_write_row: " - "Bug: col_count should be larger than last char, but %d <= %d\n", - decoder->windows[decoder->current_window].col_count, last); - } + if (decoder->current_window == -1) + ccx_common_logging.log_ftn("[CEA-708] _dtvcc_write_row: Window has to be defined first\n"); + + int length; + if (decoder->current_window == -1) // Bug - in this case we have broken timing. See issue in GitHub + length = last + 1; + else + length = decoder->windows[decoder->current_window].col_count; - int length = max(last + 1, decoder->windows[decoder->current_window].col_count); // Bug - col_count should be always > last for (int i = 0; i < length; i++) { _dtvcc_change_pen_colors(decoder->tv, pen_color, row_index, i, encoder, 0);