dshow: prevent division by zero
# HG changeset patch
# User Edouard Gomez <ed.gomez@free.fr>
# Date
1224021633 -7200
# Node ID
9564c1736b76c96f37fb85476d36496b3d7955bb
# Parent
40d5c2186f7fb31e944b5b542b3366bbc420cc0e
dshow: prevent division by zero
In the DShow capture module, division by zero is possible in
multiple modulo statements when dealing with granularity values
returned by capture filters.
Change the code so that:
- if granularity is zero, then width/height/samplingrate must be
a perfect match with requested settings.
- if granularity is non zero, then use the old condition tests.
This fixes real crashes reported by VLC users on different forums.
See:
http://forum.doom9.org/archive/index.php/t-134655.html
http://forum.videolan.org/viewtopic.php?f=2&t=37056&p=114065&hilit=blackmagic
Tested with both a Decklink HD Extreme card and a Decklink HD Pro card.
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>