Opened 2 years ago

Last modified 11 months ago

#10869 new defect

[Regression] Failed parsing of "Content-Type: audio/L16"-like HTTP streams

Reported by: bubbleguuum Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: http mime_type
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description (last modified by bubbleguuum)

http streams whose Content-Type is audio/L16 are not properly handled anymore, always resulting in this error (for example, as a result of 'ffmpeg -i http://path/to/L16/stream'):

[s16be @ 0xb400006f8e24c7f0] Invalid sample_rate found in mime_type "audio/L16"

Such streams have a mime-type with "rate" and "channels" parameters. For example:

Content-Type: audio/L16;rate=44100;channels=2

This error is from pcmdec.c as it cannot find the "rate" parameter to parse.

That's because it is passed the mime-type without its parameters in http.c, a change that happened in this commit from 8 months ago:

https://github.com/FFmpeg/FFmpeg/commit/0cd2e7dcfbc835f4519f1b2b7da6bd902dbb0190

It can be fixed in two ways:

  • revert that commit and let components making use of "mime-type" handle it properly if it has parameters (so according to this commit's description, modify the HLS component to handle the eventual mime-type params)
  • add an exception for audio/l16:
if (av_strncasecmp(p, "audio/l16", 9) == 0) {
    s->mime_type = av_strdup(p);
} else {
    s->mime_type = av_get_token((const char **)&p, ";");
}

Change History (8)

comment:1 by bubbleguuum, 2 years ago

Description: modified (diff)

comment:2 by bubbleguuum, 11 months ago

Can someone look at this ?

the patch mentioned in this report fixed HLS but broke audio/L16 in pcmdec.c that need the mime-type parameters.

comment:3 by MasterQuestionable, 11 months ago

Analyzed by developer: set
Cc: MasterQuestionable added
Keywords: http mime_type added
Summary: regression in mime-type parsing of http streams with audio/L16 Content-Type[Regression] Failed parsing of "Content-Type: audio/L16"-like HTTP streams
Version: unspecifiedgit-master

͏    Would you propose the fix directly? (GitHub direct commit)
͏    Alike: https://trac.ffmpeg.org/ticket/5514#comment:22

comment:4 by bubbleguuum, 11 months ago

I will look into it. Might propose the first solution I mention in OP (have the HLS component remove the eventual mime-type arguments) as it seems cleaner.

comment:5 by MasterQuestionable, 11 months ago

͏    Thank you.

͏    Cleaner description:
͏    Apply sensible sanitization on Content-Type of HLS.

comment:6 by bubbleguuum, 11 months ago

Can you confirm that the procedure is:

  • fork FFmpeg on github
  • clone the fork
  • make the fix
  • commit to the fork on github
  • post http link to commit on github on the ffmpeg-devel mailing

comment:7 by MasterQuestionable, 11 months ago

͏    Basically yes.
͏    The linked posts (including deep-linked) have more technical details.

͏    Note:
͏    GitHub's web UI seems to allow even skip the local clone...
͏    (in particular ͏"github.dev")

͏    Posting to the mail list or here.
͏    For the mail message: link this ticket too.

͏    ----

͏    https://github.com/bubbleguuum/FFmpeg/commits?author=bubbleguuum&since=2025-03-05
͏    https://github.com/FFmpeg/FFmpeg/commit/b17dd7c2bcd151654c43c72e58d44cc49cdbcbc2

Last edited 11 months ago by MasterQuestionable (previous) (diff)

comment:8 by bubbleguuum, 11 months ago

Here's the commit fixing this issue:

https://github.com/bubbleguuum/FFmpeg/commit/b17dd7c2bcd151654c43c72e58d44cc49cdbcbc2

I did not post it on the mailing-list.

Note: See TracTickets for help on using tickets.