transcoder management for 'none'

pull/1/head
Tom Early 6 years ago
parent cd4df55cc5
commit e55f0d7aee

@ -90,30 +90,34 @@ CCodecStream::~CCodecStream()
bool CCodecStream::Init(uint16 uiPort)
{
// reset stop flag
m_bConnected = keep_running = true;
m_bConnected = keep_running = false; // prepare for the worst
// create server's IP
m_uiPort = uiPort;
auto s = g_Reflector.GetTranscoderIp();
m_Ip.Initialize(strchr(s, ':') ? AF_INET6 : AF_INET, m_uiPort, s);
if (0 == strncasecmp(s, "none", 4))
{
return true; // the user has disabled the transcoder
}
// create our socket
if (m_Ip.IsSet())
{
if (! m_Socket.Open(m_Ip)) {
std::cerr << "Error opening socket on port UDP" << uiPort << " on ip " << m_Ip << std::endl;
std::cerr << "Error opening socket on IP address " << m_Ip << std::endl;
return false;
}
}
else
{
std::cerr << "Could not initialize Codec Stream on " << m_Ip << std::endl;
std::cerr << "Could not initialize Codec Stream on " << s << std::endl;
return false;
}
keep_running = m_bConnected = true;
m_pThread = new std::thread(CCodecStream::Thread, this);
m_bConnected = true;
return true;
}
@ -121,11 +125,10 @@ bool CCodecStream::Init(uint16 uiPort)
void CCodecStream::Close(void)
{
// close socket
m_bConnected = false;
keep_running = m_bConnected = false;
m_Socket.Close();
// kill threads
keep_running = false;
if ( m_pThread != NULL )
{
m_pThread->join();

@ -59,7 +59,7 @@ bool CDmridDir::Init(void)
// load content
Reload();
// reset stop flag
// reset run flag
keep_running = true;
// start thread;

@ -67,7 +67,7 @@ bool CGateKeeper::Init(void)
m_NodeBlackList.LoadFromFile(BLACKLIST_PATH);
m_PeerList.LoadFromFile(INTERLINKLIST_PATH);
// reset stop flag
// reset run flag
keep_running = true;
// start thread;

@ -4,6 +4,7 @@
//
// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
// Copyright © 2020 Thomas A. Early, N7TAE
//
// ----------------------------------------------------------------------------
// This file is part of xlxd.

@ -97,29 +97,29 @@ CReflector::~CReflector()
bool CReflector::Start(void)
{
bool ok = true;
// reset stop flag
// let's go!
keep_running = true;
// init gate keeper
ok &= g_GateKeeper.Init();
// init gate keeper. It can only return true!
g_GateKeeper.Init();
// init dmrid directory
// init dmrid directory. No need to check the return value.
g_DmridDir.Init();
// init wiresx node directory
// init wiresx node directory. Likewise with the return vale.
g_YsfNodeDir.Init();
// init the transcoder
g_Transcoder.Init();
if (! g_Transcoder.Init())
return false;
// create protocols
ok &= m_Protocols.Init();
// if ok, start threads
if ( ok )
if (! m_Protocols.Init())
{
m_Protocols.Close();
return false;
}
// start one thread per reflector module
for ( int i = 0; i < NB_OF_MODULES; i++ )
{
@ -131,14 +131,8 @@ bool CReflector::Start(void)
#ifdef JSON_MONITOR
m_JsonReportThread = new std::thread(CReflector::JsonReportThread, this);
#endif
}
else
{
m_Protocols.Close();
}
// done
return ok;
return true;
}
void CReflector::Stop(void)

@ -69,15 +69,17 @@ CTranscoder::~CTranscoder()
bool CTranscoder::Init(void)
{
bool ok;
// reset stop flag
keep_running = true;
// create server's IP
auto s = g_Reflector.GetTranscoderIp();
m_Ip.Initialize(strchr(s, ':') ? AF_INET6 : AF_INET, TRANSCODER_PORT, s);
// does the user not want to use a transcoder?
if (0 == strncasecmp(s, "none", 4))
{
std::cout << "Transcoder will not be enabled beacuse the transcoder IP addess is 'none'" << std::endl;
return true;
}
// create our socket
if (m_Ip.IsSet())
{
@ -88,11 +90,13 @@ bool CTranscoder::Init(void)
}
else
{
std::cerr << "Could not initialize transcoder socket on " << m_Ip << std::endl;
// something bad was specified for the transcoder IP?
std::cerr << "Could not initialize transcoder socket on '" << s << "'" << std::endl;
return false;
}
// start thread;
// start thread
keep_running = true;
m_pThread = new std::thread(CTranscoder::Thread, this);
return true;

@ -58,7 +58,7 @@ bool CYsfNodeDir::Init(void)
// load content
Reload();
// reset stop flag
// reset run flag
keep_running = true;
// start thread;

Loading…
Cancel
Save

Powered by TurnKey Linux.