Skip to content

Commit

Permalink
Fix dropped audio tracks from some sources
Browse files Browse the repository at this point in the history
This showed up as a problem with some DVD titles, but likely affects
other source types as well.
  • Loading branch information
jstebbins committed Jul 2, 2024
1 parent e882fcd commit 12d2803
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libhb/decavcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,8 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
{
int parse_len;

// Start with a clean error slate on each parsing iteration
avcodec_result = 0;
if (parser != NULL)
{
parse_len = av_parser_parse2(parser, context,
Expand All @@ -938,6 +940,10 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
avp->pts = buf->s.start;
avp->dts = AV_NOPTS_VALUE;

// Note: The first buffer returned by av_parser_parse2() may
// not be aligned to start of valid codec data which can cause
// the first call to avcodec_send_packet() to fail with
// AVERROR_INVALIDDATA.
avcodec_result = avcodec_send_packet(context, avp);
if (avcodec_result < 0 && avcodec_result != AVERROR_EOF)
{
Expand Down

0 comments on commit 12d2803

Please sign in to comment.