Commit 17a31c5a authored by Rafaël Carré's avatar Rafaël Carré

Do all avcodec initialization in one function

parent d0e34377
......@@ -63,14 +63,6 @@ bool isSupportedCodec(const char *name)
std::list<std::string> installedCodecs()
{
// FIXME: not thread safe
static bool registered = false;
if (not registered)
{
av_register_all();
registered = true;
}
std::list<std::string> codecs;
AVCodec *p = NULL, *p2;
const char *last_name = "000";
......@@ -123,7 +115,7 @@ static int avcodecManageMutex(void **mutex, enum AVLockOp op)
return 0;
}
void sfl_avcodec_init_locking()
void sfl_avcodec_init()
{
static int done = 0;
ost::MutexLock lock(avcodec_lock);
......@@ -131,6 +123,10 @@ void sfl_avcodec_init_locking()
return;
done = 1;
av_register_all();
av_register_all();
av_lockmgr_register(avcodecManageMutex);
}
......
......@@ -45,7 +45,7 @@ namespace libav_utils {
*/
bool isSupportedCodec(const char *codec);
void sfl_avcodec_init_locking();
void sfl_avcodec_init();
}
#endif // __LIBAV_UTILS_H__
......@@ -222,9 +222,7 @@ void VideoReceiveThread::loadSDP()
void VideoReceiveThread::setup()
{
libav_utils::sfl_avcodec_init_locking();
av_register_all();
avdevice_register_all();
libav_utils::sfl_avcodec_init();
dstWidth_ = atoi(args_["width"].c_str());
dstHeight_ = atoi(args_["height"].c_str());
......
......@@ -123,9 +123,7 @@ void VideoSendThread::prepareEncoderContext()
void VideoSendThread::setup()
{
int ret;
libav_utils::sfl_avcodec_init_locking();
av_register_all();
avdevice_register_all();
libav_utils::sfl_avcodec_init();
if (!test_source_)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment