Skip to content

Commit

Permalink
Merge "MediaMuxer:SetCaptureRate for GCA SlowMotionRecord" into qt-r1…
Browse files Browse the repository at this point in the history
…-dev

am: 9c6f37f

Change-Id: Iff65726f4a2df4a3ba9daac9be641c64c74d129a
  • Loading branch information
Gopalakrishnan Nallasamy authored and android-build-merger committed Aug 14, 2019
2 parents d2cd628 + 9c6f37f commit 5f55524
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
7 changes: 6 additions & 1 deletion media/libstagefright/MPEG4Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1635,8 +1635,13 @@ status_t MPEG4Writer::setCaptureRate(float captureFps) {
return BAD_VALUE;
}

// Increase moovExtraSize once only irrespective of how many times
// setCaptureRate is called.
bool containsCaptureFps = mMetaKeys->contains(kMetaKey_CaptureFps);
mMetaKeys->setFloat(kMetaKey_CaptureFps, captureFps);
mMoovExtraSize += sizeof(kMetaKey_CaptureFps) + 4 + 32;
if (!containsCaptureFps) {
mMoovExtraSize += sizeof(kMetaKey_CaptureFps) + 4 + 32;
}

return OK;
}
Expand Down
14 changes: 11 additions & 3 deletions media/libstagefright/MediaMuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,18 @@ ssize_t MediaMuxer::addTrack(const sp<AMessage> &format) {

sp<MediaAdapter> newTrack = new MediaAdapter(trackMeta);
status_t result = mWriter->addSource(newTrack);
if (result == OK) {
return mTrackList.add(newTrack);
if (result != OK) {
return -1;
}
float captureFps = -1.0;
if (format->findAsFloat("time-lapse-fps", &captureFps)) {
ALOGV("addTrack() time-lapse-fps: %f", captureFps);
result = mWriter->setCaptureRate(captureFps);
if (result != OK) {
ALOGW("addTrack() setCaptureRate failed :%d", result);
}
}
return -1;
return mTrackList.add(newTrack);
}

status_t MediaMuxer::setOrientationHint(int degrees) {
Expand Down
4 changes: 4 additions & 0 deletions media/libstagefright/include/media/stagefright/MediaWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ struct MediaWriter : public RefBase {
virtual status_t start(MetaData *params = NULL) = 0;
virtual status_t stop() = 0;
virtual status_t pause() = 0;
virtual status_t setCaptureRate(float /* captureFps */) {
ALOGW("setCaptureRate unsupported");
return ERROR_UNSUPPORTED;
}

virtual void setMaxFileSize(int64_t bytes) { mMaxFileSizeLimitBytes = bytes; }
virtual void setMaxFileDuration(int64_t durationUs) { mMaxFileDurationLimitUs = durationUs; }
Expand Down

0 comments on commit 5f55524

Please sign in to comment.