aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/oggparsevorbis.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-04 22:45:57 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-05 00:00:40 +0200
commitfe5c5bccce4afa5d70306151c3d9e76f68157b66 (patch)
tree8c70bfa2b45aef3b9029586964cdc04e85fa2531 /libavformat/oggparsevorbis.c
parent1f95ad48ff158ac3a7419efc98e9153a4fac1dc6 (diff)
downloadffmpeg-fe5c5bccce4afa5d70306151c3d9e76f68157b66.tar.gz
oggvorbisdec: Apply timestamp calculation always when timestamps arent known.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggparsevorbis.c')
-rw-r--r--libavformat/oggparsevorbis.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 57af4a1807..02da12799d 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -296,7 +296,7 @@ static int vorbis_packet(AVFormatContext *s, int idx)
here we parse the duration of each packet in the first page and compare
the total duration to the page granule to find the encoder delay and
set the first timestamp */
- if (!os->lastpts) {
+ if ((!os->lastpts || os->lastpts == AV_NOPTS_VALUE) && !(os->flags & OGG_FLAG_EOS)) {
int seg, d;
uint8_t *last_pkt = os->buf + os->pstart;
uint8_t *next_pkt = last_pkt;
@@ -324,9 +324,11 @@ static int vorbis_packet(AVFormatContext *s, int idx)
next_pkt += os->segments[seg];
}
os->lastpts = os->lastdts = os->granule - duration;
- s->streams[idx]->start_time = os->lastpts;
- if (s->streams[idx]->duration)
- s->streams[idx]->duration -= s->streams[idx]->start_time;
+ if(s->streams[idx]->start_time == AV_NOPTS_VALUE) {
+ s->streams[idx]->start_time = os->lastpts;
+ if (s->streams[idx]->duration)
+ s->streams[idx]->duration -= s->streams[idx]->start_time;
+ }
priv->final_pts = AV_NOPTS_VALUE;
avpriv_vorbis_parse_reset(&priv->vp);
}