提交 ee35321e 编写于 作者: Z Zhang Rui

ijkplayer: do not use ffmpeg's heap alloc/free outside of ff_ffplay

上级 2b08b7da
......@@ -47,9 +47,9 @@ inline static void ijkmp_destroy(IjkMediaPlayer *mp)
pthread_mutex_destroy(&mp->mutex);
av_freep(&mp->data_source);
freep((void**)&mp->data_source);
memset(mp, 0, sizeof(IjkMediaPlayer));
av_freep(&mp);
freep((void**)&mp);
}
inline static void ijkmp_destroy_p(IjkMediaPlayer **pmp)
......@@ -101,7 +101,7 @@ void ijkmp_change_state_l(IjkMediaPlayer *mp, int new_state)
IjkMediaPlayer *ijkmp_create(int (*msg_loop)(void*))
{
IjkMediaPlayer *mp = (IjkMediaPlayer *) av_mallocz(sizeof(IjkMediaPlayer));
IjkMediaPlayer *mp = (IjkMediaPlayer *) mallocz(sizeof(IjkMediaPlayer));
if (!mp)
goto fail;
......@@ -336,8 +336,8 @@ static int ijkmp_set_data_source_l(IjkMediaPlayer *mp, const char *url)
MPST_RET_IF_EQ(mp->mp_state, MP_STATE_ERROR);
MPST_RET_IF_EQ(mp->mp_state, MP_STATE_END);
av_freep(&mp->data_source);
mp->data_source = av_strdup(url);
freep((void**)&mp->data_source);
mp->data_source = strdup(url);
if (!mp->data_source)
return EIJK_OUT_OF_MEMORY;
......
......@@ -77,16 +77,16 @@
size_t out_size = (in_size + 1) * 3 / 4 + 1;
if (out_size > INT_MAX || !(utf8Plain = av_mallocz(out_size)))
if (out_size > INT_MAX || !(utf8Plain = malloc(out_size)))
return NULL;
if ((ret = av_base64_decode(utf8Plain, utf8Cipher, (int)out_size)) < 0) {
av_free(utf8Plain);
free(utf8Plain);
NSLog(@"Invalid base64 in MRL\n");
return NULL;
}
NSString *plain = [[NSString alloc] initWithUTF8String:(const char *)utf8Plain];
av_free(utf8Plain);
free(utf8Plain);
return plain;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册