ccextractor icon indicating copy to clipboard operation
ccextractor copied to clipboard

[BUG] Error in switch_to_next_file()

Open shri-acha opened this issue 9 months ago • 3 comments

I got an error while trying to run an example video i got from on the web.

I'd like some help with solving it.

I've tried to wander around the codebase and found out that below:

if (ctx->inputsize > 0 && ((ctx->demux_ctx->past + bytesinbuffer) < ctx->inputsize) && is_decoder_processed_enough(ctx) == CCX_FALSE)

line handles the error, and also as the log mentions it, the file being read is probably hasn't been parsed.

Output Images: Image Video Used: Example Video

shri-acha avatar Jun 10 '25 01:06 shri-acha

What is the problem ?

The error occurs in the switch_to_next_file() function in file_functions.c:283
when CCExtractor detects that file processing ended prematurely. The condition
that triggers this error is:

if (ctx->inputsize > 0 && ((ctx->demux_ctx->past + bytesinbuffer) < ctx->inputsize) && is_decoder_processed_enough(ctx) == CCX_FALSE)

This means ---->

  • File has a known size (> 0)
  • The amount of data processed (demux_ctx->past + buffer) is less than the total file size
  • The decoder hasn't signaled that it's "processed enough" (not reached user-defined limits)

tmdeveloper007 avatar Oct 28 '25 04:10 tmdeveloper007

In my terminal it is showing like this

Image

AnujRewar avatar Oct 29 '25 11:10 AnujRewar

Hi , I've identified the root cause of this bug and am ready to implement a fix. Problem Analysis:

The issue is in the is_decoder_processed_enough() function in src/lib_ccx/lib_ccx.c. The current logic is:

if (dec_ctx->processed_enough == CCX_TRUE && ctx->multiprogram == CCX_FALSE) return CCX_TRUE; The bug: When multiprogram mode is enabled, this function always returns CCX_FALSE, even when decoders have actually processed enough data.

This causes the condition in switch_to_next_file() to incorrectly trigger the "premature ending" error:

if (ctx->inputsize > 0 && ((ctx->demux_ctx->past + bytesinbuffer) < ctx->inputsize) && is_decoder_processed_enough(ctx) == CCX_FALSE) ← Always true in multiprogram mode

Proposed Fix:

I will modify the is_decoder_processed_enough() function to properly handle multiprogram mode. The function should check if ANY decoder has processed enough data, regardless of multiprogram setting.

I'm working on the implementation now and will submit a PR shortly.

DhanushVarma-2 avatar Nov 09 '25 15:11 DhanushVarma-2