Skip to content

Sometimes getting: assert on ope_encoder_drain() with enc->streams == NULL in , file src/opusenc.c, line 839. #24

@alexupotsdam

Description

@alexupotsdam

Not very often, but maybe 1 in 50 times, I get a crash with the above-mentioned log.

  assert(enc->buffer_end <= BUFFER_SAMPLES);
  encode_buffer(enc);
  if (enc->unrecoverable) return enc->unrecoverable;
  /* Draining should have called all the streams to complete. */
  assert(enc->streams == NULL); /* <-- the line where the crash happens */
  return OPE_OK;
}

Of course I'd much rather have this NOT crashing. What can I do in order to prevent this from happening? Can there be a "bad moment" to call the drain() such as immediately after starting to encode (which is how I was able to reproduce the bug if it wasn't a coincidence). Should I check for anything else before draining so I don't run into the assert?

Sorry for the dumb question but is C thread safe in this regard or could calling drain() and a simultaneous ope_encoder_write[/_float] cause this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions