am 439fe407
: Merge "Return error from MPEG4Writer stop() if the check on codec specific data failed" into gingerbread
Merge commit '439fe407ff75b2c0fc21c66b430cd76e9f29ac90' into gingerbread-plus-aosp * commit '439fe407ff75b2c0fc21c66b430cd76e9f29ac90': Return error from MPEG4Writer stop() if the check on codec specific data failed
This commit is contained in:
@ -174,6 +174,9 @@ private:
|
|||||||
// value, the user-supplied time scale will be used.
|
// value, the user-supplied time scale will be used.
|
||||||
void setTimeScale();
|
void setTimeScale();
|
||||||
|
|
||||||
|
// Simple validation on the codec specific data
|
||||||
|
status_t checkCodecSpecificData() const;
|
||||||
|
|
||||||
Track(const Track &);
|
Track(const Track &);
|
||||||
Track &operator=(const Track &);
|
Track &operator=(const Track &);
|
||||||
};
|
};
|
||||||
@ -1624,6 +1627,8 @@ status_t MPEG4Writer::Track::threadEntry() {
|
|||||||
|
|
||||||
if (mSampleSizes.empty()) {
|
if (mSampleSizes.empty()) {
|
||||||
err = ERROR_MALFORMED;
|
err = ERROR_MALFORMED;
|
||||||
|
} else if (OK != checkCodecSpecificData()) {
|
||||||
|
err = ERROR_MALFORMED;
|
||||||
}
|
}
|
||||||
mOwner->trackProgressStatus(this, -1, err);
|
mOwner->trackProgressStatus(this, -1, err);
|
||||||
|
|
||||||
@ -1833,6 +1838,27 @@ int64_t MPEG4Writer::Track::getEstimatedTrackSizeBytes() const {
|
|||||||
return mEstimatedTrackSizeBytes;
|
return mEstimatedTrackSizeBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status_t MPEG4Writer::Track::checkCodecSpecificData() const {
|
||||||
|
const char *mime;
|
||||||
|
CHECK(mMeta->findCString(kKeyMIMEType, &mime));
|
||||||
|
if (!strcasecmp(MEDIA_MIMETYPE_AUDIO_AAC, mime) ||
|
||||||
|
!strcasecmp(MEDIA_MIMETYPE_VIDEO_MPEG4, mime) ||
|
||||||
|
!strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mime)) {
|
||||||
|
if (!mCodecSpecificData ||
|
||||||
|
mCodecSpecificDataSize <= 0) {
|
||||||
|
// Missing codec specific data
|
||||||
|
return ERROR_MALFORMED;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (mCodecSpecificData ||
|
||||||
|
mCodecSpecificDataSize > 0) {
|
||||||
|
// Unexepected codec specific data found
|
||||||
|
return ERROR_MALFORMED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
void MPEG4Writer::Track::writeTrackHeader(
|
void MPEG4Writer::Track::writeTrackHeader(
|
||||||
int32_t trackID, bool use32BitOffset) {
|
int32_t trackID, bool use32BitOffset) {
|
||||||
const char *mime;
|
const char *mime;
|
||||||
|
Reference in New Issue
Block a user