i-sandeep / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

Playing AAC decoded audio with Android Audiotrack #453

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, i need to play AAC audio coming from red5 server on Android device, i 
have decoded audio by using javacv-ffmpeg, but don't know to play it with 
Audiotrack, as it needs short[] or byte[], and we get Frame.samples as Buffer.
Here is what i have done
What steps will reproduce the problem?
1. Decoded the AAC audio with javacv FFMPEGFramegrabber
2. int len = avcodec.avcodec_decode_audio4( audio_c,  samples_frame,  
got_frame,  pkt2);
3. BytePointer ptemp = samples_frame.data(0);
4. BytePointer[] temp_ptr = new BytePointer[1];
5. temp_ptr[0] = ptemp.capacity(sample_size);
6. ByteBuffer btemp = ptemp.asBuffer();
7. byte[] buftemp = new byte[sample_size];
8. btemp.get(buftemp, 0, buftemp.length);
9. player.write(buftemp,0,buftemp.length);

What is the expected output? What do you see instead?
Expected to here voice, sound, but only noise like gun-shots firing is heard 

What version of the product are you using? On what operating system?
I am using javacv-0.7 version

Please provide any additional information below.
Is there any processing need to be done, like processImage() function for audio.

Original issue reported on code.google.com by vishalc...@gmail.com on 1 Apr 2014 at 8:01

GoogleCodeExporter commented 9 years ago
You could use ShortBuffer.get(short[]) to convert the ShortBuffer into a 
short[].

Please ask your questions on the mailing list, if possible, not here, thank you.

Original comment by samuel.a...@gmail.com on 1 Apr 2014 at 12:21

GoogleCodeExporter commented 9 years ago
http://revealedtricks4u.blogspot.in/2015/03/play-audio-sample-grabbed-using-java
cv.html

Original comment by pacordo...@gmail.com on 31 Mar 2015 at 2:35