[vlc-commits] vout: flush SPU channel on calling thread
Rémi Denis-Courmont
git at videolan.org
Mon Jan 28 21:38:02 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan 27 16:26:20 2019 +0200| [ad90abe6751f1de0ada8b4720d1ab078621fa407] | committer: Rémi Denis-Courmont
vout: flush SPU channel on calling thread
There is a mixture of subpicture-related calls, with some running on
the calling thread, and others running on the video output thread
control loop.
The later may be delayed, depending on other video output thread
processing, sleeping and pending control requests. This leads to a
race condition, and potentially inconsistent ordering of calls on the
SPU instance.
This patch runs vout_FlushSubpictureChannel() directly on the calling
thread and adds a missing check for nonexistent/destroyed SPU.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ad90abe6751f1de0ada8b4720d1ab078621fa407
---
src/video_output/control.h | 1 -
src/video_output/video_output.c | 18 ++++++++----------
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/video_output/control.h b/src/video_output/control.h
index 0bb2c2397b..b6b982289a 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -34,7 +34,6 @@ enum {
VOUT_CONTROL_START,
VOUT_CONTROL_STOP,
#endif
- VOUT_CONTROL_FLUSH_SUBPICTURE, /* integer */
VOUT_CONTROL_CHANGE_FILTERS, /* string */
VOUT_CONTROL_CHANGE_INTERLACE, /* boolean */
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 2e3fad4559..b3fe1faf14 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -267,11 +267,17 @@ int vout_RegisterSubpictureChannel( vout_thread_t *vout )
return channel;
}
+
void vout_FlushSubpictureChannel( vout_thread_t *vout, int channel )
{
- vout_control_PushInteger(&vout->p->control, VOUT_CONTROL_FLUSH_SUBPICTURE,
- channel);
+ vout_thread_sys_t *sys = vout->p;
+
+ vlc_mutex_lock(&sys->spu_lock);
+ if (sys->spu != NULL)
+ spu_ClearChannel(vout->p->spu, channel);
+ vlc_mutex_unlock(&sys->spu_lock);
}
+
void vout_SetSpuHighlight( vout_thread_t *vout,
const vlc_spu_highlight_t *spu_hl )
{
@@ -1185,11 +1191,6 @@ static int ThreadDisplayPicture(vout_thread_t *vout, vlc_tick_t *deadline)
return force_refresh ? VLC_EGENERIC : ret;
}
-static void ThreadFlushSubpicture(vout_thread_t *vout, int channel)
-{
- spu_ClearChannel(vout->p->spu, channel);
-}
-
void vout_ChangePause(vout_thread_t *vout, bool is_paused, vlc_tick_t date)
{
vout_control_Hold(&vout->p->control);
@@ -1478,9 +1479,6 @@ static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
case VOUT_CONTROL_CLEAN:
ThreadStop(vout);
return 1;
- case VOUT_CONTROL_FLUSH_SUBPICTURE:
- ThreadFlushSubpicture(vout, cmd.integer);
- break;
case VOUT_CONTROL_CHANGE_FILTERS:
ThreadChangeFilters(vout, NULL,
cmd.string != NULL ?
More information about the vlc-commits
mailing list