[PATCH] Re: wav-player broken for CCITT u/a-law files in 1.10 (and 2.x) after Ticket #597

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

 



Hello Benny,

As mentioned it is related to setting the file position.

Our code always using pjsua_player_set_pos(), because that code can also be
called for continueing playing a prompt where it was stopped.

So after creating the wav_player port, you need to call the set_pos method.
How to reproduce:
1. Create the player port (using the file I have provided which is clearly
audible)
2. Next call next method: pjsua_player_set_pos() with offset is 0
3. Connect to the conference bridge to start playing.

Action 2 will actually initiate the problem.
Explained:
In wav_player.c:
If you check the fill_buffer(), you shall see that after reading from the
file, the fport->data_left (represents the audio-data in chain) is decreased
and the fpos (file position) is increased with the amount of data read
(size).
The fill_buffer() is called first time on the
pjmedia_wav_player_port_create(). After this (within fill_buffer()), the
file position is set +4000 bytes further and data_left is decreased with
+4000.
Now if you do the pjsua_player_set_pos(), with offset 0 (so re-start from
beginning). This will call the pjmedia_wav_player_port_set_pos(), and the
file position (fpos) will be reset.
However.... fport->data_left is un-touched and still counts +4000 bytes.
The last action in pjmedia_wav_player_port_set_pos() is again the
fill_buffer().
>From this point there is a mis-match between fpos and data_left.
As result the fill_buffer stops much earlier (because it is using
->data_left).
So the more time you use _set_pos, the more mismatch there will be.

Hope this helps.
I've already deployed this patch and was told by our testers that it now
works as expected.


With regards,

Eize

> Hello Benny,
> >
> > I probably have the solution for mentioned problem. It was indeed that
> the
> > fport->data_left wasn't updated on a file-position change.
> > Please have a check if I did not oversee something, and please add it to
> the
> > 1.x and 2.x tree.
> >
>
> I just tried your WAV file with pjsua from the latest 1.x and 2.0, and
> it sounds fine to me, with or without playback loop. Can you tell me
> the exact way to reproduce it?
>
>  Benny
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20111023/1f2575bf/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux