{
buf->s.start = stream->next_pts;
buf->s.stop = stream->next_pts + buf->s.duration;
+ stream->next_pts += buf->s.duration;
+ }
+ else
+ {
+ // Last ditch effort to prevent timestamps from going backwards
+ // This can (and should only) affect subtitle streams.
+ if (buf->s.start < stream->next_pts)
+ {
+ buf->s.start = stream->next_pts;
+ }
+ stream->next_pts = buf->s.start;
}
-
- stream->next_pts += buf->s.duration;
if (buf->s.stop > 0)
{
{
buf->s.start = out_stream->next_pts;
buf->s.stop = out_stream->next_pts + buf->s.duration;
+ out_stream->next_pts += buf->s.duration;
+ }
+ else
+ {
+ // Last ditch effort to prevent timestamps from going backwards
+ // This can (and should only) affect subtitle streams.
+ if (buf->s.start < out_stream->next_pts)
+ {
+ buf->s.start = out_stream->next_pts;
+ }
+ out_stream->next_pts = buf->s.start;
}
- out_stream->next_pts += buf->s.duration;
if (buf->s.stop > 0)
{