[FFmpeg-devel] [PATCH] avformat/oggenc: fix page duration calculation when granule differs from timestamp

Michael Niedermayer michael at niedermayer.cc
Fri Jul 8 03:58:07 EEST 2016


On Thu, Jul 07, 2016 at 07:13:47PM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> 
>  libavformat/oggenc.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
> index f998af3..296028e 100644
> --- a/libavformat/oggenc.c
> +++ b/libavformat/oggenc.c
> @@ -263,10 +263,10 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream *st,
>          {
>              AVStream *st = s->streams[page->stream_index];
>  
> -            int64_t start = av_rescale_q(page->start_granule, st->time_base,
> -                                         AV_TIME_BASE_Q);
> -            int64_t next  = av_rescale_q(page->granule, st->time_base,
> -                                         AV_TIME_BASE_Q);
> +            int64_t start = av_rescale_q(ogg_granule_to_timestamp(oggstream, page->start_granule),
> +                                         st->time_base, AV_TIME_BASE_Q);
> +            int64_t next  = av_rescale_q(ogg_granule_to_timestamp(oggstream, page->granule),
> +                                         st->time_base, AV_TIME_BASE_Q);
>  
>              if (page->segments_count == 255) {
>                  ogg_buffer_page(s, oggstream);
> @@ -596,7 +596,7 @@ static int ogg_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
>          granule = pkt->pts + pkt->duration;
>  
>      if (oggstream->page.start_granule == AV_NOPTS_VALUE)
> -        oggstream->page.start_granule = pkt->pts;
> +        oggstream->page.start_granule = granule;
>  
>      ret = ogg_buffer_data(s, st, pkt->data, pkt->size, granule, 0);
>      if (ret < 0)

this breaks fate


--- ./tests/ref/lavf/ogg        2016-07-04 23:15:26.551386870 +0200
+++ tests/data/fate/lavf-ogg    2016-07-08 02:53:19.961122925 +0200
@@ -1,3 +1,3 @@
-81b9366cacb23644c2803585dced9996 *./tests/data/lavf/lavf.ogg
-13516 ./tests/data/lavf/lavf.ogg
+485ac4364e6cd0716ac5a263672f012a *./tests/data/lavf/lavf.ogg
+13517 ./tests/data/lavf/lavf.ogg
 ./tests/data/lavf/lavf.ogg CRC=0x3a1da17e
Test lavf-ogg failed. Look at tests/data/fate/lavf-ogg.err for details.
make: *** [fate-lavf-ogg] Error 1

--- ./tests/ref/fate/limited_input_seek 2016-07-04 23:15:26.527386870 +0200
+++ tests/data/fate/limited_input_seek  2016-07-08 02:48:50.297117244 +0200
@@ -1 +1 @@
-20a1bb9a1cfb23c1fe86f14e6065cd95
+1d387f44f5f61affe0aafac0aa78549f
Test limited_input_seek failed. Look at tests/data/fate/limited_input_seek.err for details.
make: *** [fate-limited_input_seek] Error 1
make: *** Waiting for unfinished jobs....
--- ./tests/ref/fate/limited_input_seek-copyts  2016-07-04 23:15:26.527386870 +0200
+++ tests/data/fate/limited_input_seek-copyts   2016-07-08 02:48:50.305117245 +0200
@@ -1 +1 @@
-ec3604b1954ed80de364b8ef491771ce
+7444da11963c87bf88a5e8e4bc178f8c
Test limited_input_seek-copyts failed. Look at tests/data/fate/limited_input_seek-copyts.err for details.
make: *** [fate-limited_input_seek-copyts] Error 1

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160708/9936b25c/attachment.sig>


More information about the ffmpeg-devel mailing list