OSDN Git Service

fix vorbis seek error
authorMichael Chen <omxcodec@gmail.com>
Tue, 22 Oct 2013 15:49:05 +0000 (23:49 +0800)
committerMichael Chen <omxcodec@gmail.com>
Tue, 22 Oct 2013 16:06:30 +0000 (00:06 +0800)
vorbis test files:
http://www.vorbis.com/music/
http://www.vorbis.com/music/Epoq-Lepidoptera.ogg
http://www.vorbis.com/music/Hydrate-Kenny_Beltrey.ogg
http://www.vorbis.com/music/Lumme-Badloop.ogg
http://www.vorbis.com/music/Mists_of_Time-4T.ogg
http://www.vorbis.com/music/The_Abyss-4T.ogg

libstagefright/FFmpegExtractor/FFmpegExtractor.cpp

index 431f1b6..885ef21 100644 (file)
@@ -1574,13 +1574,6 @@ retry:
         return ERROR_END_OF_STREAM;
     }
 
-       //FIXME, drop, omxcodec requires a positive timestamp! e.g. vorbis
-    if (pkt.pts < 0) {
-        ALOGW("drop the packet with negative timestamp(pts:%lld)", pkt.pts);
-        av_free_packet(&pkt);
-        goto retry;
-    }
-
     if (seeking) {
         if (pkt.data != flush_pkt.data) {
             av_free_packet(&pkt);
@@ -1612,6 +1605,13 @@ retry:
     if (pkt.pts == AV_NOPTS_VALUE)
         pktTS = pkt.dts;
 
+    //FIXME, drop, omxcodec requires a positive timestamp! e.g. vorbis
+    if (pktTS != AV_NOPTS_VALUE && pktTS < 0) {
+        ALOGW("drop the packet with negative timestamp(pts:%lld)", pktTS);
+        av_free_packet(&pkt);
+        goto retry;
+    }
+
     if (waitKeyPkt) {
         if (!key) {
             ALOGV("drop the non-key packet");