We are designing a p2p applications using c++ which transmits voice to other peer using UDP.
We are capturing a mic signal in a buffer in the thread which captures voice for one second in the while
loop. For every second voice captured in buffer it splits it into packets and sends to the other peer. Now I need a proper data structure at the destination which is copes real time transmission. Same data structure I am going to use for screen capturing. Here are two approaches using queue I thought of
Implementing a queue using a linked list which maintains a queue of
OneSecVoice
objects orImage
object in case of image.Implementing a queue using static array of
OneSecVoice
orImage
objects
OneSecVoice/Image
objects will contain a total number of packets, packets buffer for that particular Image/OneSecVoice
.
As its a real time one thread will continuously scan for queue and take out latest complete Image/OneSecVoice
by popping the Image/OneSecVoice
from queue.
So which to chose Implementing a queue using a linked list or Implementing a queue using static array.
Me and my friend are having fight over this so we decided to post here.