Hi Andreas.
The mp3rtp application does some nasty things. It does not correctly increment the RTP timestamp indeed. It should increment with a 90 KHz tick rate and it should increment by 1152 samples every whole frame. In my case I am encoding PCM audio @ 48 KHz (24 ms) so it should increment of 2160 ticks every time (assuming 1 frame per packet).
It is important to have the 4 byte 0s header inside the payload before the actual MP3 header.
Yes 1 byte more or less returned by the encoding routine is consistent (at least when disabling bit reservoir and using CBR). It varies from time to time because the number of encoded bytes is fractional.
There is a calculation that predicts the number of bytes used by the encoder:
FrameSize = 144 * BitRate / (SampleRate + Padding).
I also specified input and output sample rates to be the same (48 KHz).
I could play the stream with VLC by using rtp://<mcast addr>:<port>
Follows the sample code I am using to initialize the encoder
int ql_level[] = {7, 5, 2};
// init LAME MP3 encoder
gfp = lame_init();
lame_set_num_channels(gfp, AUDIO_CHAN);
lame_set_in_samplerate(gfp, AUDIO_FREQ);
lame_set_out_samplerate(gfp, AUDIO_FREQ);
lame_set_brate(gfp, br_level[quality]);
lame_set_mode(gfp, JOINT_STEREO);
lame_set_VBR(gfp, vbr_off);
lame_set_disable_reservoir(gfp, TRUE);
lame_set_quality(gfp, ql_level[quality]); /* 7=low 5=medium 2=high */
lame_init_params(gfp);
// an MP3 frame is 1152 samples
chunk_size = 4608;
and I use the following for compressing the PCM data:
*len = lame_encode_buffer_interleaved(gfp, (short *) encbuf, chunk_samples, buf, max_len);
I am using live555 to stream the audio and it work quite good.
I would suggest you to first create a mp3 file by appending the various encoded frames returned by lame and checking that is being correctly encoded by playing it back on the PC.
Then to check that the audio is being correctly streamed over RTP by using wireshark and VLC to playback it.
Live555 includes the live555MediaServer utility that may be used to compare the RTP stream to help spotting errors in the RTP protocol.
Best regards,
Giulio