if (!encode && !ptr) {
TRACE("allocate a buffer for a decoded picture.\n");
- ptr = av_mallocz(fsize);
+ ptr = g_malloc(fsize);
if (!ptr) {
ERR("[%d] failed to allocate memory.\n", __LINE__);
return -1;
tempbuf = g_malloc(tempbuf_size);
if (!tempbuf) {
ERR("failed to allocate decoded audio buffer\n");
- // FIXME: how to handle this case?
+ tempbuf_size = 0;
} else {
struct video_data video;
AVCodecContext *avctx = NULL;
AVPicture *src = NULL;
AVPicture dst;
- uint8_t *out_buffer = NULL, *tempbuf = NULL;
+ uint8_t *tempbuf = NULL;
int pict_size = 0;
bool ret = true;
av_picture_copy(&dst, src, avctx->pix_fmt,
avctx->width, avctx->height);
- tempbuf = g_malloc0(pict_size);
- if (!tempbuf) {
- ERR("failed to allocate a picture buffer. size: %d\n", pict_size);
- } else {
- out_buffer = dst.data[0];
- memcpy(tempbuf, out_buffer, pict_size);
- }
- av_free(out_buffer);
+ tempbuf = dst.data[0];
}
}