OSDN Git Service

stagefright-plugins: Fix timestamp calculation
authorSteve Kondik <steve@cyngn.com>
Sat, 2 Apr 2016 02:52:04 +0000 (19:52 -0700)
committerSteve Kondik <steve@cyngn.com>
Sat, 2 Apr 2016 02:52:04 +0000 (19:52 -0700)
 * The start time should be added to the calculated PTS or we end up
   with a negative timestamp. Derp?

Change-Id: Id24834ff3e7268dacdcd1d44d6335ece3a62b410

extractor/FFmpegExtractor.cpp

index 3e150bb..9ab9938 100644 (file)
@@ -1525,7 +1525,7 @@ retry:
     }
 
     if (pktTS != AV_NOPTS_VALUE)
-        timeUs = av_rescale_q(pktTS, mStream->time_base, AV_TIME_BASE_Q) - startTimeUs;
+        timeUs = av_rescale_q(pktTS, mStream->time_base, AV_TIME_BASE_Q) + startTimeUs;
     else
         timeUs = SF_NOPTS_VALUE; //FIXME AV_NOPTS_VALUE is negative, but stagefright need positive