summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-05-30 14:10:49 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-05-30 14:10:49 +0000
commit5efbf071a5e8ed583c01329864e5b005c7cbf1c7 (patch)
treed65a1b16d2b3432d134e8bcc6fb3f791a4739b8d
parent4e9d5782a0ca46dd114e991be992730d2b72c7b5 (diff)
downloadxine-lib-5efbf071a5e8ed583c01329864e5b005c7cbf1c7.tar.gz
xine-lib-5efbf071a5e8ed583c01329864e5b005c7cbf1c7.tar.bz2
fix race condition in dxr3 encododers:
on_unneeded would be called from decoder's context while frames might still be around in the video_out context CVS patchset: 4987 CVS date: 2003/05/30 14:10:49
-rw-r--r--src/dxr3/video_out_dxr3.c13
-rw-r--r--src/libffmpeg/xine_encoder.c3
2 files changed, 11 insertions, 5 deletions
diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c
index 27ca60d99..ae129b5a8 100644
--- a/src/dxr3/video_out_dxr3.c
+++ b/src/dxr3/video_out_dxr3.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_dxr3.c,v 1.79 2003/05/25 19:00:37 mroi Exp $
+ * $Id: video_out_dxr3.c,v 1.80 2003/05/30 14:10:50 mroi Exp $
*/
/* mpeg1 encoding video out plugin for the dxr3.
@@ -548,11 +548,10 @@ static void dxr3_update_frame_format(vo_driver_t *this_gen, vo_frame_t *frame_ge
if (this->fd_video >= 0) {
close(this->fd_video);
this->fd_video = CLOSED_FOR_DECODER;
+ /* inform the encoder on next frame's arrival */
+ this->need_update = 1;
}
- /* we do not need the mpeg encoders any more */
- if (this->enc) this->enc->on_unneeded(this);
-
/* for mpeg source, we don't have to do much. */
this->video_width = width;
this->video_iheight = height;
@@ -911,6 +910,12 @@ static void dxr3_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
* frame_gen->displayed(frame_gen) ! */
this->enc->on_display_frame(this, frame);
} else {
+ if (this->need_update) {
+ /* we do not need the mpeg encoders any more */
+ if (this->enc && this->enc->on_unneeded)
+ this->enc->on_unneeded(this);
+ this->need_update = 0;
+ }
frame_gen->displayed(frame_gen);
}
}
diff --git a/src/libffmpeg/xine_encoder.c b/src/libffmpeg/xine_encoder.c
index c3b9f692e..dcd8290ff 100644
--- a/src/libffmpeg/xine_encoder.c
+++ b/src/libffmpeg/xine_encoder.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xine_encoder.c,v 1.2 2003/05/28 13:53:03 mroi Exp $
+ * $Id: xine_encoder.c,v 1.3 2003/05/30 14:10:49 mroi Exp $
*/
/* mpeg encoders for the dxr3 video out plugin. */
@@ -307,6 +307,7 @@ static int lavc_on_unneeded(dxr3_driver_t *drv)
}
return 1;
}
+
static int lavc_prepare_frame(lavc_data_t *this, dxr3_driver_t *drv, dxr3_frame_t *frame)
{
int i, j, w2;