summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2011-08-25 22:06:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-26 17:08:46 +0200
commit0a1cf6621067c4a85b519c8cad5c345c29017f89 (patch)
tree5dea8f78e89f47d2a372c76295483ccd6a065b45
parent8af9366e2f309f5af43dc5e0ae67de05330b699a (diff)
ffplay: fix a crash caused by aborting the video queue
If the video queue is aborted, we have to pop the pending ALLOC event or wait for the allocation to complete, because the current code assumes that VideoState->pictq_windex does not change until the allocation is complete. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--ffplay.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ffplay.c b/ffplay.c
index 8d22b48ae5..27dda94e20 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1356,6 +1356,12 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
while (!vp->allocated && !is->videoq.abort_request) {
SDL_CondWait(is->pictq_cond, is->pictq_mutex);
}
+ /* if the queue is aborted, we have to pop the pending ALLOC event or wait for the allocation to complete */
+ if (is->videoq.abort_request && SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_EVENTMASK(FF_ALLOC_EVENT)) != 1) {
+ while (!vp->allocated) {
+ SDL_CondWait(is->pictq_cond, is->pictq_mutex);
+ }
+ }
SDL_UnlockMutex(is->pictq_mutex);
if (is->videoq.abort_request)