Fix errors when a custom size is given which is larger than the container (#2404).
[dcpomatic.git] / src / lib / video_content.cc
index c10a94f43f372a4ca184ab4edddcf8577367de58..9b39ff01b8f56d9f84e7176a27b227a482c6786b 100644 (file)
@@ -650,7 +650,10 @@ VideoContent::scaled_size (dcp::Size film_container)
        }
 
        if (_custom_size) {
-               return *_custom_size;
+               if (_custom_size->width <= film_container.width && _custom_size->height <= film_container.height) {
+                       return *_custom_size;
+               }
+               return fit_ratio_within(_custom_size->ratio(), film_container);
        }
 
        auto size = size_after_crop ();