mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 19:55:07 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into render_voxels_optimization
This commit is contained in:
commit
35c840fefa
4 changed files with 62 additions and 12 deletions
|
@ -16,10 +16,14 @@
|
|||
#include <errno.h>
|
||||
#include <fstream>
|
||||
#include <limits>
|
||||
#include <signal.h>
|
||||
|
||||
#include <AgentList.h>
|
||||
#include <AgentTypes.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <StdDev.h>
|
||||
#include <Stacktrace.h>
|
||||
|
||||
#include "AudioRingBuffer.h"
|
||||
#include "PacketHeaders.h"
|
||||
|
||||
|
@ -71,8 +75,7 @@ void plateauAdditionOfSamples(int16_t &mixSample, int16_t sampleToAdd) {
|
|||
mixSample = normalizedSample;
|
||||
}
|
||||
|
||||
void *sendBuffer(void *args)
|
||||
{
|
||||
void *sendBuffer(void *args) {
|
||||
int sentBytes;
|
||||
int nextFrame = 0;
|
||||
timeval startTime;
|
||||
|
@ -255,11 +258,12 @@ void attachNewBufferToAgent(Agent *newAgent) {
|
|||
}
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
AgentList* agentList = AgentList::createInstance(AGENT_TYPE_AUDIO_MIXER, MIXER_LISTEN_PORT);
|
||||
int main(int argc, const char* argv[]) {
|
||||
signal(SIGSEGV, printStacktrace);
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
|
||||
AgentList* agentList = AgentList::createInstance(AGENT_TYPE_AUDIO_MIXER, MIXER_LISTEN_PORT);
|
||||
|
||||
ssize_t receivedBytes = 0;
|
||||
|
||||
agentList->linkedDataCreateCallback = attachNewBufferToAgent;
|
||||
|
|
|
@ -96,7 +96,8 @@ int main(int argc, const char * argv[])
|
|||
agentList->startSilentAgentRemovalThread();
|
||||
|
||||
while (true) {
|
||||
if (agentList->getAgentSocket().receive((sockaddr *)&agentPublicAddress, packetData, &receivedBytes)) {
|
||||
if (agentList->getAgentSocket().receive((sockaddr *)&agentPublicAddress, packetData, &receivedBytes) &&
|
||||
(packetData[0] == PACKET_HEADER_DOMAIN_RFD || packetData[0] == PACKET_HEADER_DOMAIN_LIST_REQUEST)) {
|
||||
std::map<char, Agent *> newestSoloAgents;
|
||||
|
||||
agentType = packetData[1];
|
||||
|
@ -118,11 +119,6 @@ int main(int argc, const char * argv[])
|
|||
agentType,
|
||||
agentList->getLastAgentId())) {
|
||||
agentList->increaseAgentId();
|
||||
} else if (packetData[0] == PACKET_HEADER_DOMAIN_RFD) {
|
||||
// if this is a previous agent, and they are re-reporting for duty
|
||||
// then we need to update the first receive time
|
||||
Agent* refreshedAgent = agentList->agentWithAddress((sockaddr*) &agentLocalAddress);
|
||||
refreshedAgent->setWakeMicrostamp(usecTimestampNow());
|
||||
}
|
||||
|
||||
currentBufferPos = broadcastPacket + 1;
|
||||
|
@ -146,8 +142,14 @@ int main(int argc, const char * argv[])
|
|||
}
|
||||
}
|
||||
} else {
|
||||
double timeNow = usecTimestampNow();
|
||||
// this is the agent, just update last receive to now
|
||||
agent->setLastHeardMicrostamp(usecTimestampNow());
|
||||
agent->setLastHeardMicrostamp(timeNow);
|
||||
|
||||
if (packetData[0] == PACKET_HEADER_DOMAIN_RFD
|
||||
&& memchr(SOLO_AGENT_TYPES, agentType, sizeof(SOLO_AGENT_TYPES))) {
|
||||
agent->setWakeMicrostamp(timeNow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
28
libraries/shared/src/Stacktrace.cpp
Normal file
28
libraries/shared/src/Stacktrace.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// Stacktrace.cpp
|
||||
// hifi
|
||||
//
|
||||
// Created by Stephen Birarda on 5/6/13.
|
||||
//
|
||||
//
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <execinfo.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "Stacktrace.h"
|
||||
|
||||
const int NUMBER_OF_STACK_ENTRIES = 20;
|
||||
|
||||
void printStacktrace(int signal) {
|
||||
void* array[NUMBER_OF_STACK_ENTRIES];
|
||||
|
||||
// get void*'s for all entries on the stack
|
||||
size_t size = backtrace(array, NUMBER_OF_STACK_ENTRIES);
|
||||
|
||||
// print out all the frames to stderr
|
||||
fprintf(stderr, "Error: signal %d:\n", signal);
|
||||
backtrace_symbols_fd(array, size, 2);
|
||||
exit(1);
|
||||
}
|
16
libraries/shared/src/Stacktrace.h
Normal file
16
libraries/shared/src/Stacktrace.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// Stacktrace.h
|
||||
// hifi
|
||||
//
|
||||
// Created by Stephen Birarda on 5/6/13.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef __hifi__Stacktrace__
|
||||
#define __hifi__Stacktrace__
|
||||
|
||||
#include <iostream>
|
||||
|
||||
void printStacktrace(int signal);
|
||||
|
||||
#endif /* defined(__hifi__Stacktrace__) */
|
Loading…
Reference in a new issue