Skip to content

Commit 30a4ee1

Browse files
author
Clement Champetier
committed
Transcoder: fix destructor
* Fix seg fault in destructor: delete twice the array of DummyAudio and DummyVideo. * Only store them in the StreamTranscoders!
1 parent 76010a7 commit 30a4ee1

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

src/AvTranscoder/Transcoder/Transcoder.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ Transcoder::~Transcoder()
2020
{
2121
delete (*it);
2222
}
23-
for( std::vector< DummyAudio* >::iterator it = _dummyAudio.begin(); it != _dummyAudio.end(); ++it )
24-
{
25-
delete (*it);
26-
}
27-
for( std::vector< DummyVideo* >::iterator it = _dummyVideo.begin(); it != _dummyVideo.end(); ++it )
28-
{
29-
delete (*it);
30-
}
3123
for( std::vector< StreamTranscoder* >::iterator it = _streamTranscoders.begin(); it != _streamTranscoders.end(); ++it )
3224
{
3325
delete (*it);
@@ -175,15 +167,15 @@ void Transcoder::addDummyStream( Profile::ProfileDesc& profile )
175167

176168
if( profile.find( Profile::avProfileType )->second == Profile::avProfileTypeAudio )
177169
{
178-
_dummyAudio.push_back( new DummyAudio() );
179-
StreamTranscoder* streamTranscoder = new StreamTranscoder( *_dummyAudio.back(), _outputFile, profile );
170+
DummyAudio* dummyAudio = new DummyAudio();
171+
StreamTranscoder* streamTranscoder = new StreamTranscoder( *dummyAudio, _outputFile, profile );
180172
_streamTranscoders.push_back( streamTranscoder );
181173
}
182174

183175
if( profile.find( Profile::avProfileType )->second == Profile::avProfileTypeVideo )
184176
{
185-
_dummyVideo.push_back( new DummyVideo() );
186-
StreamTranscoder* streamTranscoder = new StreamTranscoder( *_dummyVideo.back(), _outputFile, profile );
177+
DummyVideo* dummyVideo = new DummyVideo();
178+
StreamTranscoder* streamTranscoder = new StreamTranscoder( *dummyVideo, _outputFile, profile );
187179
_streamTranscoders.push_back( streamTranscoder );
188180
}
189181
}

src/AvTranscoder/Transcoder/Transcoder.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ class Transcoder
6060
std::vector< InputStream* > _inputStreams;
6161
std::vector< StreamTranscoder* > _streamTranscoders;
6262

63-
std::vector< DummyAudio* > _dummyAudio;
64-
std::vector< DummyVideo* > _dummyVideo;
6563
Profile _profile;
6664

6765
bool _verbose;

0 commit comments

Comments
 (0)