Correctly handle S_FALSE return value of IActiveMovie::get_Duration().
IActiveMovie::get_Duration() can return S_FALSE in which case outDuration isn't initialized and so wxAMMediaBackend::GetDuration() would return a completely wrong value. Fix this by returning 0 from it instead which seems like the only reasonable thing to do (in the absence of documentation of this interface it's not really clear what does S_FALSE return value mean nor why didn't it return it before). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2009,18 +2009,19 @@ wxLongLong wxAMMediaBackend::GetDuration()
|
|||||||
{
|
{
|
||||||
double outDuration;
|
double outDuration;
|
||||||
HRESULT hr = GetAM()->get_Duration(&outDuration);
|
HRESULT hr = GetAM()->get_Duration(&outDuration);
|
||||||
if(FAILED(hr))
|
switch ( hr )
|
||||||
{
|
{
|
||||||
|
default:
|
||||||
wxAMLOG(hr);
|
wxAMLOG(hr);
|
||||||
|
// fall through
|
||||||
|
|
||||||
|
case S_FALSE:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case S_OK:
|
||||||
|
// outDuration is in seconds, we need milliseconds
|
||||||
|
return outDuration * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
// h,m,s,milli - outDuration is in 1 second (double)
|
|
||||||
outDuration *= 1000;
|
|
||||||
wxLongLong ll;
|
|
||||||
ll.Assign(outDuration);
|
|
||||||
|
|
||||||
return ll;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user