diff mbox series

[FFmpeg-devel] flv: fix stereo flag when writing PCMA/PCMU

Message ID 20240121151620.214187-1-aler9.dev@gmail.com
State Accepted
Commit 49ab7f8997659b7d7140b54d814234e302843434
Headers show
Series [FFmpeg-devel] flv: fix stereo flag when writing PCMA/PCMU | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

aler9 Jan. 21, 2024, 3:16 p.m. UTC
Currently, when writing PCMA or PCMU tracks with FLV or RTMP, the
stereo flag and sample rate flag inside RTMP audio messages are
overridden, making impossible to distinguish between mono and stereo
tracks. This patch fixes the issue by restoring the same flag mechanism
of all other codecs, that takes into consideration the right channel
count and sample rate.

Signed-off-by: Alessandro Ros <aler9.dev@gmail.com>
---
 libavformat/flvenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

aler9 Jan. 31, 2024, 9:48 a.m. UTC | #1
Hello again, i'm bumping this patch since currently it's impossible to
stream 16khz or stereo G711 tracks with RTMP, as these are always marked as
8khz, mono tracks.
Please consider merging. Thanks.


Il giorno dom 21 gen 2024 alle ore 16:16 Alessandro Ros <aler9.dev@gmail.com>
ha scritto:

> Currently, when writing PCMA or PCMU tracks with FLV or RTMP, the
> stereo flag and sample rate flag inside RTMP audio messages are
> overridden, making impossible to distinguish between mono and stereo
> tracks. This patch fixes the issue by restoring the same flag mechanism
> of all other codecs, that takes into consideration the right channel
> count and sample rate.
>
> Signed-off-by: Alessandro Ros <aler9.dev@gmail.com>
> ---
>  libavformat/flvenc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> index 874560fac1..772d891136 100644
> --- a/libavformat/flvenc.c
> +++ b/libavformat/flvenc.c
> @@ -208,10 +208,10 @@ error:
>              flags |= FLV_CODECID_NELLYMOSER            |
> FLV_SAMPLESSIZE_16BIT;
>          break;
>      case AV_CODEC_ID_PCM_MULAW:
> -        flags = FLV_CODECID_PCM_MULAW | FLV_SAMPLERATE_SPECIAL |
> FLV_SAMPLESSIZE_16BIT;
> +        flags |= FLV_CODECID_PCM_MULAW | FLV_SAMPLESSIZE_16BIT;
>          break;
>      case AV_CODEC_ID_PCM_ALAW:
> -        flags = FLV_CODECID_PCM_ALAW  | FLV_SAMPLERATE_SPECIAL |
> FLV_SAMPLESSIZE_16BIT;
> +        flags |= FLV_CODECID_PCM_ALAW | FLV_SAMPLESSIZE_16BIT;
>          break;
>      case 0:
>          flags |= par->codec_tag << 4;
> --
> 2.34.1
>
>
Marton Balint Feb. 4, 2024, 7:22 p.m. UTC | #2
On Wed, 31 Jan 2024, aler9 wrote:

> Hello again, i'm bumping this patch since currently it's impossible to
> stream 16khz or stereo G711 tracks with RTMP, as these are always marked as
> 8khz, mono tracks.
> Please consider merging. Thanks.

Will apply, thanks.

Marton

>
>
> Il giorno dom 21 gen 2024 alle ore 16:16 Alessandro Ros <aler9.dev@gmail.com>
> ha scritto:
>
>> Currently, when writing PCMA or PCMU tracks with FLV or RTMP, the
>> stereo flag and sample rate flag inside RTMP audio messages are
>> overridden, making impossible to distinguish between mono and stereo
>> tracks. This patch fixes the issue by restoring the same flag mechanism
>> of all other codecs, that takes into consideration the right channel
>> count and sample rate.
>>
>> Signed-off-by: Alessandro Ros <aler9.dev@gmail.com>
>> ---
>>  libavformat/flvenc.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
>> index 874560fac1..772d891136 100644
>> --- a/libavformat/flvenc.c
>> +++ b/libavformat/flvenc.c
>> @@ -208,10 +208,10 @@ error:
>>              flags |= FLV_CODECID_NELLYMOSER            |
>> FLV_SAMPLESSIZE_16BIT;
>>          break;
>>      case AV_CODEC_ID_PCM_MULAW:
>> -        flags = FLV_CODECID_PCM_MULAW | FLV_SAMPLERATE_SPECIAL |
>> FLV_SAMPLESSIZE_16BIT;
>> +        flags |= FLV_CODECID_PCM_MULAW | FLV_SAMPLESSIZE_16BIT;
>>          break;
>>      case AV_CODEC_ID_PCM_ALAW:
>> -        flags = FLV_CODECID_PCM_ALAW  | FLV_SAMPLERATE_SPECIAL |
>> FLV_SAMPLESSIZE_16BIT;
>> +        flags |= FLV_CODECID_PCM_ALAW | FLV_SAMPLESSIZE_16BIT;
>>          break;
>>      case 0:
>>          flags |= par->codec_tag << 4;
>> --
>> 2.34.1
>>
>>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
diff mbox series

Patch

diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 874560fac1..772d891136 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -208,10 +208,10 @@  error:
             flags |= FLV_CODECID_NELLYMOSER            | FLV_SAMPLESSIZE_16BIT;
         break;
     case AV_CODEC_ID_PCM_MULAW:
-        flags = FLV_CODECID_PCM_MULAW | FLV_SAMPLERATE_SPECIAL | FLV_SAMPLESSIZE_16BIT;
+        flags |= FLV_CODECID_PCM_MULAW | FLV_SAMPLESSIZE_16BIT;
         break;
     case AV_CODEC_ID_PCM_ALAW:
-        flags = FLV_CODECID_PCM_ALAW  | FLV_SAMPLERATE_SPECIAL | FLV_SAMPLESSIZE_16BIT;
+        flags |= FLV_CODECID_PCM_ALAW | FLV_SAMPLESSIZE_16BIT;
         break;
     case 0:
         flags |= par->codec_tag << 4;