mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-16 07:50:28 +02:00
Mpeg: Close codecs from new streams.
These were actually leaking.
This commit is contained in:
1 parent
3cd882f21b
commit
94bab4506f
2 files changed
+12
No files matched your search
@@ -380,6 +380,11 @@ void MediaEngine::closeContext()
|
||||
#endif
|
||||
}
|
||||
m_pCodecCtxs.clear();
|
||||
// These are streams allocated from avformat_new_stream.
|
||||
for (auto it : m_codecsToClose) {
|
||||
avcodec_close(it);
|
||||
}
|
||||
m_codecsToClose.clear();
|
||||
if (m_pFormatCtx)
|
||||
avformat_close_input(&m_pFormatCtx);
|
||||
sws_freeContext(m_sws_ctx);
|
||||
@@ -439,6 +444,8 @@ bool MediaEngine::addVideoStream(int streamNum, int streamId) {
|
||||
if (streamNum >= m_expectedVideoStreams) {
|
||||
++m_expectedVideoStreams;
|
||||
}
|
||||
|
||||
m_codecsToClose.push_back(stream->codec);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,4 +144,9 @@ public: // TODO: Very little of this below should be public.
|
||||
|
||||
// used for audio type
|
||||
int m_audioType;
|
||||
|
||||
private:
|
||||
#ifdef USE_FFMPEG
|
||||
std::vector<AVCodecContext *> m_codecsToClose;
|
||||
#endif
|
||||
};
|
||||
Reference in new issue
Block a user