Merge pull request #3832 from Atlante45/fix_left_right_jumping

Fix left/right audio jumping
This commit is contained in:
Brad Hefta-Gaub 2014-11-19 16:40:04 -08:00
commit 75304fd419
2 changed files with 23 additions and 16 deletions

View file

@ -169,9 +169,16 @@ int InboundAudioStream::parseData(const QByteArray& packet) {
}
int InboundAudioStream::parseStreamProperties(PacketType type, const QByteArray& packetAfterSeqNum, int& numAudioSamples) {
// mixed audio packets do not have any info between the seq num and the audio data.
numAudioSamples = packetAfterSeqNum.size() / sizeof(int16_t);
return 0;
if (type == PacketTypeSilentAudioFrame) {
quint16 numSilentSamples = 0;
memcpy(&numSilentSamples, packetAfterSeqNum.constData(), sizeof(quint16));
numAudioSamples = numSilentSamples;
return sizeof(quint16);
} else {
// mixed audio packets do not have any info between the seq num and the audio data.
numAudioSamples = packetAfterSeqNum.size() / sizeof(int16_t);
return 0;
}
}
int InboundAudioStream::parseAudioData(PacketType type, const QByteArray& packetAfterStreamProperties, int numAudioSamples) {

View file

@ -21,57 +21,57 @@
// NOTE: if adding a new packet type, you can replace one marked usable or add at the end
// NOTE: if you want the name of the packet type to be available for debugging or logging, update nameForPacketType() as well
enum PacketType {
PacketTypeUnknown,
PacketTypeUnknown, // 0
PacketTypeStunResponse,
PacketTypeDomainList,
PacketTypePing,
PacketTypePingReply,
PacketTypeKillAvatar,
PacketTypeKillAvatar, // 5
PacketTypeAvatarData,
PacketTypeInjectAudio,
PacketTypeMixedAudio,
PacketTypeMicrophoneAudioNoEcho,
PacketTypeMicrophoneAudioWithEcho,
PacketTypeMicrophoneAudioWithEcho, // 10
PacketTypeBulkAvatarData,
PacketTypeSilentAudioFrame,
PacketTypeEnvironmentData,
PacketTypeDomainListRequest,
PacketTypeRequestAssignment,
PacketTypeRequestAssignment, // 15
PacketTypeCreateAssignment,
PacketTypeDomainConnectionDenied,
PacketTypeMuteEnvironment,
PacketTypeAudioStreamStats,
PacketTypeDataServerConfirm,
PacketTypeDataServerConfirm, // 20
PacketTypeVoxelQuery,
PacketTypeVoxelData,
PacketTypeVoxelSet,
PacketTypeVoxelSetDestructive,
PacketTypeVoxelErase,
PacketTypeOctreeStats, // 26
PacketTypeVoxelErase, // 25
PacketTypeOctreeStats,
PacketTypeJurisdiction,
PacketTypeJurisdictionRequest,
UNUSED_1,
UNUSED_2,
UNUSED_2, // 30
UNUSED_3,
UNUSED_4,
PacketTypeNoisyMute,
PacketTypeMetavoxelData,
PacketTypeAvatarIdentity,
PacketTypeAvatarIdentity, // 35
PacketTypeAvatarBillboard,
PacketTypeDomainConnectRequest,
PacketTypeDomainServerRequireDTLS,
PacketTypeNodeJsonStats,
PacketTypeEntityQuery,
PacketTypeEntityData, // 41
PacketTypeEntityQuery, // 40
PacketTypeEntityData,
PacketTypeEntityAddOrEdit,
PacketTypeEntityErase,
PacketTypeEntityAddResponse,
PacketTypeOctreeDataNack, // 45
PacketTypeVoxelEditNack,
PacketTypeAudioEnvironment,
PacketTypeEntityEditNack, // 48
PacketTypeEntityEditNack,
PacketTypeSignedTransactionPayment,
PacketTypeIceServerHeartbeat,
PacketTypeIceServerHeartbeat, // 50
PacketTypeIceServerHeartbeatResponse,
PacketTypeUnverifiedPing,
PacketTypeUnverifiedPingReply