Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linuxtv-softmpeg] Re: audio.c patch



Hello Carsten,

thanks for your work!

On 02/24/04 20:38, ckroll@arcor.de wrote:
I finally figured out what the problem with my audio stream playback was.
I try to play an SVCD compliant mpeg stream. The audio has a 44100Hz sample rate. With this sample rate the frame size is not constant.
Hm, this sounds bogus. MP2 audio has always a fixed frame size (have a look at mpegaudio.c)

Are you sure your SVCD contains MP2 audio?

Can you upload a few megabytes of that stream to anywhere, so I can have a look?

That caused lots of problems. I fixed this issue in audio.c.
Unfortunately I do not know how it affects other types of mpeg streams. In theory it should be fine :-).
So I attach a patch that contains my fix. Please review it in case I made any mistakes here. The audio decoding now works for this, but the playback is still jerky.
Most likely it will have side effects. Did you try if "dfb_ts" still works?

> if (d->as.len >= ac.frame_size) {
> int ret;
> - int i = 0;
> unsigned char *ptr = d->as.buf;
> while (d->as.len > ac.frame_size) {
> int chunk_len = 0;
> - AUDIO_PES("writing %d bytes to avcodec\n", ac.frame_size);
> - ret = avcodec_decode_audio(d->codec_ctx, (int16_t *) (d->current->buf + d->current->len), &chunk_len, ptr, ac.frame_size);
> - if (ac.frame_size == ret) {
> + AUDIO_PES("writing %d bytes to avcodec\n", d->as.len);
> + ret = avcodec_decode_audio(d->codec_ctx, (int16_t *) (d->current->buf + d->current->len), &chunk_len, ptr, d->as.len);

This looks bogus. The check d->as.len >= ac.frame_size doesn't make any sense anymore, when you later write out the whole d->as.len bytes because you think the frame size is not constant. Against what frame size does this "check" compare?

I will look at the video decoding problem next. I guess it has to do with the frame resolution not being 768x576.
Make sure your refresh rate is 50Hz. "fbset" will tell you that:

hunoldwin root # fbset

mode "720x576-50"
    # D: 32.043 MHz, H: 31.049 kHz, V: 49.999 Hz
                                      ^^^^^^^^^^^

regards Carsten
CU
Michael.


--
Info: To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe linuxtv-softmpeg" as subject.



Home | Main Index | Thread Index