am 8e7d6263: Merge "Expose average video frame rate via MPEG4Extractor" into honeycomb
* commit '8e7d626385eef104d52aa9080b70395ca840a0cd': Expose average video frame rate via MPEG4Extractor
This commit is contained in:
@@ -1040,8 +1040,23 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
|
|||||||
// have a 4 byte header (0x00 0x00 0x00 0x01) after conversion,
|
// have a 4 byte header (0x00 0x00 0x00 0x01) after conversion,
|
||||||
// and thus will grow by 2 bytes per fragment.
|
// and thus will grow by 2 bytes per fragment.
|
||||||
mLastTrack->meta->setInt32(kKeyMaxInputSize, max_size + 10 * 2);
|
mLastTrack->meta->setInt32(kKeyMaxInputSize, max_size + 10 * 2);
|
||||||
|
|
||||||
*offset += chunk_size;
|
*offset += chunk_size;
|
||||||
|
|
||||||
|
// Calculate average frame rate.
|
||||||
|
const char *mime;
|
||||||
|
CHECK(mLastTrack->meta->findCString(kKeyMIMEType, &mime));
|
||||||
|
if (!strncasecmp("video/", mime, 6)) {
|
||||||
|
size_t nSamples = mLastTrack->sampleTable->countSamples();
|
||||||
|
int64_t durationUs;
|
||||||
|
if (mLastTrack->meta->findInt64(kKeyDuration, &durationUs)) {
|
||||||
|
if (durationUs > 0) {
|
||||||
|
int32_t frameRate = (nSamples * 1000000LL +
|
||||||
|
(durationUs >> 1)) / durationUs;
|
||||||
|
mLastTrack->meta->setInt32(kKeyFrameRate, frameRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user