Skip to content

Commit 6b4373c

Browse files
author
Clement Champetier
committed
hotfix: encoders/decoders - by default set threads to the value expected by the codec
If indicated in profile, force threads value.
1 parent a35585f commit 6b4373c

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/AvTranscoder/decoder/AudioDecoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void AudioDecoder::setProfile( const ProfileLoader::Profile& profile )
155155
if( profile.count( constants::avProfileThreads ) )
156156
codec.getOption( constants::avProfileThreads ).setString( profile.at( constants::avProfileThreads ) );
157157
else
158-
codec.getOption( constants::avProfileThreads ).setString( "auto" );
158+
codec.getOption( constants::avProfileThreads ).setInt( codec.getAVCodecContext().thread_count );
159159

160160
// set decoder options
161161
for( ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it )

src/AvTranscoder/decoder/VideoDecoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void VideoDecoder::setProfile( const ProfileLoader::Profile& profile )
114114
if( profile.count( constants::avProfileThreads ) )
115115
codec.getOption( constants::avProfileThreads ).setString( profile.at( constants::avProfileThreads ) );
116116
else
117-
codec.getOption( constants::avProfileThreads ).setString( "auto" );
117+
codec.getOption( constants::avProfileThreads ).setInt( codec.getAVCodecContext().thread_count );
118118

119119
// set decoder options
120120
for( ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it )

src/AvTranscoder/encoder/AudioEncoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void AudioEncoder::setProfile( const ProfileLoader::Profile& profile, const Audi
144144
if( profile.count( constants::avProfileThreads ) )
145145
_codec.getOption( constants::avProfileThreads ).setString( profile.at( constants::avProfileThreads ) );
146146
else
147-
_codec.getOption( constants::avProfileThreads ).setString( "auto" );
147+
_codec.getOption( constants::avProfileThreads ).setInt( _codec.getAVCodecContext().thread_count );
148148

149149

150150
// set encoder options

src/AvTranscoder/encoder/VideoEncoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void VideoEncoder::setProfile( const ProfileLoader::Profile& profile, const avtr
137137
if( profile.count( constants::avProfileThreads ) )
138138
_codec.getOption( constants::avProfileThreads ).setString( profile.at( constants::avProfileThreads ) );
139139
else
140-
_codec.getOption( constants::avProfileThreads ).setString( "auto" );
140+
_codec.getOption( constants::avProfileThreads ).setInt( _codec.getAVCodecContext().thread_count );
141141

142142
// set encoder options
143143
for( ProfileLoader::Profile::const_iterator it = profile.begin(); it != profile.end(); ++it )

src/AvTranscoder/transcoder/StreamTranscoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ StreamTranscoder::StreamTranscoder(
133133
{
134134
// input decoder
135135
VideoDecoder* inputVideo = new VideoDecoder( *static_cast<InputStream*>( _inputStream ) );
136-
// set decoder options with empty profile to set some key options to specific values (example: threads to auto)
136+
// set decoder options with empty profile to set some key options to specific values
137137
inputVideo->setProfile( ProfileLoader::Profile() );
138138
inputVideo->setup();
139139
_inputDecoder = inputVideo;
@@ -168,7 +168,7 @@ StreamTranscoder::StreamTranscoder(
168168
{
169169
// input decoder
170170
AudioDecoder* inputAudio = new AudioDecoder( *static_cast<InputStream*>( _inputStream ) );
171-
// set decoder options with empty profile to set some key options to specific values (example: threads to auto)
171+
// set decoder options with empty profile to set some key options to specific values
172172
inputAudio->setProfile( ProfileLoader::Profile() );
173173
inputAudio->setup();
174174
_inputDecoder = inputAudio;

0 commit comments

Comments
 (0)