mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Correctly free a few FFmpeg resources.
This commit is contained in:
parent
c6f52db194
commit
0ba0dba63d
@ -301,9 +301,9 @@ void MediaEngine::closeContext()
|
||||
if (m_buffer)
|
||||
av_free(m_buffer);
|
||||
if (m_pFrameRGB)
|
||||
av_free(m_pFrameRGB);
|
||||
av_frame_free(&m_pFrameRGB);
|
||||
if (m_pFrame)
|
||||
av_free(m_pFrame);
|
||||
av_frame_free(&m_pFrame);
|
||||
if (m_pIOContext && m_pIOContext->buffer)
|
||||
av_free(m_pIOContext->buffer);
|
||||
if (m_pIOContext)
|
||||
@ -313,10 +313,9 @@ void MediaEngine::closeContext()
|
||||
m_pCodecCtxs.clear();
|
||||
if (m_pFormatCtx)
|
||||
avformat_close_input(&m_pFormatCtx);
|
||||
m_pFrame = 0;
|
||||
m_pFrameRGB = 0;
|
||||
if (m_sws_ctx != NULL)
|
||||
sws_freeContext(m_sws_ctx);
|
||||
m_pIOContext = 0;
|
||||
m_pFormatCtx = 0;
|
||||
#endif
|
||||
m_buffer = 0;
|
||||
}
|
||||
@ -415,6 +414,9 @@ bool MediaEngine::setVideoDim(int width, int height)
|
||||
// Allocate video frame
|
||||
m_pFrame = av_frame_alloc();
|
||||
|
||||
if (m_sws_ctx != NULL) {
|
||||
sws_freeContext(m_sws_ctx);
|
||||
}
|
||||
m_sws_ctx = NULL;
|
||||
m_sws_fmt = -1;
|
||||
updateSwsFormat(GE_CMODE_32BIT_ABGR8888);
|
||||
@ -474,6 +476,7 @@ bool MediaEngine::stepVideo(int videoPixelMode) {
|
||||
m_pFrameRGB->linesize[0] = getPixelFormatBytes(videoPixelMode) * m_desWidth;
|
||||
|
||||
AVPacket packet;
|
||||
av_init_packet(&packet);
|
||||
int frameFinished;
|
||||
bool bGetFrame = false;
|
||||
while (!bGetFrame) {
|
||||
|
Loading…
Reference in New Issue
Block a user