am d4760c24: Collect statistical data from authoring engine (second part)
Merge commit 'd4760c243fb129ebda43972c0fadf43a02c9849f' into gingerbread-plus-aosp * commit 'd4760c243fb129ebda43972c0fadf43a02c9849f': Collect statistical data from authoring engine (second part)
This commit is contained in:
@@ -115,12 +115,17 @@ private:
|
|||||||
status_t makeAVCCodecSpecificData(
|
status_t makeAVCCodecSpecificData(
|
||||||
const uint8_t *data, size_t size);
|
const uint8_t *data, size_t size);
|
||||||
void writeOneChunk(bool isAvc);
|
void writeOneChunk(bool isAvc);
|
||||||
void logStatisticalData(bool isAudio);
|
|
||||||
void findMinMaxFrameRates(float *minFps, float *maxFps);
|
// Track authoring progress status
|
||||||
void findMinMaxChunkDurations(int64_t *min, int64_t *max);
|
|
||||||
void trackProgressStatus(int32_t nFrames, int64_t timeUs);
|
void trackProgressStatus(int32_t nFrames, int64_t timeUs);
|
||||||
void initTrackingProgressStatus(MetaData *params);
|
void initTrackingProgressStatus(MetaData *params);
|
||||||
|
|
||||||
|
// Utilities for collecting statistical data
|
||||||
|
void logStatisticalData(bool isAudio);
|
||||||
|
void findMinAvgMaxSampleDurationMs(
|
||||||
|
int32_t *min, int32_t *avg, int32_t *max);
|
||||||
|
void findMinMaxChunkDurations(int64_t *min, int64_t *max);
|
||||||
|
|
||||||
Track(const Track &);
|
Track(const Track &);
|
||||||
Track &operator=(const Track &);
|
Track &operator=(const Track &);
|
||||||
};
|
};
|
||||||
@@ -1184,14 +1189,16 @@ void MPEG4Writer::Track::threadEntry() {
|
|||||||
|
|
||||||
void MPEG4Writer::Track::trackProgressStatus(int32_t nFrames, int64_t timeUs) {
|
void MPEG4Writer::Track::trackProgressStatus(int32_t nFrames, int64_t timeUs) {
|
||||||
LOGV("trackProgressStatus: %d frames and %lld us", nFrames, timeUs);
|
LOGV("trackProgressStatus: %d frames and %lld us", nFrames, timeUs);
|
||||||
if (nFrames % mTrackEveryNumberOfFrames == 0) {
|
if (mTrackEveryNumberOfFrames > 0 &&
|
||||||
|
nFrames % mTrackEveryNumberOfFrames == 0) {
|
||||||
LOGV("Fire frame tracking progress status at frame %d", nFrames);
|
LOGV("Fire frame tracking progress status at frame %d", nFrames);
|
||||||
mOwner->notify(MEDIA_RECORDER_EVENT_INFO,
|
mOwner->notify(MEDIA_RECORDER_EVENT_INFO,
|
||||||
MEDIA_RECORDER_INFO_PROGRESS_FRAME_STATUS,
|
MEDIA_RECORDER_INFO_PROGRESS_FRAME_STATUS,
|
||||||
nFrames);
|
nFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeUs - mPreviousTrackTimeUs >= mTrackEveryTimeDurationUs) {
|
if (mTrackEveryTimeDurationUs > 0 &&
|
||||||
|
timeUs - mPreviousTrackTimeUs >= mTrackEveryTimeDurationUs) {
|
||||||
LOGV("Fire time tracking progress status at %lld us", timeUs);
|
LOGV("Fire time tracking progress status at %lld us", timeUs);
|
||||||
mOwner->notify(MEDIA_RECORDER_EVENT_INFO,
|
mOwner->notify(MEDIA_RECORDER_EVENT_INFO,
|
||||||
MEDIA_RECORDER_INFO_PROGRESS_TIME_STATUS,
|
MEDIA_RECORDER_INFO_PROGRESS_TIME_STATUS,
|
||||||
@@ -1200,21 +1207,28 @@ void MPEG4Writer::Track::trackProgressStatus(int32_t nFrames, int64_t timeUs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MPEG4Writer::Track::findMinMaxFrameRates(float *minFps, float *maxFps) {
|
void MPEG4Writer::Track::findMinAvgMaxSampleDurationMs(
|
||||||
int32_t minSampleDuration = 0x7FFFFFFF;
|
int32_t *min, int32_t *avg, int32_t *max) {
|
||||||
int32_t maxSampleDuration = 0;
|
CHECK(!mSampleInfos.empty());
|
||||||
|
int32_t avgSampleDurationMs = mMaxTimeStampUs / 1000/ mSampleInfos.size();
|
||||||
|
int32_t minSampleDurationMs = 0x7FFFFFFF;
|
||||||
|
int32_t maxSampleDurationMs = 0;
|
||||||
for (List<SttsTableEntry>::iterator it = mSttsTableEntries.begin();
|
for (List<SttsTableEntry>::iterator it = mSttsTableEntries.begin();
|
||||||
it != mSttsTableEntries.end(); ++it) {
|
it != mSttsTableEntries.end(); ++it) {
|
||||||
int32_t sampleDuration = static_cast<int32_t>(it->sampleDuration);
|
int32_t sampleDurationMs = static_cast<int32_t>(it->sampleDuration);
|
||||||
if (sampleDuration > maxSampleDuration) {
|
if (sampleDurationMs > maxSampleDurationMs) {
|
||||||
maxSampleDuration = sampleDuration;
|
maxSampleDurationMs = sampleDurationMs;
|
||||||
} else if (sampleDuration < minSampleDuration) {
|
} else if (sampleDurationMs < minSampleDurationMs) {
|
||||||
minSampleDuration = sampleDuration;
|
minSampleDurationMs = sampleDurationMs;
|
||||||
}
|
}
|
||||||
|
LOGI("sample duration: %d ms", sampleDurationMs);
|
||||||
}
|
}
|
||||||
CHECK(minSampleDuration != 0 && maxSampleDuration != 0);
|
CHECK(minSampleDurationMs != 0);
|
||||||
*minFps = 1000.0 / maxSampleDuration;
|
CHECK(avgSampleDurationMs != 0);
|
||||||
*maxFps = 1000.0 / minSampleDuration;
|
CHECK(maxSampleDurationMs != 0);
|
||||||
|
*min = minSampleDurationMs;
|
||||||
|
*avg = avgSampleDurationMs;
|
||||||
|
*max = maxSampleDurationMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't count the last duration
|
// Don't count the last duration
|
||||||
@@ -1250,16 +1264,18 @@ void MPEG4Writer::Track::logStatisticalData(bool isAudio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (collectStats) {
|
if (collectStats) {
|
||||||
if (isAudio) {
|
LOGI("%s track - duration %lld us, total %d frames",
|
||||||
LOGI("audio track - duration %lld us", mMaxTimeStampUs);
|
isAudio? "audio": "video", mMaxTimeStampUs,
|
||||||
} else {
|
mSampleInfos.size());
|
||||||
float fps = (mSampleInfos.size() * 1000000.0) / mMaxTimeStampUs;
|
int32_t min, avg, max;
|
||||||
float minFps;
|
findMinAvgMaxSampleDurationMs(&min, &avg, &max);
|
||||||
float maxFps;
|
LOGI("min/avg/max sample duration (ms): %d/%d/%d", min, avg, max);
|
||||||
findMinMaxFrameRates(&minFps, &maxFps);
|
if (!isAudio) {
|
||||||
LOGI("video track - duration %lld us", mMaxTimeStampUs);
|
float avgFps = 1000.0 / avg;
|
||||||
|
float minFps = 1000.0 / max;
|
||||||
|
float maxFps = 1000.0 / min;
|
||||||
LOGI("min/avg/max frame rate (fps): %.2f/%.2f/%.2f",
|
LOGI("min/avg/max frame rate (fps): %.2f/%.2f/%.2f",
|
||||||
minFps, fps, maxFps);
|
minFps, avgFps, maxFps);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t totalBytes = 0;
|
int64_t totalBytes = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user