1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-19 21:04:08 +01:00

Emit EOS when the buffer timestamps go backwards, as well as when a DISCONT buffer arrives. Fixes issue 3721.

This commit is contained in:
David Sansome 2013-06-08 14:31:29 +10:00
parent e7dcac4f15
commit 246e0808d2
2 changed files with 6 additions and 1 deletions

View File

@ -56,6 +56,7 @@ GstEnginePipeline::GstEnginePipeline(GstEngine* engine)
segment_start_received_(false),
emit_track_ended_on_segment_start_(false),
emit_track_ended_on_time_discontinuity_(false),
last_buffer_offset_(0),
eq_enabled_(false),
eq_preamp_(0),
stereo_balance_(0.0f),
@ -720,13 +721,16 @@ bool GstEnginePipeline::HandoffCallback(GstPad*, GstBuffer* buf, gpointer self)
}
if (instance->emit_track_ended_on_time_discontinuity_) {
if (GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DISCONT)) {
if (GST_BUFFER_FLAG_IS_SET(buf, GST_BUFFER_FLAG_DISCONT) ||
GST_BUFFER_OFFSET(buf) < instance->last_buffer_offset_) {
qLog(Debug) << "Buffer discontinuity - emitting EOS";
instance->emit_track_ended_on_time_discontinuity_ = false;
emit instance->EndOfStreamReached(instance->id(), true);
}
}
instance->last_buffer_offset_ = GST_BUFFER_OFFSET(buf);
return true;
}

View File

@ -189,6 +189,7 @@ class GstEnginePipeline : public QObject {
bool segment_start_received_;
bool emit_track_ended_on_segment_start_;
bool emit_track_ended_on_time_discontinuity_;
qint64 last_buffer_offset_;
// Equalizer
bool eq_enabled_;