for (auto& i: _next_time) {
i.second = boost::optional<dcpomatic::ContentTime>();
}
+
+ /* We find that we get some errors from av_send_packet after a seek. Perhaps we should ignore
+ * all of them (which seems risky), or perhaps we should have some proper fix. But instead
+ * let's ignore the next 2 errors.
+ */
+ _errors_to_ignore = 2;
}
/* We could cope with AVERROR(EAGAIN) and re-send the packet but I think it should never happen.
* Likewise I think AVERROR_EOF should not happen.
*/
+ if (_errors_to_ignore > 0) {
+ /* We see errors here after a seek, which is hopefully to be nothing to worry about */
+ --_errors_to_ignore;
+ LOG_GENERAL("Ignoring error %1 avcodec_send_packet after seek; will ignore %2 more", r, _errors_to_ignore);
+ return;
+ }
throw DecodeError (N_("avcodec_send_packet"), N_("FFmpegDecoder::decode_and_process_audio_packet"), r);
}
return;
}
+ auto sub_period = subtitle_period (packet, ffmpeg_content()->subtitle_stream()->stream(_format_context), sub);
+
/* Stop any current subtitle, either at the time it was supposed to stop, or now if now is sooner */
if (_have_current_subtitle) {
if (_current_subtitle_to) {
- only_text()->emit_stop (min(*_current_subtitle_to, subtitle_period(sub).from + _pts_offset));
+ only_text()->emit_stop (min(*_current_subtitle_to, sub_period.from + _pts_offset));
} else {
- only_text()->emit_stop (subtitle_period(sub).from + _pts_offset);
+ only_text()->emit_stop (sub_period.from + _pts_offset);
}
_have_current_subtitle = false;
}
if (sub.num_rects <= 0) {
/* Nothing new in this subtitle */
+ avsubtitle_free (&sub);
return;
}
/* Subtitle PTS (within the source, not taking into account any of the
source that we may have chopped off for the DCP).
*/
- auto sub_period = subtitle_period (sub);
ContentTime from;
from = sub_period.from + _pts_offset;
if (sub_period.to) {