Commit 3a5adfcd authored by Ben Schwartz's avatar Ben Schwartz Committed by Maik Merten
Browse files

Fix for Theora streams with pixel aspect ratio of zero or infinity.

Theora stream can have a PAR with numerator or denominator equal to zero.
This is a valid configuration; according to the specification it indicates
that the actual ratio is unknown and the player MAY assume 1:1, which is
what this patch does.

(Negative aspect ratio is still illegal and maybe even unrepresentable, so we
also catch that here.)
parent 21fc8dd2
......@@ -60,7 +60,11 @@ public class VideoSink extends Sink
if(!ignoreAspect) {
Debug.log(Debug.DEBUG, this+" dimension: "+width+"x"+height+", aspect: "+aspectX+"/"+aspectY);
if (aspectY > aspectX) {
if (aspectX < 0 || aspectY < 0) {
Debug.log(Debug.WARNING, "Illegal negative aspect ratio detected; defaulting to 1:1.");
} else if (aspectX == 0 || aspectY == 0) {
Debug.log(Debug.DEBUG, "Undefined aspect ratio; defaulting to 1:1.");
} else if (aspectY > aspectX) {
height = height * aspectY / aspectX;
} else {
width = width * aspectX / aspectY;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment