mirror of
https://github.com/lubosz/overte.git
synced 2025-04-13 00:43:06 +02:00
some cleanup
This commit is contained in:
parent
2e63aba8c9
commit
c6ffd81c4b
6 changed files with 11 additions and 18 deletions
|
@ -760,10 +760,9 @@ void AudioMixer::broadcastMixes() {
|
|||
|
||||
std::unique_ptr<NLPacket> mixPacket;
|
||||
|
||||
const int MAX_CODEC_NAME = 30; // way over estimate
|
||||
|
||||
if (mixHasAudio) {
|
||||
int mixPacketBytes = sizeof(quint16) + MAX_CODEC_NAME+ AudioConstants::NETWORK_FRAME_BYTES_STEREO;
|
||||
int mixPacketBytes = sizeof(quint16) + AudioConstants::MAX_CODEC_NAME_LENGTH_ON_WIRE
|
||||
+ AudioConstants::NETWORK_FRAME_BYTES_STEREO;
|
||||
mixPacket = NLPacket::create(PacketType::MixedAudio, mixPacketBytes);
|
||||
|
||||
// pack sequence number
|
||||
|
@ -780,9 +779,8 @@ void AudioMixer::broadcastMixes() {
|
|||
|
||||
// pack mixed audio samples
|
||||
mixPacket->write(encodedBuffer.constData(), encodedBuffer.size());
|
||||
}
|
||||
else {
|
||||
int silentPacketBytes = sizeof(quint16) + sizeof(quint16) + MAX_CODEC_NAME;
|
||||
} else {
|
||||
int silentPacketBytes = sizeof(quint16) + sizeof(quint16) + AudioConstants::MAX_CODEC_NAME_LENGTH_ON_WIRE;
|
||||
mixPacket = NLPacket::create(PacketType::SilentAudioFrame, silentPacketBytes);
|
||||
|
||||
// pack sequence number
|
||||
|
|
|
@ -168,7 +168,6 @@ int AudioMixerClientData::parseData(ReceivedMessage& message) {
|
|||
|
||||
// check the overflow count before we parse data
|
||||
auto overflowBefore = matchingStream->getOverflowCount();
|
||||
|
||||
auto parseResult = matchingStream->parseData(message);
|
||||
|
||||
if (matchingStream->getOverflowCount() > overflowBefore) {
|
||||
|
@ -348,8 +347,6 @@ QJsonObject AudioMixerClientData::getAudioStreamStats() {
|
|||
|
||||
void AudioMixerClientData::sendSelectAudioFormat(SharedNodePointer node, const QString& selectedCodecName) {
|
||||
auto replyPacket = NLPacket::create(PacketType::SelectedAudioFormat);
|
||||
|
||||
// write them to our packet
|
||||
replyPacket->writeString(selectedCodecName);
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->sendPacket(std::move(replyPacket), *node);
|
||||
|
|
|
@ -80,7 +80,6 @@ public:
|
|||
|
||||
QString getCodecName() { return _selectedCodecName; }
|
||||
|
||||
|
||||
signals:
|
||||
void injectorStreamFinished(const QUuid& streamIdentifier);
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace AudioConstants {
|
|||
|
||||
inline const char* getAudioFrameName() { return "com.highfidelity.recording.Audio"; }
|
||||
|
||||
const int MAX_CODEC_NAME_LENGTH = 30;
|
||||
const int MAX_CODEC_NAME_LENGTH_ON_WIRE = MAX_CODEC_NAME_LENGTH + sizeof(uint32_t);
|
||||
const int NETWORK_FRAME_BYTES_STEREO = 1024;
|
||||
const int NETWORK_FRAME_SAMPLES_STEREO = NETWORK_FRAME_BYTES_STEREO / sizeof(AudioSample);
|
||||
const int NETWORK_FRAME_BYTES_PER_CHANNEL = 512;
|
||||
|
|
|
@ -272,9 +272,9 @@ int64_t AudioInjector::injectNextFrame() {
|
|||
// pack some placeholder sequence number for now
|
||||
audioPacketStream << (quint16) 0;
|
||||
|
||||
// pack some placeholder sequence number for now
|
||||
//QString noCodecForInjectors("");
|
||||
//writeStringToStream(noCodecForInjectors, audioPacketStream);
|
||||
// current injectors don't use codecs, so pack in the unknown codec name
|
||||
QString noCodecForInjectors("");
|
||||
writeStringToStream(noCodecForInjectors, audioPacketStream);
|
||||
|
||||
// pack stream identifier (a generated UUID)
|
||||
audioPacketStream << QUuid::createUuid();
|
||||
|
|
|
@ -59,7 +59,7 @@ void InboundAudioStream::reset() {
|
|||
_isStarved = true;
|
||||
_hasStarted = false;
|
||||
resetStats();
|
||||
//cleanupCodec(); // FIXME???
|
||||
cleanupCodec();
|
||||
}
|
||||
|
||||
void InboundAudioStream::resetStats() {
|
||||
|
@ -108,10 +108,7 @@ int InboundAudioStream::parseData(ReceivedMessage& message) {
|
|||
message.readPrimitive(&sequence);
|
||||
SequenceNumberStats::ArrivalInfo arrivalInfo = _incomingSequenceNumberStats.sequenceNumberReceived(sequence,
|
||||
message.getSourceID());
|
||||
QString codecInPacket("");
|
||||
if (packetType != PacketType::InjectAudio) {
|
||||
codecInPacket = message.readString();
|
||||
}
|
||||
QString codecInPacket = message.readString();
|
||||
|
||||
packetReceivedUpdateTimingStats();
|
||||
|
||||
|
|
Loading…
Reference in a new issue