Fix leaks and read the webvtt magic cookie from mp4.

This commit is contained in:
Damiano Galassi committed 2016-02-18 13:25:40 +01:00
1 parent 5ba205be44
commit a33fcd02a0
5 files changed
+31 -5

No files matched your search

+1 -1
View File
@@ -926,7 +926,7 @@
int pos = 0;
for (int i = 0; i < samplesNum; i++) {
CMSampleTimingInfo sampleTimingInfo;
CMTime decodeTimeStamp;
__unused CMTime decodeTimeStamp;
CMTime presentationTimeStamp;
CMTime presentationOutputTimeStamp = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer);
+1 -1
View File
@@ -75,8 +75,8 @@ extern u_int8_t MP4AV_AacConfigGetChannels(u_int8_t* pConfig);
uint8_t *ppValue;
uint32_t pValueSize;
MP4GetTrackBytesProperty(fileHandle, _trackId, "mdia.minf.stbl.stsd.ec-3.dec3.content", &ppValue, &pValueSize);
readEAC3Config(ppValue, pValueSize, &_channels, &_channelLayoutTag);
free(ppValue);
}
else if (MP4HaveTrackAtom(fileHandle, _trackId, "mdia.minf.stbl.stsd.alac")) {
uint64_t channels_count = 0;
+11 -1
View File
@@ -649,6 +649,7 @@ int analyze_EAC3(void **context ,uint8_t *frame, uint32_t size)
if (!info->ec3_done) {
/* AC-3 substream must be the first one */
if (hdr->bitstream_id <= 10 && hdr->substreamid != 0) {
free(hdr);
return -1;
}
@@ -657,11 +658,13 @@ int analyze_EAC3(void **context ,uint8_t *frame, uint32_t size)
if (hdr->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) {
/* substream ids must be incremental */
if (hdr->substreamid > info->num_ind_sub + 1) {
free(hdr);
return -1;
}
if (hdr->substreamid == info->num_ind_sub + 1) {
//info->num_ind_sub++;
free(hdr);
return -1;
} else if (hdr->substreamid < info->num_ind_sub ||
(hdr->substreamid == 0 && info->substream[0].bsid)) {
@@ -720,6 +723,8 @@ int analyze_EAC3(void **context ,uint8_t *frame, uint32_t size)
concatenate:
free(hdr);
if (!info->num_blocks && num_blocks == 6) {
return size;
}
@@ -790,5 +795,10 @@ CFDataRef createCookie_EAC3(void *context)
free(info->frame);
return CFDataCreate(kCFAllocatorDefault, cookie.GetBuffer(), cookie.GetBitPosition() / 8);
uint8_t *buffer = cookie.GetBuffer();
size_t size = cookie.GetBitPosition() / 8;
CFDataRef cookieData = CFDataCreate(kCFAllocatorDefault, buffer, size);
free (buffer);
return cookieData;
}
+16
View File
@@ -112,6 +112,7 @@
uint32_t pValueSize;
MP4GetTrackBytesProperty(_fileHandle, srcTrackId, "mdia.minf.stbl.stsd.ec-3.dec3.content", &ppValue, &pValueSize);
magicCookie = [NSData dataWithBytes:ppValue length:pValueSize];
free(ppValue);
}
}
else if (!strcmp(media_data_name, "alac")) {
@@ -120,6 +121,7 @@
uint32_t pValueSize;
MP4GetTrackBytesProperty(_fileHandle, srcTrackId, "mdia.minf.stbl.stsd.alac.alac.AppleLosslessMagicCookie", &ppValue, &pValueSize);
magicCookie = [NSData dataWithBytes:ppValue length:pValueSize];
free(ppValue);
}
}
else {
@@ -233,6 +235,20 @@
}
}
else if ((!strcasecmp(trackType, MP4_TEXT_TRACK_TYPE))) {
if (!strcmp(media_data_name, "wvtt")) {
if (MP4HaveTrackAtom(_fileHandle, srcTrackId, "mdia.minf.stbl.stsd.wvtt.vttC")) {
uint8_t *ppValue;
uint32_t pValueSize;
MP4GetTrackBytesProperty(_fileHandle, srcTrackId, "mdia.minf.stbl.stsd.wvtt.vttC.config", &ppValue, &pValueSize);
magicCookie = [NSData dataWithBytes:ppValue length:pValueSize];
free(ppValue);
return magicCookie;
}
}
}
return nil;
}