diff options
author | Joar Wandborg <joar@wandborg.se> | 2013-02-10 20:19:13 +0100 |
---|---|---|
committer | Joar Wandborg <joar@wandborg.se> | 2013-02-10 20:19:13 +0100 |
commit | 8d355df617abd9050b573daab08882067c1517d4 (patch) | |
tree | e562c36eee8ef69aa70c3bc6a100416706268885 | |
parent | 34c35c8cec6b70cd0dad0fa3d91962a2fa97c093 (diff) | |
download | mediagoblin-8d355df617abd9050b573daab08882067c1517d4.tar.lz mediagoblin-8d355df617abd9050b573daab08882067c1517d4.tar.xz mediagoblin-8d355df617abd9050b573daab08882067c1517d4.zip |
Tuned logging and added comments to 511 fix
-rw-r--r-- | mediagoblin/media_types/video/transcoders.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/mediagoblin/media_types/video/transcoders.py b/mediagoblin/media_types/video/transcoders.py index 7a8166c4..3a6a1c4d 100644 --- a/mediagoblin/media_types/video/transcoders.py +++ b/mediagoblin/media_types/video/transcoders.py @@ -571,15 +571,34 @@ pending: {2}'.format( return False def on_thumbnail_error(self, message): - _log.error('Thumbnailing failed.') + scaling_failed = False + + if 'Error calculating the output scaled size - integer overflow' \ + in message.parse_error()[1]: + # GStreamer videoscale sometimes fails to calculate the dimensions + # given only one of the destination dimensions and the source + # dimensions. This is a workaround in case videoscale returns an + # error that indicates this has happened. + scaling_failed = True + _log.error('Thumbnailing failed because of videoscale integer' + ' overflow. Will retry with fallback.') + else: + _log.error('Thumbnailing failed: {0}'.format(message.parse_error())) + + # Kill the current mainloop self.disconnect() - if 'Error calculating the output scaled size - integer overflow' in message.parse_error()[1]: - _log.error('Retrying with manually set sizes...') + + if scaling_failed: + # Manually scale the destination dimensions + _log.info('Retrying with manually set sizes...') + info = VideoTranscoder().discover(self.source_path) + h = info['videoheight'] w = info['videowidth'] ratio = 180 / int(w) h = int(h * ratio) + self.__init__(self.source_path, self.dest_path, 180, h) def disconnect(self): |