Commit 4a5d8ead authored by Simon Morlat's avatar Simon Morlat

fix crash in msopus, when using ptime=100.

parent 52cc9572
......@@ -179,7 +179,7 @@ static void ms_opus_enc_process(MSFilter *f) {
int max_frame_byte_size, ptime = 20;
int frame_count = 0, frame_size = 0;
opus_int32 total_length = 0;
uint8_t *repacketizer_frame_buffer[MAX_INPUT_FRAMES];
uint8_t *repacketizer_frame_buffer[MAX_INPUT_FRAMES] = {NULL};
int i;
ms_filter_lock(f);
ptime = d->ptime;
......@@ -228,9 +228,6 @@ static void ms_opus_enc_process(MSFilter *f) {
d->pcmbuffer = ms_malloc(pcm_buffer_size);
d->pcmbufsize = pcm_buffer_size;
}
for (i=0; i<MAX_INPUT_FRAMES; i++) {
repacketizer_frame_buffer[i]=NULL;
}
ms_bufferizer_put_from_queue(d->bufferizer, f->inputs[0]);
while (ms_bufferizer_get_avail(d->bufferizer) >= (size_t)(d->channels * packet_size * SIGNAL_SAMPLE_SIZE)) {
......@@ -292,11 +289,6 @@ static void ms_opus_enc_process(MSFilter *f) {
om->b_wptr += ret;
}
opus_repacketizer_destroy(repacketizer);
for (i=0; i<frame_count; i++) {
if (repacketizer_frame_buffer[i] != NULL) {
ms_free(repacketizer_frame_buffer[i]);
}
}
}
if(om) { /* we have an encoded output message */
......@@ -307,6 +299,12 @@ static void ms_opus_enc_process(MSFilter *f) {
total_length = 0;
}
}
for (i=0; i<frame_count; i++) {
if (repacketizer_frame_buffer[i] != NULL) {
ms_free(repacketizer_frame_buffer[i]);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment