diff options
author | James Dong <jdong@google.com> | 2013-03-12 10:40:20 -0700 |
---|---|---|
committer | ztenghui <ztenghui@google.com> | 2013-03-14 10:47:31 -0700 |
commit | acc47642e0f5d962f6289e6ba687fabf68f8312b (patch) | |
tree | 89ab28931ecc78bb3c09d0c4d056c3c280a35eec /media/libstagefright/MediaMuxer.cpp | |
parent | 70369845f8250df4f6f22c336414b4df0a3ce53e (diff) | |
download | frameworks_av-acc47642e0f5d962f6289e6ba687fabf68f8312b.zip frameworks_av-acc47642e0f5d962f6289e6ba687fabf68f8312b.tar.gz frameworks_av-acc47642e0f5d962f6289e6ba687fabf68f8312b.tar.bz2 |
Make limitations of MPEG4Writer explicit
o No more than 2 tracks will be supported
o No more than one video and/or one audio tracks will be supported
o Only take video and/or audio track (for instance, no text tracks)
o If there is no track before start() is called, bail out.
At the same time, make sure the errors from addSource() report to
addTrack(), not to start().
Bug: 7991013
Change-Id: I1ca35aaeb75b5448d75ed2c6c10dd12ecea720ab
Diffstat (limited to 'media/libstagefright/MediaMuxer.cpp')
-rw-r--r-- | media/libstagefright/MediaMuxer.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/media/libstagefright/MediaMuxer.cpp b/media/libstagefright/MediaMuxer.cpp index aefc270..21841b3 100644 --- a/media/libstagefright/MediaMuxer.cpp +++ b/media/libstagefright/MediaMuxer.cpp @@ -76,17 +76,17 @@ ssize_t MediaMuxer::addTrack(const sp<AMessage> &format) { convertMessageToMetaData(format, meta); sp<MediaAdapter> newTrack = new MediaAdapter(meta); - return mTrackList.add(newTrack); + status_t result = mWriter->addSource(newTrack); + if (result == OK) { + return mTrackList.add(newTrack); + } + return -1; } status_t MediaMuxer::start() { Mutex::Autolock autoLock(mMuxerLock); - if (mState == INITED) { mState = STARTED; - for (size_t i = 0 ; i < mTrackList.size(); i++) { - mWriter->addSource(mTrackList[i]); - } return mWriter->start(); } else { ALOGE("start() is called in invalid state %d", mState); @@ -100,7 +100,9 @@ status_t MediaMuxer::stop() { if (mState == STARTED) { mState = STOPPED; for (size_t i = 0; i < mTrackList.size(); i++) { - mTrackList[i]->stop(); + if (mTrackList[i]->stop() != OK) { + return INVALID_OPERATION; + } } return mWriter->stop(); } else { |