audio rtp input stream plays short audio sections aftre source stopped

This forum is about all development around libVLC.
royb
New Cone
New Cone
Posts: 4
Joined: 01 Jun 2020 17:29

audio rtp input stream plays short audio sections aftre source stopped

Postby royb » 01 Jun 2020 17:56

Hello

I wrote a little c# program, using libvlcsharp 3.4.5 and libvlc 3.0.10, that plays incoming rtp audio stream (alaw, 8000Hz, 16bit, mono).

The program works fine and the audio plays well but i have encountered a strange issue.

My program keep running all the time waiting for a source to send audio to it.

After the audio source is stop sending data to my program, I hear section from the audio that sent from the source (a few second of playing) every 80 to 90 seconds although there is no source that sending data.

I do not here such a thing in the VLC player.

Does anybody encounter this problem and can help me avoid it?

my code is very simple:

public LibVLC _libVLC = null;
public MediaPlayer _mp = null;
public Media _media = null;

...

Core.Initialize();

...

_libVLC = new LibVLC();

_mp = new MediaPlayer(_libVLC);
videoView1.MediaPlayer = _mp;//not necessary
_media = new Media(_libVLC, "rtp://@:12016", FromType.FromLocation);
_media.AddOption(":network-caching=1000");
bool res = _mp.Play(_media);


Thank you very much

Roy

mfkl
Developer
Developer
Posts: 740
Joined: 13 Jun 2017 10:41

Re: audio rtp input stream plays short audio sections aftre source stopped

Postby mfkl » 02 Jun 2020 14:29

Please share full logs

Code: Select all

_libVLC.Log += (s, e) => System.Diagnostics.Debug.WriteLine(e.FormattedLog);
https://mfkl.github.io

royb
New Cone
New Cone
Posts: 4
Joined: 01 Jun 2020 17:29

Re: audio rtp input stream plays short audio sections aftre source stopped

Postby royb » 03 Jun 2020 17:01

Hello

Thanks for your help

Attached is the log file:

Code: Select all

https://pastebin.com/5PRHf0WH


I didn't mentioned before but I'm using Windows 10, 64 bit, and c#, WinForms at Visual Studio 2015, .Net Framework 4.5.2.

I did a few test (more than 5) and get the following results for all of them:

Start my program and initialize libvlc to start listent to rtp input.
Wait 5 seconds and start send rtp audio streem from another PC.
Stop the transmitting PC after a period of time - three minutes at the test that the attached log is belong to.
My program keep running and listening to input rtp stream but no one send data to it now.

after 16 seconds from stopping the transmitting PC, two "thread exited" messages added to the log:
The thread 0x33dc has exited with code 0 (0x0).
The thread 0x2424 has exited with code 0 (0x0).

After 1:37 minutes from stopping the transmitting PC there was about one second of playing musing in the speakers - nothing in the log.

After 2:49 minutes from stopping the transmitting PC another "thread exited" messages added to the log:
The thread 0x1a64 has exited with code 0 (0x0).

* This "thread exited" message appears only in the test that the transmitting PC plays more than 1:30 minutes (I make few test with minute and a half of playing and this "thread exited" message didn't appear).

After 3:17 minutes from stopping the transmitting PC there was another second of playing musing in the speakers - nothing in the log.

After 4:55 minutes from stopping the transmitting PC there was another second of playing musing in the speakers - nothing in the log.

After 6:33 minutes from stopping the transmitting PC there was another second of playing musing in the speakers - nothing in the log.

Please notice that in all of the tests, all of the above events happened in the exact same times (in all test 16 seconds for two ""thread exited" messages, and music always played at 1:37, 3:17, 4:55 etc.).

I think that in each time of the above events, the same part of music was played (different music at each test of course).

In some test there were only "ticks" in the speakers (in the exact same times as described above) and not playing music.


Any help will be appreciated

Thanks a lot

Roy

royb
New Cone
New Cone
Posts: 4
Joined: 01 Jun 2020 17:29

Re: audio rtp input stream plays short audio sections aftre source stopped

Postby royb » 10 Jun 2020 10:51

Hi

I did a few more tests and found that the phenomenon I described above is only happen in the 64 bit version of the library.

I compiled my program as X86 (instead of ANY CPU) and those "glitches" disappeared.

But now, In the 32 bit version, I face a bigger issue.

The libvlc played me a minute and a half of music without any source. Just out of its buffer (I guess).

The scenario was:

I run my program and it wait to play incoming RTP audio stream.
I then start sending an RTP audio stream from another PC ,using VLC program, for minute and half.
I then stop the remote PC (by pressing stop at the VLS player), wait a few seconds, play again a short (few seconds) stream of audio from the remote PC (by pressing the play button at the VLC player) and stopped the remote PC again.

In all of that time my program played the incoming RTP audio stream as accepted.

And here comes the problem:
A few seconds after I stopped the remote VLC player, and there was nothing sends data to my program, my program start to play the hole minute and a half that was sent at the start, by itself with no source that sends the data.

I am pretty sure that during my tests I encountered this problem with the VLC player itself - The VLC player was suddenly start playing sections of music that sent to it before, without any source that sends data to it at that moment.
(In those test I used the VLC player to receive the incoming RTP audio stream and play it, instead of using my program).

I'm pretty sure that there is a bug in VLC. It seems that it plays old audio from its buffer when it does not suppose to do so.


The incoming RTP audio stream is in ALAW format and I use the VLC player that sends the data with the following command:

:sout=#transcode{vcodec=none,acodec=alaw,ab=16,channels=1,samplerate=8000,scodec=none}:rtp{dst=10.0.0.53,port-audio=30000}


I would appreciate any help to try and solve this problem

Thanks a lot

Roy

mfkl
Developer
Developer
Posts: 740
Joined: 13 Jun 2017 10:41

Re: audio rtp input stream plays short audio sections aftre source stopped

Postby mfkl » 10 Jun 2020 15:49

I did a few more tests and found that the phenomenon I described above is only happen in the 64 bit version of the library.
Did you compare logs from your x64 app with logs from your x86 app? Also share them both if you can.
https://mfkl.github.io

royb
New Cone
New Cone
Posts: 4
Joined: 01 Jun 2020 17:29

Re: audio rtp input stream plays short audio sections aftre source stopped

Postby royb » 11 Jun 2020 11:32

Hello mfkl

Thanks for answering

I had a mistake in my previous message.
In the first tests I did my program was compiled to ANY CPU but although my PC is win10 64bit it used the win-x86 lib of VLC and not the 64bit ver (thats what the log says).
So my conclusion about 64bit/32bit is incorrect.

'ANY CPU' log (from my prev massage):
[url]https://pastebin.com/5PRHf0WH[/url]

I then changed my project to X86 and did a few more test and described the result in the prev message.

Today I repeat the tests with X86 and X64 and found that X86 and X64 are acting the same.
The program is suddenly start playing, for a few seconds, section from the incoming audio (it plays from the start of the stream) away after the transmitting PC stopped transmit.
i.e my program played the incoming stream when it was transmitted (as accepted) and stop playing when the transmitting PC stop transmit, and suddenly, after a few seconds (usually it takes more than a minute), without any transmitting source, my program start playing sections from the previously received audio, by itself.

The time between stop transmitting and start of unwanted playing is changed depending the length of the transmitted stream.
The length of the unwanted playing and the number of unwanted playing section is also depend on the transmit scenario.

attaching two logs:

X86 log:
[url]https://pastebin.com/QvBLiEy1[/url]

X64 log:
[url]https://pastebin.com/3TRuhtbV[/url]

Thank you very much

Roy

mfkl
Developer
Developer
Posts: 740
Joined: 13 Jun 2017 10:41

Re: audio rtp input stream plays short audio sections aftre source stopped

Postby mfkl » 11 Jun 2020 13:21

tbh I don't think I understood your initial issue. Try in vlc-ios or vlc-android so see if you can repro the issue or if it only works fine in vlc desktop.
https://mfkl.github.io


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 14 guests