Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Using the IPP MP3Encoder

bitsmaker
Beginner
599 Views
Hello,
I am not sure if I am using the MP3Encoder correctly, but here is my issue. I am using this in the context of encoding live audio to be sent via an RTP stream.
The Encoder is intiailized using
[bash]UMC::MP3EncoderParams audioCodecParams; audioCodecParams.m_info_in.channels = channels; audioCodecParams.m_info_in.sample_frequency = sampleRate; audioCodecParams.m_info_in.channel_mask = 0; audioCodecParams.m_info_out.bitrate = bitRate; audioCodecParams.layer = 3; audioCodecParams.force_mpeg1 = 1; audioCodecParams.stereo_mode = UMC_MPA_LR_STEREO; audioCodecParams.mode = 0; audioCodecParams.mc_matrix_procedure = 0; audioCodecParams.mc_lfe_filter_off = 0; audioCodecParams.m_pData = NULL; [/bash]
Then when I have my PCM sample of size 4608 (1152 * 2 channels * 2 bytes) I call
[bash]status = m_spMP3Encoder->GetFrame(pIn, &m_mediaOutputDataVec[m_outputIndex]);[/bash]
Them_mediaOutputDataVec does not contain the full encoding of the 4608 bytes (I am supposed to get at least 417 encoded bytes, I always get less than that). Thus I put the above line in a loop and keep looping till I getUMC::UMC_ERR_END_OF_STREAM in status.
[bash]do { status = m_spMP3Encoder->GetFrame(pIn, &m_mediaOutputDataVec[m_outputIndex]); pIn = NULL; } while (status != UMC::UMC_ERR_END_OF_STREAM)[/bash]
The next time I call GetFrame with my next sample of size 4608 GetFrame never returns. I stepped through it and I can see it is stuck in an infinite loop in
mp3enc_bitstream.c line 984 in the do { //code } while (bytes).

I do not believe I am using this GetFrame correctly. A sample application would be extremely useful. I looked through the applications directory in the IPP installation and did not find any.
Thanks a lot for your help
0 Kudos
7 Replies
Sergey_K_Intel
Employee
599 Views
Hi,
You don't need to flush encoder (i.e. use NULL input) until you're really going to close audio. What happens if you don't use NULLs?
Regards,
Sergey
0 Kudos
bitsmaker
Beginner
599 Views
If I do not use NULLs then it will continue to give me the partial encoded data.
However, if I do take this approach then for every PCM sample of size 4608 I get only part of the encoded (MP3) data in the first call to GetFrame. In the next call I send the next sample of size 4608 and I get the remainder of the encoded data from the first sample and part of the second.
I would think that given a sample of PCM data the GetFrame would return ALL of the encoded data for that sample and not return only a part of it.
0 Kudos
bitsmaker
Beginner
599 Views
Any further thought on this?
0 Kudos
Gaurav_M_
Beginner
599 Views

Hi,

We are encountering the same issue (stuck inside an infinite loop in mp3enc_bitstream.c line 984) while trying to encode PCMU to MP3..

Also we don't flush the encoder using NULL input.

Did you guys figure out the solution for this problem yet ?

Thanks in advance.

 

0 Kudos
Gaurav_M_
Beginner
599 Views

Hi,

We are facing the same problem described here (stuck in an infinite loop in mp3enc_bitstream.c line 984).

Also we are not passing NULL input to the encoder anywhere in our code.

Did you guys figure out a solution for this problem yet ?

Thanks in advance.

0 Kudos
bitsmaker
Beginner
599 Views

If I remember correctly one has to not use NULLs and get the partial data. Then combine data for two packets worth and send it. See the mp3streamer test app in live555.

0 Kudos
Gaurav_M_
Beginner
599 Views

bitsmaker wrote:

If I remember correctly one has to not use NULLs and get the partial data. Then combine data for two packets worth and send it. See the mp3streamer test app in live555.

Thanks for you  reply.

As mentioned in my earlier post we are not passing NULL input at all to the encoder and still facing the problem with IPP version 6.1.6.

Other strange thing is that the issue is seen while running our software on Virtual Machine and things work fine when it is run on a physical machine.

Any other suggestions/thoughts ?

0 Kudos
Reply