diff options
author | Markus Pfau <pfau@peak3d.de> | 2019-02-07 14:33:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-07 14:33:23 +0100 |
commit | 8e2325f0431029d963f279080deb48911529a2f4 (patch) | |
tree | 02b94d014db5abab14002eba14b560a046cc5849 | |
parent | c2c06e2b40791224735a463993376eeff7477d98 (diff) | |
parent | a247722dd3844c23a4f58bf3ed78e7b4e3b1e33e (diff) |
Merge pull request #15455 from peak3d/eof
[Android] Fix MediaCodec freeze when early disposing stream
-rw-r--r-- | xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp index ae6087fb86..d66e66b31c 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecAndroidMediaCodec.cpp @@ -766,15 +766,15 @@ void CDVDVideoCodecAndroidMediaCodec::Dispose() if (!m_opened) return; + // invalidate any inflight outputbuffers + FlushInternal(); + if (m_videoBufferPool) { m_videoBufferPool->ResetMediaCodec(); m_videoBufferPool = nullptr; } - // invalidate any inflight outputbuffers - FlushInternal(); - m_videobuffer.iFlags = 0; if (m_codec->codec()) @@ -1054,6 +1054,9 @@ void CDVDVideoCodecAndroidMediaCodec::FlushInternal() { // invalidate any existing inflight buffers and create // new ones to match the number of output buffers + if (m_indexInputBuffer >=0) + AMediaCodec_queueInputBuffer(m_codec->codec(), m_indexInputBuffer, 0, 0, 0, AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM); + m_OutputDuration = 0; m_lastPTS = -1; m_dtsShift = DVD_NOPTS_VALUE; @@ -1164,8 +1167,7 @@ int CDVDVideoCodecAndroidMediaCodec::GetOutputPicture(void) return -1; } - int flags = bufferInfo.flags; - if (flags & AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) + if (bufferInfo.flags & AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) { CLog::Log(LOGDEBUG, "CDVDVideoCodecAndroidMediaCodec:: BUFFER_FLAG_END_OF_STREAM"); AMediaCodec_releaseOutputBuffer(m_codec->codec(), index, false); |