[FFmpeg-cvslog] oggvorbis: move handling of first packets ts from parser to muxer.

Michael Niedermayer git at videolan.org
Sat May 5 02:07:45 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat May  5 01:41:54 2012 +0200| [441dce21699f5780a7d9309451149ab876d641dc] | committer: Michael Niedermayer

oggvorbis: move handling of first packets ts from parser to muxer.

The parser does not have enough knowledge it seems to do it
correctly.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=441dce21699f5780a7d9309451149ab876d641dc
---

 libavcodec/vorbis_parser.c   |    3 +--
 libavformat/oggparsevorbis.c |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/vorbis_parser.c b/libavcodec/vorbis_parser.c
index d1f0838..a0468cb 100644
--- a/libavcodec/vorbis_parser.c
+++ b/libavcodec/vorbis_parser.c
@@ -226,8 +226,7 @@ int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf,
             previous_blocksize = s->blocksize[flag];
         }
         current_blocksize     = s->mode_blocksize[mode];
-        if(previous_blocksize)
-            duration              = (previous_blocksize + current_blocksize) >> 2;
+        duration              = (previous_blocksize + current_blocksize) >> 2;
         s->previous_blocksize = current_blocksize;
     }
 
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 02da127..fa03ed7 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -323,7 +323,7 @@ static int vorbis_packet(AVFormatContext *s, int idx)
             }
             next_pkt += os->segments[seg];
         }
-        os->lastpts = os->lastdts   = os->granule - duration;
+        os->lastpts = os->lastdts   = os->granule - FFMIN(duration, os->granule);
         if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
             s->streams[idx]->start_time = os->lastpts;
             if (s->streams[idx]->duration)



More information about the ffmpeg-cvslog mailing list