[Live-devel] startPlaying - stopPlaying - startPlaying issues

David BERTRAND bidibulle at operamail.com
Fri Feb 24 12:24:57 PST 2006


Thanks Ross.

I initially made my patch under Linux and forgot to think of my dear friend Bill G ... Oops !
So, I made a new version of it trying to take into account all OS supported by liveMedia. 
As I agree with you that this it not cleanest way to do it, for the moment I will do my buffer reset outside MultiFramedRTPSource class to keep using a clean up-to-date version of the library. I guess the code of the patch could be reused later and probably somewhere in GroupsockHelper.cpp.

David

void MultiFramedRTPSource::doGetNextFrame() {
  if (!fAreDoingNetworkReads) {
    // Turn on background read handling of incoming packets:
    fAreDoingNetworkReads = True;

   // proposed patch to livemedia  
	char* buffer = new char[1000000];
 #if defined(__WIN32__) || defined(_WIN32) || defined(IMN_PIM)
    unsigned long arg = 1;
    if (ioctlsocket(fRTPInterface.gs()->socketNum(), FIONBIO, &arg) != 0) {

#elif defined(VXWORKS)
    int arg = 1;
    if (ioctl(fRTPInterface.gs()->socketNum(), FIONBIO, (int)&arg) != 0) {

#else
    int curFlags = fcntl(fRTPInterface.gs()->socketNum(), F_GETFL, 0);
    if (fcntl(fRTPInterface.gs()->socketNum(), F_SETFL, curFlags|O_NONBLOCK) < 0) {
#endif
      envir() << strerror(errno);
    }
    
    SOCKLEN_T addressSize = sizeof fRTPInterface.gs()->groupAddress();
    int bytesRead = 0;
    int curBytesRead;
    while ((curBytesRead = recvfrom(fRTPInterface.gs()->socketNum(),buffer, sizeof(buffer), 0,(struct sockaddr*)(&fRTPInterface.gs()->groupAddress()),&addressSize)) > 0) { 
		bytesRead += curBytesRead;
    }
    if (bytesRead > 0) {
		envir() << "Flushed " << bytesRead << " old bytes in total";
    }

 #if defined(__WIN32__) || defined(_WIN32) || defined(IMN_PIM)
    arg = 0;
    if (ioctlsocket(fRTPInterface.gs()->socketNum(), FIONBIO, &arg) != 0) {

#elif defined(VXWORKS)
    arg = 0;
    if (ioctl(fRTPInterface.gs()->socketNum(), FIONBIO, (int)&arg) != 0) {

#else
    if (fcntl(fRTPInterface.gs()->socketNum(), F_SETFL, curFlags) < 0) {
#endif
      envir() << strerror(errno);
    }

....


> ----- Original Message -----
> From: "Ross Finlayson" <finlayson at live555.com>
> To: "LIVE555 Streaming Media - development & use" <live-devel at ns.live555.com>
> Subject: Re: [Live-devel] startPlaying - stopPlaying - startPlaying  issues
> Date: Fri, 24 Feb 2006 01:20:32 -0800
> 
> 
> David,
> 
> I'll add your second patch shortly.  However, re. your first patch: 
> I'm just not sure right now how (or if) this can be done in a way 
> that's both (i) reasonably clean, and (ii) portable to Windows as 
> well as Unix.  So I'll hold off on that for now.
> 
> 
> 	Ross Finlayson
> 	Live Networks, Inc. (LIVE555.COM)
> 	<http://www.live555.com/>
> 
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel

>


-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 8 at http://www.opera.com

Powered by Outblaze



More information about the live-devel mailing list