mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-09 05:32:46 +02:00
use AgentList defaults when AIM has no socket or address set
This commit is contained in:
parent
0ff65b44b5
commit
dae7bf8674
4 changed files with 26 additions and 3 deletions
|
@ -150,8 +150,8 @@ Application::Application(int& argc, char** argv) :
|
|||
_packetCount(0),
|
||||
_packetsPerSecond(0),
|
||||
_bytesPerSecond(0),
|
||||
_bytesCount(0) {
|
||||
|
||||
_bytesCount(0)
|
||||
{
|
||||
gettimeofday(&_applicationStartupTime, NULL);
|
||||
printLog("Interface Startup:\n");
|
||||
|
||||
|
@ -167,7 +167,9 @@ Application::Application(int& argc, char** argv) :
|
|||
if (portStr) {
|
||||
listenPort = atoi(portStr);
|
||||
}
|
||||
|
||||
AgentList::createInstance(AGENT_TYPE_AVATAR, listenPort);
|
||||
|
||||
_enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
|
||||
if (!_enableNetworkThread) {
|
||||
AgentList::getInstance()->getAgentSocket()->setBlocking(false);
|
||||
|
|
|
@ -9,12 +9,16 @@
|
|||
#include <sys/time.h>
|
||||
|
||||
#include "SharedUtil.h"
|
||||
#include "AgentList.h"
|
||||
#include "AgentTypes.h"
|
||||
#include "Agent.h"
|
||||
#include "PacketHeaders.h"
|
||||
|
||||
#include "AudioInjectionManager.h"
|
||||
|
||||
UDPSocket* AudioInjectionManager::_injectorSocket = NULL;
|
||||
sockaddr AudioInjectionManager::_destinationSocket;
|
||||
bool AudioInjectionManager::_isDestinationSocketExplicit = false;
|
||||
AudioInjector* AudioInjectionManager::_injectors[50] = {};
|
||||
|
||||
AudioInjector* AudioInjectionManager::injectorWithSamplesFromFile(const char* filename) {
|
||||
|
@ -39,9 +43,24 @@ AudioInjector* AudioInjectionManager::injectorWithCapacity(int capacity) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void AudioInjectionManager::setDestinationSocket(sockaddr& destinationSocket) {
|
||||
_destinationSocket = destinationSocket;
|
||||
_isDestinationSocketExplicit = true;
|
||||
}
|
||||
|
||||
void* AudioInjectionManager::injectAudioViaThread(void* args) {
|
||||
AudioInjector* injector = (AudioInjector*) args;
|
||||
|
||||
// if we don't have an injectorSocket then grab the one from the agent list
|
||||
if (!_injectorSocket) {
|
||||
_injectorSocket = AgentList::getInstance()->getAgentSocket();
|
||||
}
|
||||
|
||||
// if we don't have an explicit destination socket then pull active socket for current audio mixer from agent list
|
||||
if (!_isDestinationSocketExplicit) {
|
||||
_destinationSocket = *AgentList::getInstance()->soloAgentOfType(AGENT_TYPE_AUDIO_MIXER)->getActiveSocket();
|
||||
}
|
||||
|
||||
injector->injectAudio(_injectorSocket, &_destinationSocket);
|
||||
|
||||
// if this an injector inside the injection manager's array we're responsible for deletion
|
||||
|
|
|
@ -24,12 +24,13 @@ public:
|
|||
static void threadInjector(AudioInjector* injector);
|
||||
|
||||
static void setInjectorSocket(UDPSocket* injectorSocket) { _injectorSocket = injectorSocket;}
|
||||
static void setDestinationSocket(sockaddr& destinationSocket) { _destinationSocket = destinationSocket; }
|
||||
static void setDestinationSocket(sockaddr& destinationSocket);
|
||||
private:
|
||||
static void* injectAudioViaThread(void* args);
|
||||
|
||||
static UDPSocket* _injectorSocket;
|
||||
static sockaddr _destinationSocket;
|
||||
static bool _isDestinationSocketExplicit;
|
||||
static AudioInjector* _injectors[MAX_CONCURRENT_INJECTORS];
|
||||
};
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
#include "AgentList.h"
|
||||
#include "AgentTypes.h"
|
||||
#include "PacketHeaders.h"
|
||||
|
|
Loading…
Reference in a new issue