TDAudioStreamer icon indicating copy to clipboard operation
TDAudioStreamer copied to clipboard

Offset error

Open NickSuglobov opened this issue 11 years ago • 10 comments

Hi! I found that you are adding offset twice in your code. The sample is working because offset is 0 for current audio format. Not working with aac. In class TDAudioStreamer, line 68 memcpy((char *)(self.audioQueueBuffer->mAudioData + self.fillPosition), (const char *)(data + packetDescription.mStartOffset), packetDescription.mDataByteSize); and line 46: memcpy((char *)(self.audioQueueBuffer->mAudioData + self.fillPosition), (const char *)(data + offset), length);

This offset is already added in class TDAudioFileStream, line 85 [self.delegate audioFileStream:self didReceiveData:(const void *)(packets + packetOffset) length:packetSize packetDescription:(AudioStreamPacketDescription)packetDescriptions[i]];

NickSuglobov avatar Sep 10 '14 15:09 NickSuglobov

does that affect the function of the app?

kristersj avatar Sep 10 '14 15:09 kristersj

Yes, this is a bug. I used TDAudioInputStreamer to play aac stream. Was not working. Fixed by removing superfluous "add offset".

NickSuglobov avatar Sep 10 '14 15:09 NickSuglobov

Have you forked the repo with that edit?

kristersj avatar Sep 10 '14 15:09 kristersj

no

NickSuglobov avatar Sep 10 '14 15:09 NickSuglobov

mind pushing that edit?

kristersj avatar Sep 10 '14 15:09 kristersj

ok

NickSuglobov avatar Sep 10 '14 15:09 NickSuglobov

Created pull request. Tell me if I did smth wrong.

NickSuglobov avatar Sep 10 '14 16:09 NickSuglobov

Pull request is correct. But i tested The Code and The song is still not in synch when playing on multple devices. Weird.

kristersj avatar Sep 10 '14 16:09 kristersj

Still not playing m4a, in the fork, there some way to do it?

Thanks in advance

ghost avatar Sep 11 '14 12:09 ghost

Could you give me some pointers about how to play aac playback work? I tried your branch but had no luck. Also, is m4a and aac the same thing we are mentioning? Because Apple uses m4a as the container of encoded aac.

DJBen avatar Feb 03 '15 15:02 DJBen