我通过以下两种方式使用 av_read_frame :
1.
for(;;){
if (av_read_frame(pFormatCtx, packet) >= 0){
av_packet_unref(packet);
}
}
Run Code Online (Sandbox Code Playgroud)
2.
for(;;){
packet = av_packet_alloc();
if (av_read_frame(pFormatCtx, packet) >= 0){
av_packet_free(&packet);
}
}
Run Code Online (Sandbox Code Playgroud)
注意除了读取文件和使用 FFMPEG API 调用免费方法外,还要执行其他操作。两者都有内存泄漏问题。(1.72GB 电影文件获得了 300MB 内存增量)有人得到了 rosulation 吗?