Browse Source

Never seek video more than once when trying to catch up (issue #1472, issue #1438)

I'm not sure if this actually helps, because I haven't been able to reproduce
the issue so far, but at least this should make it less likely the decoder
thread ends up in an infinite loop.
Bart van Strien 6 years ago
parent
commit
1e8ab8ce1e
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/modules/video/theora/TheoraVideoStream.cpp

+ 5 - 3
src/modules/video/theora/TheoraVideoStream.cpp

@@ -214,14 +214,16 @@ void TheoraVideoStream::threadedFillBackBuffer(double dt)
 		seekDecoder(position);
 		seekDecoder(position);
 
 
 	// Until we are at the end of the stream, or we are displaying the right frame
 	// Until we are at the end of the stream, or we are displaying the right frame
-	unsigned int lagCounter = 0;
+	unsigned int framesBehind = 0;
+	bool failedSeek = false;
 	while (!demuxer.isEos() && position >= nextFrame)
 	while (!demuxer.isEos() && position >= nextFrame)
 	{
 	{
 		// If we can't catch up, seek
 		// If we can't catch up, seek
-		if (lagCounter++ > 5)
+		if (framesBehind++ > 5 && !failedSeek)
 		{
 		{
 			seekDecoder(position);
 			seekDecoder(position);
-			lagCounter = 0;
+			framesBehind = 0;
+			failedSeek = true;
 		}
 		}
 
 
 		th_ycbcr_buffer bufferinfo;
 		th_ycbcr_buffer bufferinfo;