Hello. For various reasons I am writing my own source client. Most things seem to be working well. Connections work. shout_send() and shout_sync() seem to behave as expected. However, I find that if more than about 10-20 seconds passes between shout_send() calls then libshout crashes (takes my client down) during a subsequent shout_send(). Are there any rules about how often shout_send() should be called? (Yes, I know about shout_sync.) How can I keep the library from crashing if long stretches of time pass with no input to the server? Background: What I want to do is periodically stream a file (or several) to icecast, but with stretches of time in between with nothing playing. I want the mount-point active so that listeners can connect (even if nothing is currently playing). Then whenever my client sends another stream to icecast, the various listeners would just hear it. I don't want to use shout_close() and then shout_open() again after the long empty stretches, because then the listeners would have to reopen the stream from the server. Thanks, --George PS: Sorry if there is a separate libshout list. Please let me know if this is the wrong place. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/icecast-dev/attachments/20120917/d271ffb6/attachment.htm
On Mon, Sep 17, 2012 at 9:29 AM, George R. Welch <george at grwelch.com> wrote:> Hello. For various reasons I am writing my own source client. > > Most things seem to be working well. Connections work. shout_send() and > shout_sync() seem to behave as expected. > > However, I find that if more than about 10-20 seconds passes between > shout_send() calls then libshout crashes (takes my client down) during a > subsequent shout_send().Are you sure it's libshout crashing, and not your application? It's normal for libshout to return an error in this sort of situation, but I don't know of any bugs that would make it crash - but maybe your application isn't handling the error case correctly.> > Are there any rules about how often shout_send() should be called? (Yes, I > know about shout_sync.)Typically: multiple times per second. Worst case every couple of seconds is ok in most cases.> > How can I keep the library from crashing if long stretches of time pass with > no input to the server?Like I said: it shouldn't crash (see below).> > Background: What I want to do is periodically stream a file (or several) to > icecast, but with stretches of time in between with nothing playing. I want > the mount-point active so that listeners can connect (even if nothing is > currently playing). Then whenever my client sends another stream to icecast, > the various listeners would just hear it.That's not how icecast works. If the source client isn't sending data continuously, icecast will disconnect the source. It's up to you to create a continuous stream to send to icecast, even if it doesn't contain "interesting" content. Pure digital silence isn't recommended though, because it interacts badly with client buffer sizes. Mike
On 9/17/12 12:37 PM, Michael Smith wrote:> On Mon, Sep 17, 2012 at 9:29 AM, George R. Welch <george at grwelch.com> wrote: >> Hello. For various reasons I am writing my own source client. >> >> Most things seem to be working well. Connections work. shout_send() and >> shout_sync() seem to behave as expected. >> >> However, I find that if more than about 10-20 seconds passes between >> shout_send() calls then libshout crashes (takes my client down) during a >> subsequent shout_send(). > Are you sure it's libshout crashing, and not your application?Yes, I have checked carefully. I can supply you with a test program that demonstrates this if you like.> It's normal for libshout to return an error in this sort of situation, > but I don't know of any bugs that would make it crash - but maybe your > application isn't handling the error case correctly. > >> Are there any rules about how often shout_send() should be called? (Yes, I >> know about shout_sync.) > Typically: multiple times per second. Worst case every couple of > seconds is ok in most cases.OK, that is very useful.>> How can I keep the library from crashing if long stretches of time pass with >> no input to the server? > Like I said: it shouldn't crash (see below). > >> Background: What I want to do is periodically stream a file (or several) to >> icecast, but with stretches of time in between with nothing playing. I want >> the mount-point active so that listeners can connect (even if nothing is >> currently playing). Then whenever my client sends another stream to icecast, >> the various listeners would just hear it. > That's not how icecast works. If the source client isn't sending data > continuously, icecast will disconnect the source. > > It's up to you to create a continuous stream to send to icecast, even > if it doesn't contain "interesting" content. Pure digital silence > isn't recommended though, because it interacts badly with client > buffer sizes.Again, this is incredibly useful. I guess in between my batches of content I could just send it -80 db of pink noise, or something? Does that sound about right? Thank you very much for your help! --George
On 12-09-17 9:29 AM, George R. Welch wrote:> Background: What I want to do is periodically stream a file (or > several) to icecast, but with stretches of time in between with nothing > playing. I want the mount-point active so that listeners can connect > (even if nothing is currently playing). Then whenever my client sends > another stream to icecast, the various listeners would just hear it.As Mike says, that's not how icecast works. However, you can do something like this by specifying a fallback stream in the mount config. That should switch clients to the fallback stream if you aren't sending anything from your source. This is more important for video; sending digital silence for audio is cheap. :) -r