summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-04-07 03:03:53 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-04-07 03:03:53 +0200
commitd5a1385c7df4714df571d7f80916708b47767a57 (patch)
tree93fdd499babe961198e1e6b2f354bddd8f5929b3
parent7f0503acb042d047682b432e68ed97b1644c3f59 (diff)
parentc39f90e01e51c9fbc8074993a38e7f9b16338dbb (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15v5.15.0-beta4
-rw-r--r--src/plugins/wmf/player/mfplayersession.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/plugins/wmf/player/mfplayersession.cpp b/src/plugins/wmf/player/mfplayersession.cpp
index 24bfda83..9761fd99 100644
--- a/src/plugins/wmf/player/mfplayersession.cpp
+++ b/src/plugins/wmf/player/mfplayersession.cpp
@@ -277,10 +277,13 @@ MFPlayerSession::MediaType MFPlayerSession::getStreamType(IMFStreamDescriptor *s
if (!stream)
return Unknown;
- IMFMediaTypeHandler *typeHandler = NULL;
- if (SUCCEEDED(stream->GetMediaTypeHandler(&typeHandler))) {
+ struct SafeRelease {
+ IMFMediaTypeHandler *ptr = nullptr;
+ ~SafeRelease() { if (ptr) ptr->Release(); }
+ } typeHandler;
+ if (SUCCEEDED(stream->GetMediaTypeHandler(&typeHandler.ptr))) {
GUID guidMajorType;
- if (SUCCEEDED(typeHandler->GetMajorType(&guidMajorType))) {
+ if (SUCCEEDED(typeHandler.ptr->GetMajorType(&guidMajorType))) {
if (guidMajorType == MFMediaType_Audio)
return Audio;
else if (guidMajorType == MFMediaType_Video)
@@ -288,9 +291,6 @@ MFPlayerSession::MediaType MFPlayerSession::getStreamType(IMFStreamDescriptor *s
}
}
- if (typeHandler)
- typeHandler->Release();
-
return Unknown;
}