Post

Replies

Boosts

Views

Activity

Comment on About dividing Data type data into small pieces to fit in datagram size
What I am trying to do is to build a Walkie-Talkie app. At first, I watched WWDC video introducing Network.framework and decided to use Network.framework to implement networking in my Walkie-Talkie app. The reason I choose Network.framework is that it I was trying to implement my app's networking by socket programming, and Network.framework is introduced as modern alternative to socket programming. After that, I decided to use Peer-to-Peer network because I wanted my app to work without any main server, and I thought P2P network fits concept of walkie-talkie(nearby communication). To accomplish implementing P2P network using Network.framework, I found an Tic-Tac-Toe example using Peer to Peer option in Network.framework, and used it as guidance of my app. While implementing my walkie-talkie app, I first tried to implement a real-time voice streaming using sockets, but it was too difficult to accomplish. -> I think this is where I thought I should use UDP in my project. Because what I was trying to implement was VoIP, and UDP is ideal solution for it. After few research, I figured out that most of Push-To-Talk apps record user's voice and sends it, not real-time streams it. So I decided to record and send user's voice to implement Push-To-Talk, and I still thought UDP is ideal solution for it, because it is voice data I am trying to send, and I thought little loss would be okay while fast response is very important in walkie-talkie.
May ’22
Comment on About dividing Data type data into small pieces to fit in datagram size
Thank you very much! I have tried to solve my problem via UDP. I have implemented an extension in Data type to convert AVAudioPCMBuffer into Data and vice versa. AVAudioPCMBuffer type data is 4096 sized buffer from device mic input. Flow of data is like this. buffer data : AVAudioPCMBuffer -> Data -> send via UDP -> Data -> AVAudioPCMBuffer -> AVAudioPlayer.scheduleBuffer(buffer) -> AVAudioPlayer.play(). Still, I need to reduce size of converted buffer data because that converted data is a bit larger than maximumDatagramSize, but I think this should be another type of question, so maybe I will write another post for it. Thanks for your help again!
May ’22