Browse Source

Fix end-of-stream detection for videos

Fixes hang when a video file contains frames past the end of the video stream
Bart van Strien 9 years ago
parent
commit
8dd7cc16ab
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/modules/video/theora/VideoStream.cpp

+ 4 - 4
src/modules/video/theora/VideoStream.cpp

@@ -151,12 +151,12 @@ bool VideoStream::readPacket(bool mustSucceed)
 
 	while (ogg_stream_packetout(&stream, &packet) != 1)
 	{
-		// We need to read another page, but there is none, we're at the end
-		if (ogg_page_eos(&page) && !mustSucceed)
-			return eos = true;
-
 		do
 		{
+			// We need to read another page, but there is none, we're at the end
+			if (ogg_page_eos(&page) && !mustSucceed)
+				return eos = true;
+
 			readPage();
 		} while (ogg_page_serialno(&page) != videoSerial);