diff options
| author | 2010-08-23 12:01:07 -0700 | |
|---|---|---|
| committer | 2010-08-23 12:01:07 -0700 | |
| commit | 37e2592f282d513d40227e027e1b1d3815c98033 (patch) | |
| tree | 2bc9178e476ec1206504bd1c00f2df93809123ec | |
| parent | a75d87ffc4a967382bac6fddb698bcec66397447 (diff) | |
| parent | 3540760d1d68cc883122d44ab1d38f542fb646e6 (diff) | |
am 3540760d: am 0ea4ed3b: Don\'t drop a late frame which may lead to missing I frames in the MP4 file
Merge commit '3540760d1d68cc883122d44ab1d38f542fb646e6'
* commit '3540760d1d68cc883122d44ab1d38f542fb646e6':
Don't drop a late frame which may lead to missing I frames in the MP4 file
| -rw-r--r-- | media/libstagefright/MPEG4Writer.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp index 0d0a998921d5..568037e65c41 100644 --- a/media/libstagefright/MPEG4Writer.cpp +++ b/media/libstagefright/MPEG4Writer.cpp @@ -1524,10 +1524,24 @@ status_t MPEG4Writer::Track::threadEntry() { CHECK(timestampUs >= 0); if (mNumSamples > 1) { if (timestampUs <= lastTimestampUs) { - LOGW("Drop a frame, since it arrives too late!"); + LOGW("Frame arrives too late!"); +#if 0 + // Drop the late frame. copy->release(); copy = NULL; continue; +#else + // Don't drop the late frame, since dropping a frame may cause + // problems later during playback + + // The idea here is to avoid having two or more samples with the + // same timestamp in the output file. + if (mTimeScale >= 1000000LL) { + timestampUs += 1; + } else { + timestampUs += (1000000LL + (mTimeScale >> 1)) / mTimeScale; + } +#endif } } |