Browse Source

swr: limit buffer size for silence injection

This reduces memory usage for unreasonable large silence injections

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n1.2
Michael Niedermayer 12 years ago
parent
commit
a34aee4646
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      libswresample/swresample.c

+ 7
- 0
libswresample/swresample.c View File

@@ -818,6 +818,13 @@ int swr_inject_silence(struct SwrContext *s, int count){
if(count <= 0)
return 0;

#define MAX_SILENCE_STEP 16384
while (count > MAX_SILENCE_STEP) {
if ((ret = swr_inject_silence(s, MAX_SILENCE_STEP)) < 0)
return ret;
count -= MAX_SILENCE_STEP;
}

if((ret=swri_realloc_audio(&s->silence, count))<0)
return ret;



Loading…
Cancel
Save