Skip to content

Commit 4d19e67

Browse files
author
Clement Champetier
committed
Video/AudioDecoder: fix the codec state when calling decoder destructor
* The decoder can open the codec (and so there is a flag _isSetup to check this). * If the codec was open by the decoder, it should close it at the end of its life.
1 parent bcc0b08 commit 4d19e67

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/AvTranscoder/decoder/AudioDecoder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ AudioDecoder::AudioDecoder(InputStream& inputStream)
2727

2828
AudioDecoder::~AudioDecoder()
2929
{
30+
if(_isSetup)
31+
_inputStream->getAudioCodec().closeCodec();
3032
}
3133

3234
void AudioDecoder::setupDecoder(const ProfileLoader::Profile& profile)
@@ -73,7 +75,7 @@ void AudioDecoder::setupDecoder(const ProfileLoader::Profile& profile)
7375
}
7476

7577
// open decoder
76-
_inputStream->getAudioCodec().openCodec();
78+
codec.openCodec();
7779
_isSetup = true;
7880
}
7981

src/AvTranscoder/decoder/VideoDecoder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ VideoDecoder::VideoDecoder(InputStream& inputStream)
2424

2525
VideoDecoder::~VideoDecoder()
2626
{
27+
if(_isSetup)
28+
_inputStream->getVideoCodec().closeCodec();
2729
}
2830

2931
void VideoDecoder::setupDecoder(const ProfileLoader::Profile& profile)
@@ -70,7 +72,7 @@ void VideoDecoder::setupDecoder(const ProfileLoader::Profile& profile)
7072
}
7173

7274
// open decoder
73-
_inputStream->getVideoCodec().openCodec();
75+
codec.openCodec();
7476
_isSetup = true;
7577
}
7678

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy