Skip to content

Commit

Permalink
make sure start and end times are different
Browse files Browse the repository at this point in the history
  • Loading branch information
faush01 committed Aug 29, 2014
1 parent 587e38c commit b4d6635
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion MediaBrowser.MediaEncoding/Subtitles/VttWriter.cs
Expand Up @@ -18,7 +18,16 @@ public void Write(SubtitleTrackInfo info, Stream stream, CancellationToken cance
{
cancellationToken.ThrowIfCancellationRequested();

writer.WriteLine(@"{0:hh\:mm\:ss\.fff} --> {1:hh\:mm\:ss\.fff}", TimeSpan.FromTicks(trackEvent.StartPositionTicks), TimeSpan.FromTicks(trackEvent.EndPositionTicks));
TimeSpan startTime = TimeSpan.FromTicks(trackEvent.StartPositionTicks);
TimeSpan endTime = TimeSpan.FromTicks(trackEvent.EndPositionTicks);

// make sure the start and end times are different and seqential
if (endTime.TotalMilliseconds <= startTime.TotalMilliseconds)
{
endTime = startTime.Add(TimeSpan.FromMilliseconds(1));
}

writer.WriteLine(@"{0:hh\:mm\:ss\.fff} --> {1:hh\:mm\:ss\.fff}", startTime, endTime);

var text = trackEvent.Text;

Expand Down

0 comments on commit b4d6635

Please sign in to comment.