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) { int InboundAudioStream::parseStreamProperties(PacketType type, const QByteArray& packetAfterSeqNum, int& numAudioSamples) {
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. // mixed audio packets do not have any info between the seq num and the audio data.
numAudioSamples = packetAfterSeqNum.size() / sizeof(int16_t); numAudioSamples = packetAfterSeqNum.size() / sizeof(int16_t);
return 0; return 0;
}
} }
int InboundAudioStream::parseAudioData(PacketType type, const QByteArray& packetAfterStreamProperties, int numAudioSamples) { 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 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 // NOTE: if you want the name of the packet type to be available for debugging or logging, update nameForPacketType() as well
enum PacketType { enum PacketType {
PacketTypeUnknown, PacketTypeUnknown, // 0
PacketTypeStunResponse, PacketTypeStunResponse,
PacketTypeDomainList, PacketTypeDomainList,
PacketTypePing, PacketTypePing,
PacketTypePingReply, PacketTypePingReply,
PacketTypeKillAvatar, PacketTypeKillAvatar, // 5
PacketTypeAvatarData, PacketTypeAvatarData,
PacketTypeInjectAudio, PacketTypeInjectAudio,
PacketTypeMixedAudio, PacketTypeMixedAudio,
PacketTypeMicrophoneAudioNoEcho, PacketTypeMicrophoneAudioNoEcho,
PacketTypeMicrophoneAudioWithEcho, PacketTypeMicrophoneAudioWithEcho, // 10
PacketTypeBulkAvatarData, PacketTypeBulkAvatarData,
PacketTypeSilentAudioFrame, PacketTypeSilentAudioFrame,
PacketTypeEnvironmentData, PacketTypeEnvironmentData,
PacketTypeDomainListRequest, PacketTypeDomainListRequest,
PacketTypeRequestAssignment, PacketTypeRequestAssignment, // 15
PacketTypeCreateAssignment, PacketTypeCreateAssignment,
PacketTypeDomainConnectionDenied, PacketTypeDomainConnectionDenied,
PacketTypeMuteEnvironment, PacketTypeMuteEnvironment,
PacketTypeAudioStreamStats, PacketTypeAudioStreamStats,
PacketTypeDataServerConfirm, PacketTypeDataServerConfirm, // 20
PacketTypeVoxelQuery, PacketTypeVoxelQuery,
PacketTypeVoxelData, PacketTypeVoxelData,
PacketTypeVoxelSet, PacketTypeVoxelSet,
PacketTypeVoxelSetDestructive, PacketTypeVoxelSetDestructive,
PacketTypeVoxelErase, PacketTypeVoxelErase, // 25
PacketTypeOctreeStats, // 26 PacketTypeOctreeStats,
PacketTypeJurisdiction, PacketTypeJurisdiction,
PacketTypeJurisdictionRequest, PacketTypeJurisdictionRequest,
UNUSED_1, UNUSED_1,
UNUSED_2, UNUSED_2, // 30
UNUSED_3, UNUSED_3,
UNUSED_4, UNUSED_4,
PacketTypeNoisyMute, PacketTypeNoisyMute,
PacketTypeMetavoxelData, PacketTypeMetavoxelData,
PacketTypeAvatarIdentity, PacketTypeAvatarIdentity, // 35
PacketTypeAvatarBillboard, PacketTypeAvatarBillboard,
PacketTypeDomainConnectRequest, PacketTypeDomainConnectRequest,
PacketTypeDomainServerRequireDTLS, PacketTypeDomainServerRequireDTLS,
PacketTypeNodeJsonStats, PacketTypeNodeJsonStats,
PacketTypeEntityQuery, PacketTypeEntityQuery, // 40
PacketTypeEntityData, // 41 PacketTypeEntityData,
PacketTypeEntityAddOrEdit, PacketTypeEntityAddOrEdit,
PacketTypeEntityErase, PacketTypeEntityErase,
PacketTypeEntityAddResponse, PacketTypeEntityAddResponse,
PacketTypeOctreeDataNack, // 45 PacketTypeOctreeDataNack, // 45
PacketTypeVoxelEditNack, PacketTypeVoxelEditNack,
PacketTypeAudioEnvironment, PacketTypeAudioEnvironment,
PacketTypeEntityEditNack, // 48 PacketTypeEntityEditNack,
PacketTypeSignedTransactionPayment, PacketTypeSignedTransactionPayment,
PacketTypeIceServerHeartbeat, PacketTypeIceServerHeartbeat, // 50
PacketTypeIceServerHeartbeatResponse, PacketTypeIceServerHeartbeatResponse,
PacketTypeUnverifiedPing, PacketTypeUnverifiedPing,
PacketTypeUnverifiedPingReply PacketTypeUnverifiedPingReply