Browse Source

check for coded_frame allocation failure in several audio encoders

tags/n0.11
Justin Ruggles 14 years ago
parent
commit
a8bdf2405c
7 changed files with 17 additions and 0 deletions
  1. +4
    -0
      libavcodec/libgsm.c
  2. +3
    -0
      libavcodec/libopencore-amr.c
  3. +2
    -0
      libavcodec/libvo-aacenc.c
  4. +2
    -0
      libavcodec/libvo-amrwbenc.c
  5. +2
    -0
      libavcodec/mpegaudioenc.c
  6. +2
    -0
      libavcodec/pcm.c
  7. +2
    -0
      libavcodec/roqaudioenc.c

+ 4
- 0
libavcodec/libgsm.c View File

@@ -70,6 +70,10 @@ static av_cold int libgsm_encode_init(AVCodecContext *avctx) {
}

avctx->coded_frame= avcodec_alloc_frame();
if (!avctx->coded_frame) {
gsm_destroy(avctx->priv_data);
return AVERROR(ENOMEM);
}

return 0;
}


+ 3
- 0
libavcodec/libopencore-amr.c View File

@@ -196,10 +196,13 @@ static av_cold int amr_nb_encode_init(AVCodecContext *avctx)

avctx->frame_size = 160;
avctx->coded_frame = avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);

s->enc_state = Encoder_Interface_init(s->enc_dtx);
if (!s->enc_state) {
av_log(avctx, AV_LOG_ERROR, "Encoder_Interface_init error\n");
av_freep(&avctx->coded_frame);
return -1;
}



+ 2
- 0
libavcodec/libvo-aacenc.c View File

@@ -39,6 +39,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
int index;

avctx->coded_frame = avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);
avctx->frame_size = 1024;

voGetAACEncAPI(&s->codec_api);


+ 2
- 0
libavcodec/libvo-amrwbenc.c View File

@@ -87,6 +87,8 @@ static av_cold int amr_wb_encode_init(AVCodecContext *avctx)

avctx->frame_size = 320;
avctx->coded_frame = avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);

s->state = E_IF_init();



+ 2
- 0
libavcodec/mpegaudioenc.c View File

@@ -181,6 +181,8 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
}

avctx->coded_frame= avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);

return 0;
}


+ 2
- 0
libavcodec/pcm.c View File

@@ -49,6 +49,8 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx)
avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8;
avctx->coded_frame= avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);

return 0;
}


+ 2
- 0
libavcodec/roqaudioenc.c View File

@@ -59,6 +59,8 @@ static av_cold int roq_dpcm_encode_init(AVCodecContext *avctx)
context->lastSample[0] = context->lastSample[1] = 0;

avctx->coded_frame= avcodec_alloc_frame();
if (!avctx->coded_frame)
return AVERROR(ENOMEM);

return 0;
}


Loading…
Cancel
Save