kopia lustrzana https://github.com/OpenRTX/OpenRTX
Audio codec: added function returning the codec's current operational status
rodzic
8dc1cba1f7
commit
c9cd620530
|
@ -72,6 +72,13 @@ bool codec_startDecode(const pathId path);
|
|||
*/
|
||||
void codec_stop(const pathId path);
|
||||
|
||||
/**
|
||||
* Get current oprational status of the codec thread.
|
||||
*
|
||||
* @return true if the codec thread is active.
|
||||
*/
|
||||
bool codec_running();
|
||||
|
||||
/**
|
||||
* Get a compressed audio frame from the internal queue. Each frame is composed
|
||||
* of 8 bytes.
|
||||
|
|
|
@ -109,6 +109,11 @@ void codec_stop(const pathId path)
|
|||
stopThread();
|
||||
}
|
||||
|
||||
bool codec_running()
|
||||
{
|
||||
return running;
|
||||
}
|
||||
|
||||
int codec_popFrame(uint8_t *frame, const bool blocking)
|
||||
{
|
||||
if(running == false)
|
||||
|
@ -351,6 +356,13 @@ static bool startThread(const pathId path, void *(*func) (void *))
|
|||
pthread_mutex_lock(&init_mutex);
|
||||
if(running)
|
||||
{
|
||||
// Same path as before, path open, codec already running: all good.
|
||||
if(path == audioPath)
|
||||
{
|
||||
pthread_mutex_unlock(&init_mutex);
|
||||
return true;
|
||||
}
|
||||
|
||||
// New path takes over the current one only if it has an higher priority
|
||||
// or the current one is closed/suspended.
|
||||
pathInfo_t newPath = audioPath_getInfo(path);
|
||||
|
|
Ładowanie…
Reference in New Issue