From 7e0a86e583fa4a5bcb9e6887b4e5016f5a205d70 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Wed, 11 Feb 2015 12:49:20 -0800 Subject: [PATCH] win-dshow: Fix stack overflow bug Martell changed this function without realizing that this was calling a function below it, not recursively calling itself. The reason why he got the warning was because there was no forward declaration of the function that was being called; I think he's used to C where only one function definition can exist with the same name. In this case, it was another function with the same name but with different parameters, something that's permitted in C++. I wish I had realized this sooner. This fixes the crashes people have been having with devices. --- plugins/win-dshow/win-dshow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/win-dshow/win-dshow.cpp b/plugins/win-dshow/win-dshow.cpp index a04720edb..80d79f81a 100644 --- a/plugins/win-dshow/win-dshow.cpp +++ b/plugins/win-dshow/win-dshow.cpp @@ -569,10 +569,13 @@ static inline bool ResolutionValid(string res, int &cx, int &cy) return ConvertRes(cx, cy, res.c_str()); } +template +static bool CapsMatch(const VideoDevice &dev, F ... fs); + template static inline bool CapsMatch(const VideoInfo &info, F&& f, Fs ... fs) { - return f(info) && CapsMatch(info, f, fs ...); + return f(info) && CapsMatch(info, fs ...); } static inline bool CapsMatch(const VideoInfo&)