* [FFmpeg-devel] [PATCH] avformat/mpegtsenc: Always output a minimum of 32 packets.
@ 2022-11-28 20:45 James Almer
2022-11-28 22:25 ` Marton Balint
0 siblings, 1 reply; 3+ messages in thread
From: James Almer @ 2022-11-28 20:45 UTC (permalink / raw)
To: ffmpeg-devel
From: Thierry Foucu <tfoucu@gmail.com>
Otherwise, if you just output a PAT/PMT and a single TS packets, the
demuxer will not be able to detect TS.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/mpegtsenc.c | 11 ++++-------
tests/ref/acodec/s302m | 4 ++--
tests/ref/lavf/ts | 4 ++--
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 48d39e6a7d..760e5fd8c6 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -2147,8 +2147,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
static void mpegts_write_flush(AVFormatContext *s)
{
- MpegTSWrite *ts = s->priv_data;
- int i;
+ int packets, i;
/* flush current packets */
for (i = 0; i < s->nb_streams; i++) {
@@ -2163,11 +2162,9 @@ static void mpegts_write_flush(AVFormatContext *s)
}
}
- if (ts->m2ts_mode) {
- int packets = (avio_tell(s->pb) / (TS_PACKET_SIZE + 4)) % 32;
- while (packets++ < 32)
- mpegts_insert_null_packet(s);
- }
+ packets = (avio_tell(s->pb) / (TS_PACKET_SIZE + 4)) % 32;
+ while (packets++ < 32)
+ mpegts_insert_null_packet(s);
}
static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
diff --git a/tests/ref/acodec/s302m b/tests/ref/acodec/s302m
index 2919ed6e55..5c12d5ff69 100644
--- a/tests/ref/acodec/s302m
+++ b/tests/ref/acodec/s302m
@@ -1,4 +1,4 @@
-0bf5457fd41a22fc5cdd99ae5ad4e273 *tests/data/fate/acodec-s302m.mpegts
-1527688 tests/data/fate/acodec-s302m.mpegts
+51fdac8dddb34b067f458b8114e3a32c *tests/data/fate/acodec-s302m.mpegts
+1529944 tests/data/fate/acodec-s302m.mpegts
31f25a0020fd9017de9c3c608316854b *tests/data/fate/acodec-s302m.out.wav
stddev: 986.94 PSNR: 36.44 MAXDIFF:18571 bytes: 1058400/ 1056708
diff --git a/tests/ref/lavf/ts b/tests/ref/lavf/ts
index b004fc1b1c..cb5395abbc 100644
--- a/tests/ref/lavf/ts
+++ b/tests/ref/lavf/ts
@@ -1,3 +1,3 @@
-371dc016eb3155116bea27e3b4eeb928 *tests/data/lavf/lavf.ts
-389160 tests/data/lavf/lavf.ts
+cf342532317c4ae802c4f95f7d1f2459 *tests/data/lavf/lavf.ts
+393296 tests/data/lavf/lavf.ts
tests/data/lavf/lavf.ts CRC=0x71287e25
--
2.38.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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: Always output a minimum of 32 packets.
2022-11-28 20:45 [FFmpeg-devel] [PATCH] avformat/mpegtsenc: Always output a minimum of 32 packets James Almer
@ 2022-11-28 22:25 ` Marton Balint
2022-11-29 22:21 ` Derek Buitenhuis
0 siblings, 1 reply; 3+ messages in thread
From: Marton Balint @ 2022-11-28 22:25 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mon, 28 Nov 2022, James Almer wrote:
> From: Thierry Foucu <tfoucu@gmail.com>
>
> Otherwise, if you just output a PAT/PMT and a single TS packets, the
> demuxer will not be able to detect TS.
This looks like a demuxer bug, which should be fixed in the demuxer, and
not in the muxer.
Regards,
Marton
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> libavformat/mpegtsenc.c | 11 ++++-------
> tests/ref/acodec/s302m | 4 ++--
> tests/ref/lavf/ts | 4 ++--
> 3 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index 48d39e6a7d..760e5fd8c6 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -2147,8 +2147,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
>
> static void mpegts_write_flush(AVFormatContext *s)
> {
> - MpegTSWrite *ts = s->priv_data;
> - int i;
> + int packets, i;
>
> /* flush current packets */
> for (i = 0; i < s->nb_streams; i++) {
> @@ -2163,11 +2162,9 @@ static void mpegts_write_flush(AVFormatContext *s)
> }
> }
>
> - if (ts->m2ts_mode) {
> - int packets = (avio_tell(s->pb) / (TS_PACKET_SIZE + 4)) % 32;
> - while (packets++ < 32)
> - mpegts_insert_null_packet(s);
> - }
> + packets = (avio_tell(s->pb) / (TS_PACKET_SIZE + 4)) % 32;
> + while (packets++ < 32)
> + mpegts_insert_null_packet(s);
> }
>
> static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
> diff --git a/tests/ref/acodec/s302m b/tests/ref/acodec/s302m
> index 2919ed6e55..5c12d5ff69 100644
> --- a/tests/ref/acodec/s302m
> +++ b/tests/ref/acodec/s302m
> @@ -1,4 +1,4 @@
> -0bf5457fd41a22fc5cdd99ae5ad4e273 *tests/data/fate/acodec-s302m.mpegts
> -1527688 tests/data/fate/acodec-s302m.mpegts
> +51fdac8dddb34b067f458b8114e3a32c *tests/data/fate/acodec-s302m.mpegts
> +1529944 tests/data/fate/acodec-s302m.mpegts
> 31f25a0020fd9017de9c3c608316854b *tests/data/fate/acodec-s302m.out.wav
> stddev: 986.94 PSNR: 36.44 MAXDIFF:18571 bytes: 1058400/ 1056708
> diff --git a/tests/ref/lavf/ts b/tests/ref/lavf/ts
> index b004fc1b1c..cb5395abbc 100644
> --- a/tests/ref/lavf/ts
> +++ b/tests/ref/lavf/ts
> @@ -1,3 +1,3 @@
> -371dc016eb3155116bea27e3b4eeb928 *tests/data/lavf/lavf.ts
> -389160 tests/data/lavf/lavf.ts
> +cf342532317c4ae802c4f95f7d1f2459 *tests/data/lavf/lavf.ts
> +393296 tests/data/lavf/lavf.ts
> tests/data/lavf/lavf.ts CRC=0x71287e25
> --
> 2.38.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".
>
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/mpegtsenc: Always output a minimum of 32 packets.
2022-11-28 22:25 ` Marton Balint
@ 2022-11-29 22:21 ` Derek Buitenhuis
0 siblings, 0 replies; 3+ messages in thread
From: Derek Buitenhuis @ 2022-11-29 22:21 UTC (permalink / raw)
To: ffmpeg-devel
On 11/28/2022 10:25 PM, Marton Balint wrote:
> This looks like a demuxer bug, which should be fixed in the demuxer, and
> not in the muxer.
+1.
I had to re-read the commit message twice because I coulndn't figure out why
the muxer would care about lavf specific demuxer probing.
- Derek
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-29 22:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-28 20:45 [FFmpeg-devel] [PATCH] avformat/mpegtsenc: Always output a minimum of 32 packets James Almer
2022-11-28 22:25 ` Marton Balint
2022-11-29 22:21 ` Derek Buitenhuis
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git