[vlc-commits] Fix deadlock in previous commit (refs #5131)
Rémi Denis-Courmont
git at videolan.org
Sat Aug 6 22:03:25 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 6 23:02:55 2011 +0300| [4a2dc0d5d3248293fba843f794e4b75fc987d35d] | committer: Rémi Denis-Courmont
Fix deadlock in previous commit (refs #5131)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a2dc0d5d3248293fba843f794e4b75fc987d35d
---
include/vlc_aout.h | 1 +
src/audio_output/output.c | 15 +++++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index b3d4954..885e341 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -266,6 +266,7 @@ typedef struct
aout_fifo_t partial; /**< Audio blocks before packetization */
aout_fifo_t fifo; /**< Packetized audio blocks */
mtime_t pause_date; /**< Date when paused or VLC_TS_INVALID */
+ mtime_t time_report; /**< Desynchronization estimate or VLC_TS_INVALID */
unsigned samples; /**< Samples per packet */
bool starving; /**< Whether currently starving (to limit error messages) */
} aout_packet_t;
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 7d12380..83f0601 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -387,6 +387,7 @@ void aout_PacketInit (audio_output_t *aout, aout_packet_t *p, unsigned samples)
aout_FifoInit (aout, &p->partial, aout->format.i_rate);
aout_FifoInit (aout, &p->fifo, aout->format.i_rate);
p->pause_date = VLC_TS_INVALID;
+ p->time_report = VLC_TS_INVALID;
p->samples = samples;
p->starving = true;
}
@@ -405,12 +406,19 @@ static block_t *aout_OutputSlice (audio_output_t *);
void aout_PacketPlay (audio_output_t *aout, block_t *block)
{
aout_packet_t *p = aout_packet (aout);
+ mtime_t time_report;
vlc_mutex_lock (&p->lock);
aout_FifoPush (&p->partial, block);
while ((block = aout_OutputSlice (aout)) != NULL)
aout_FifoPush (&p->fifo, block);
+
+ time_report = p->time_report;
+ p->time_report = VLC_TS_INVALID;
vlc_mutex_unlock (&p->lock);
+
+ if (time_report != VLC_TS_INVALID)
+ aout_TimeReport (aout, mdate () + time_report);
}
void aout_PacketPause (audio_output_t *aout, bool pause, mtime_t date)
@@ -665,14 +673,9 @@ block_t *aout_PacketNext (audio_output_t *p_aout, mtime_t start_date)
"adjusting dates (%"PRId64" us)", delta);
aout_FifoMoveDates (&p->partial, delta);
aout_FifoMoveDates (p_fifo, delta);
+ p->time_report = delta;
}
vlc_mutex_unlock( &p->lock );
- if (!b_can_sleek)
- {
- aout_lock (p_aout);
- aout_TimeReport (p_aout, now + delta);
- aout_unlock (p_aout);
- }
return p_buffer;
out:
vlc_mutex_unlock( &p->lock );
More information about the vlc-commits
mailing list