[Live-devel] IT WORKS!! And now....

Riccardo Rosapepe rkrsp at hotmail.com
Wed May 12 10:32:42 PDT 2004


Dear Mr. Finlayson,

Thank you very much for your support and for your clear and concise answers 
without which i would have spent days and days to solve the problem.

You were right... i needed to stream unicast, and needed to read packets 
from tcp because something blocks udp packets on gprs network.

I re-wrote my app from bottom-up to support unicast, basing it on 
testOnDemandRTSPServer, re-using only VideoDevice and Encoder class from 
former multicast streaming application.

Now i can stream from gprs network and i can seee movies from a linux 
machine on the lan using
mplayer launched with -rtsp-stream-over-tcp from command line.

I hope we will fix this udp-blocking problem with the ISP but for now we 
have an important demo and we can't wait.

now.. some questions..

1) is possible in other players ( QuickTime, VLC ) running on windows to 
have an option equivalent to "rtsp-stream-over-tcp" ?

2) which settings do you suggest to have an efficient stream with very low 
bandwidth ( 12 Kbps )? actually my stream is encoded at 3 fps , resolution 
of 176x144 and a very low bitrate.. quality is acceptable but i would like 
to increase frame rate but i think i have reached the limit.. ... is the 
only solution to reduce frame resolution or there is another way?

3) Is my implementation correct? I subclassed from FileServerMediaSubsession 
then when i redefined createNewStreamSource....

FramedSource* StreamerMPEG4VideoFileServerMediaSubsession
::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate)
{
  estBitrate = 50000; // kbps, estimate

  // Create the video source:
VideoDeviceSource *deviceSource  = VideoDeviceSource::createNew(envir(), 
&web_cam, &encoder );
    if ( deviceSource == NULL)
        return NULL;

    return MPEG4VideoStreamFramer::createNew(envir(), deviceSource );// 
fileSource);
}

where VideoDeviceSource  is my subclass of FramedSource that in (pherhapsly 
)the most important func does...

void VideoDeviceSource::deliverFrame()
{
        if( !_videoDevice->Acquire())
        {
            badRead = true;
        }

        if( ( !badRead ) && b_encoder_active )
        {
            _videoDevice->GetFrameResolution( &w , &h );
            if( gui_is_on )
                manager.drawVideoOverlay( _videoDevice->GetFrameData(), w, h 
);

            unsigned long encoded_frame_size =  _encoder->Encode( 
_videoDevice->GetFrameData() ,w , h);


           if( encoded_frame_size > fMaxSize )
               encoded_frame_size = fMaxSize;
          fFrameSize = encoded_frame_size;

          memcpy( fTo, _videoDevice->GetFrameData(), fFrameSize );

         // Set the 'presentation time':
         if (fPlayTimePerFrame > 0 && fPreferredFrameSize > 0 )
        {
                if ( fPresentationTime.tv_sec == 0 && 
fPresentationTime.tv_usec == 0 )
	{
	        gettimeofday(&fPresentationTime, NULL);
	}
	else
	{
	         unsigned uSeconds       = fPresentationTime.tv_usec + 
fLastPlayTime;
	         fPresentationTime.tv_sec += uSeconds/1000000;
	         fPresentationTime.tv_usec = uSeconds%1000000;
	}
	// Remember the play time of this data:
	fLastPlayTime = (fPlayTimePerFrame*fFrameSize)/fPreferredFrameSize;
	fDurationInMicroseconds = fLastPlayTime;
         }
         else
              gettimeofday(&fPresentationTime, NULL );

        // After delivering the data, switch to another task, and inform
        // the reader that he has data:
        nextTask() = envir().taskScheduler().scheduleDelayedTask(0, 
(TaskFunc*)afterGetting,this);
    }
}

Thank you for any help.

Riccardo Rosapepe

_________________________________________________________________
Ricerche online più semplici e veloci con MSN Toolbar! 
http://toolbar.msn.it/



More information about the live-devel mailing list