[Live-devel] Custom FramedSource for testOnDemandRTSPServer Problem
    Jeremiah Morrill 
    Jeremiah.Morrill at econnect.tv
       
    Thu Feb  2 11:18:24 PST 2012
    
    
  
While I didn't look at your code in detail, I didn't see you mention what you did with the h264 "subsession->fmtp_spropparametersets()".
In order for VLC to play, I believe you need to send the NAL units.  Try parsing the fmtp_spropparametersets with parseSPropParameters(...), and write each returned SPropRec::sPropBytes to a file like you are doing with your frames.  Make sure these get sent out first with playback.
Take my advice with a grain of salt as I'm still fairly new to these libs. :)
-Jer
-----Original Message-----
From: live-devel-bounces at ns.live555.com [mailto:live-devel-bounces at ns.live555.com] On Behalf Of Novalis Vapuru
Sent: Wednesday, February 01, 2012 8:32 AM
To: LIVE555 Streaming Media - development & use
Subject: [Live-devel] Custom FramedSource for testOnDemandRTSPServer Problem
Hi,
I finally able to modify  testOnDemandRTSPServer so that:
It uses my custom FramedSource...
Tests
--------
Test One:
--------
In order to test it:
1. I get video stream from h264 ip camera using OpenRTSPClient and
   write each Frame  to a single file[ Boolean oneFilePerFrame = True]  for 100 frame.
 2. I rename each frame file as vide1,...... video100
 3. I stream those frames[ 1...100] with my modified OnDemandRTSPServer using my custom FramedSource  4. I used OpenRTSPClient to connect modified OnDemandRTSPServer.
----------
Test Two:
---------
  Just change step 4 [above]:
  For step 4 i used VLC player as a client
Test Result:
----------------
Test Result One
----------------
 OpenRTSPClient successfully connect and write incoming data to single file [Boolean oneFilePerFrame = True] call it Result.h264 The Result.h264 is not a playbale file.I investigate its binary data with hex editor and MediaInfo Utility.
It does not seem to be correct H264 file...
-----------------
Test Result Two
-----------------
VLC connect to server but dows not show any stream
////////////////////////////////////////////////////////////////////
So Here is my Questions:
1. Is my test logic true? Should i expect to playable file at OpenRTSPClient side?
   Should I expect VLC should play file?
2. If my logic true, what i may do wrong in practice?
Wellcome to any ideas-suggestions  from who develop such a custom FramedSource for  testOnDemandRTSPServer...
Best Wishes
PS:-----------------------------------------------------------------------------------------------------------------------------
I attach my modified testOnDemandRTSPServer  code below
Files:
MyCustomFramedSource.h : This is a custom FramedSource for my custom MyCustomServerMediaSubsession MyCustomServerMediaSubsession.h : This is a custom OnDemandServerMediaSubsession.
TestOnDemandRTSPServer.cpp : Simple test for my server
More PS:------------------------------------------------------------------------------------------------------------
As you can see from my MyCustomFramedSource.cpp I stream file on windows env, like this at deliverFrame
// Just for test if my logic true
// not a production ready code
 void MyCustomFramedSource::deliverFrame()
 {
	
	 cout << "Now deliverFrame() is called" << endl;
	
	 if (!isCurrentlyAwaitingData())
	 {
		  cout << " we're not ready for the data yet" << endl;
		  return; // we're not ready for the data yet
	 }
	 cout << " we're ready for the data" << endl;
	 static int frameNumber = 0;
	 struct stat results;
	 char filename[256];
	 if(frameNumber >= 100)
	 {
		 cout << "finished " << endl;
		 return;
	 }
	
	 sprintf_s(filename, 256, "D:\\h264\\frame%d.bin", frameNumber++);
	 stat(filename, &results);
	 unsigned int newFrameSize = results.st_size;
	
	 if (newFrameSize > fMaxSize)
	 {
		 cout << "newFrameSize > fMaxSize" << endl;
		 fFrameSize = fMaxSize;
		 fNumTruncatedBytes = newFrameSize - fMaxSize;
	 }
	 else
	 {
		  cout << "fFrameSize = newFrameSize" << endl;
		 fFrameSize = newFrameSize;
	 }
	
	 unsigned char* newFrameData = (unsigned char*)malloc( fFrameSize);
	 fstream fbin(filename, ios::in | ios::binary);
	 fbin.read((char*)newFrameData, fFrameSize);
	 fbin.close();
	 memcpy(fTo,newFrameData, fFrameSize);
	 gettimeofday(&fPresentationTime,NULL);
	 fDurationInMicroseconds = 1000000 / 15; // 15 fps
	 FramedSource::afterGetting(this);
 }
-----------------------------------------------------------------------------------------------------
    
    
More information about the live-devel
mailing list