java - Calculate real-time transfer rate of MediaRecorder while streaming over a socket -
i using mediarecorder capturing user's voice , streaming in amr-wb format on wi-fi socket connection:
mediarecorder.setoutputfile(parcelfiledescriptor.fromsocket(socket).getfiledescriptor());
i want display transfer rate on screen , looking best way implement this. can think of 2 solutions myself:
- create localsocket-localserversocket loop , transfer data using buffers. add unnecessary delay , increase performance overhead.
- calculate transfer data based on codec's characteristics. e.g., (size of each sample) * (samples per second). solution not work networks random delays or codecs variable encoding rates.
is there other way?
parcelfiledescriptor.createpipe() create pipe you.
you can write pipe , count bytes read other end before streaming them off aether...
Comments
Post a Comment