summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Scheel <julian@jusst.de>2010-03-30 18:04:26 +0200
committerJulian Scheel <julian@jusst.de>2010-03-30 18:04:26 +0200
commit17c987052ea86328f2dd27b52b3fc9518f500ad8 (patch)
tree0bd08051c4b002f71ff3f5d7253c0015be39b30e
parent795080b868d41b4a970ba195cb1b1a1ce6089024 (diff)
downloadxine-lib-17c987052ea86328f2dd27b52b3fc9518f500ad8.tar.gz
xine-lib-17c987052ea86328f2dd27b52b3fc9518f500ad8.tar.bz2
fix potential deadlock on h264 playback
- free vo_frames as early as possible to avoid dead-locks, due to unnecesarily locked frames - ensure that dpb does not exceed given max size --HG-- extra : rebase_source : 107db4ccde8907bba161d3cfd3f964847343664e
-rw-r--r--src/video_dec/libvdpau/dpb.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/video_dec/libvdpau/dpb.c b/src/video_dec/libvdpau/dpb.c
index e25657b8e..13b9a3329 100644
--- a/src/video_dec/libvdpau/dpb.c
+++ b/src/video_dec/libvdpau/dpb.c
@@ -93,7 +93,10 @@ void lock_decoded_picture(struct decoded_picture *pic)
void free_decoded_picture(struct decoded_picture *pic)
{
- pic->img->free(pic->img);
+ if(pic->img != NULL) {
+ pic->img->free(pic->img);
+ }
+
free_coded_picture(pic->coded_pic[1]);
free_coded_picture(pic->coded_pic[0]);
pic->coded_pic[0] = NULL;
@@ -363,6 +366,11 @@ int dpb_set_output_picture(struct dpb *dpb, struct decoded_picture *outpic)
return -1;
outpic->delayed_output = 0;
+ if(outpic->img != NULL) {
+ outpic->img->free(outpic->img);
+ outpic->img = NULL;
+ }
+
if(!outpic->used_for_reference)
dpb_remove_picture(dpb, outpic);
@@ -458,6 +466,13 @@ int dpb_add_picture(struct dpb *dpb, struct decoded_picture *pic, uint32_t num_r
last_pic = pic;
}
} while (pic != NULL && (pic = pic->next) != NULL);
+
+ /* if all pictured in dpb are marked as delayed for output
+ * we need to drop a not yet drawn image. take the oldest one
+ */
+ if(!discard_ref) {
+ discard_ref = dpb->pictures;
+ }
}
if(discard_ref != NULL) {