[Live-devel] Custom FramedSource for testOnDemandRTSPServer Problem

Novalis Vapuru 6.45.vapuru at gmail.com
Wed Feb 1 08:32:18 PST 2012


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);

 }
-----------------------------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyCustomFramedSource.cpp
Type: text/x-c++src
Size: 2041 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120201/733119db/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyCustomFramedSource.h
Type: text/x-chdr
Size: 640 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120201/733119db/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyCustomServerMediaSubsession.cpp
Type: text/x-c++src
Size: 1092 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120201/733119db/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyCustomServerMediaSubsession.h
Type: text/x-chdr
Size: 802 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120201/733119db/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestOnDemandRTSPServer.cpp
Type: text/x-c++src
Size: 2486 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120201/733119db/attachment-0009.bin>


More information about the live-devel mailing list