Reputation: 554
I work with some Android SDK , which has an ability of VOIP .
When voice data is received , some event is fired . Each time its fired , it has a byte[] , which is one OPUS frame. So this event fired several times , each time with new frame .
My question is , how can I create a playable audio file with it ? I tried to create an byte[] , and each time event was fired , appen a data to it, and then save a this array to a file and then play it .
It did not worked , what I am missing ?
Upvotes: 1
Views: 765
Reputation: 60923
Android can play Opus stored in a Matroska/WebM container or an Ogg container. Matroska can be written using the libmatroska library. Ogg can be written using the libogg library.
If you simply concatenate the packets one after another then that will lose the packet boundaries. The packets vary in length and the length of each packet is needed to decode it.
Upvotes: 1