[FFmpeg-devel] [PATCH] asf muxer: gracefully handle negative timestamps
Michael Niedermayer
michaelni
Thu Mar 11 12:27:04 CET 2010
On Thu, Mar 11, 2010 at 12:15:16PM +0100, Vladimir Pantelic wrote:
> I have one asf file that when remuxed to asf with vcodec/acodec copy for
> some reason has negative dts.
>
> These negative dts end up in "sendtime" as a large integer, putting the
> send
> time in future of the payload presentation time. This is due to the fact
> that (int)asf->packet_timestamp_start is converted to (unsigned
> int)sendtime
>
> Attached patch make sure that we write a sendtime of 0 in this case.
>
> This fixes some complaints that M$ "Windows Media ASF View 9 Series" has
> with the generated file.
> asfenc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 5a18e0df6769452b2874689888dfdd832cca85dc asf_fix_send_time.patch
> Index: libavformat/asfenc.c
> ===================================================================
> --- libavformat/asfenc.c (revision 22465)
> +++ libavformat/asfenc.c (working copy)
> @@ -585,7 +624,7 @@
>
> static int put_payload_parsing_info(
> AVFormatContext *s,
> - unsigned int sendtime,
> + int sendtime,
> unsigned int duration,
> int nb_payloads,
> int padsize
> @@ -626,7 +665,7 @@
> if (iLengthTypeFlags & ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE)
> put_byte(pb, padsize - 1);
>
> - put_le32(pb, sendtime);
> + put_le32(pb, FFMAX(0, sendtime));
muxers are not supposed to store random values
id suggest
1. add a flag to muxers specifying the capability of negative dts support
2. check for that flag in common code (utils.c) and offset all timestamps
so as to avoid neagative dts if not set
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100311/0698f8c6/attachment.pgp>
More information about the ffmpeg-devel
mailing list