[Live-devel] OnDemandServerMediaSubsession, FileServerMediaSubsession and MPEG2TransportFileServerMediaSubsession ...
Massimo Zito
zmax.linkedin at gmail.com
Fri Aug 3 09:18:38 PDT 2007
Hi Ross,
I have modified OnDemandServerMediaSubsession, FileServerMediaSubsession and
MPEG2TransportFileServerMediaSubsession to handle the session closure
on source end.
*** include/OnDemandServerMediaSubsession.hh 2007-08-03 06:44:
32.000000000 +0200
--- include/OnDemandServerMediaSubsession.hh.new 2007-08-03 17:46:
37.000000000 +0200
***************
*** 32,38 ****
class OnDemandServerMediaSubsession: public ServerMediaSubsession {
protected: // we're a virtual base class
OnDemandServerMediaSubsession(UsageEnvironment& env, Boolean
reuseFirstSource,
! portNumBits initialPortNum = 6970);
virtual ~OnDemandServerMediaSubsession();
protected: // redefined virtual functions
--- 32,38 ----
class OnDemandServerMediaSubsession: public ServerMediaSubsession {
protected: // we're a virtual base class
OnDemandServerMediaSubsession(UsageEnvironment& env, Boolean
reuseFirstSource,
! Boolean tearDownOnSourceEnd = False,
portNumBits initialPortNum = 6970);
virtual ~OnDemandServerMediaSubsession();
protected: // redefined virtual functions
***************
*** 75,80 ****
--- 75,83 ----
unsigned char rtpPayloadTypeIfDynamic,
FramedSource* inputSource) = 0;
+ protected:
+ Boolean fTearDownOnSourceEnd;
+
private:
void setSDPLinesFromRTPSink(RTPSink* rtpSink, FramedSource*
inputSource);
// used to implement "sdpLines()"
*** OnDemandServerMediaSubsession.cpp 2007-08-03 06:44:32.000000000 +0200
--- OnDemandServerMediaSubsession.cpp.new 2007-08-03 18:02:49.000000000+0200
***************
*** 27,35 ****
OnDemandServerMediaSubsession
::OnDemandServerMediaSubsession(UsageEnvironment& env,
Boolean reuseFirstSource,
portNumBits initialPortNum)
: ServerMediaSubsession(env),
! fReuseFirstSource(reuseFirstSource), fInitialPortNum(initialPortNum),
fLastStreamToken(NULL), fSDPLines(NULL) {
fDestinationsHashTable = HashTable::create(ONE_WORD_HASH_KEYS);
gethostname(fCNAME, sizeof fCNAME);
--- 27,37 ----
OnDemandServerMediaSubsession
::OnDemandServerMediaSubsession(UsageEnvironment& env,
Boolean reuseFirstSource,
+ Boolean tearDownOnSourceEnd,
portNumBits initialPortNum)
: ServerMediaSubsession(env),
! fTearDownOnSourceEnd(tearDownOnSourceEnd),
fReuseFirstSource(reuseFirstSource),
! fInitialPortNum(initialPortNum),
fLastStreamToken(NULL), fSDPLines(NULL) {
fDestinationsHashTable = HashTable::create(ONE_WORD_HASH_KEYS);
gethostname(fCNAME, sizeof fCNAME);
***************
*** 123,128 ****
--- 125,132 ----
FramedSource* mediaSource() const { return fMediaSource; }
+ Boolean tearDownOnSourceEnd() const { return
fMaster.fTearDownOnSourceEnd; }
+
private:
OnDemandServerMediaSubsession& fMaster;
Boolean fAreCurrentlyPlaying;
***************
*** 393,399 ****
static void afterPlayingStreamState(void* clientData) {
StreamState* streamState = (StreamState*)clientData;
! if (streamState->streamDuration() == 0.0) {
// When the input stream ends, tear it down. This will cause a RTCP
"BYE"
// to be sent to each client, teling it that the stream has ended.
// (Because the stream didn't have a known duration, there was no
other
--- 397,403 ----
static void afterPlayingStreamState(void* clientData) {
StreamState* streamState = (StreamState*)clientData;
! if ((streamState->tearDownOnSourceEnd() == True) ||
(streamState->streamDuration() == 0.0)) {
// When the input stream ends, tear it down. This will cause a RTCP
"BYE"
// to be sent to each client, teling it that the stream has ended.
// (Because the stream didn't have a known duration, there was no
other
*** include/FileServerMediaSubsession.hh 2007-08-03 06:44:
32.000000000 +0200
--- include/FileServerMediaSubsession.hh.new 2007-08-03 18:24:
09.000000000 +0200
***************
*** 29,35 ****
class FileServerMediaSubsession: public OnDemandServerMediaSubsession {
protected: // we're a virtual base class
FileServerMediaSubsession(UsageEnvironment& env, char const* fileName,
! Boolean reuseFirstSource);
virtual ~FileServerMediaSubsession();
protected:
--- 29,35 ----
class FileServerMediaSubsession: public OnDemandServerMediaSubsession {
protected: // we're a virtual base class
FileServerMediaSubsession(UsageEnvironment& env, char const* fileName,
! Boolean reuseFirstSource, Boolean
tearDownOnSourceEnd = False);
virtual ~FileServerMediaSubsession();
protected:
*** FileServerMediaSubsession.cpp 2007-08-03 06:44:32.000000000 +0200
--- FileServerMediaSubsession.cpp.new 2007-08-03 18:27:21.000000000+0200
***************
*** 23,30 ****
FileServerMediaSubsession
::FileServerMediaSubsession(UsageEnvironment& env, char const* fileName,
! Boolean reuseFirstSource)
! : OnDemandServerMediaSubsession(env, reuseFirstSource),
fFileSize(0) {
fFileName = strDup(fileName);
}
--- 23,30 ----
FileServerMediaSubsession
::FileServerMediaSubsession(UsageEnvironment& env, char const* fileName,
! Boolean reuseFirstSource, Boolean
tearDownOnSourceEnd)
! : OnDemandServerMediaSubsession(env, reuseFirstSource,
tearDownOnSourceEnd),
fFileSize(0) {
fFileName = strDup(fileName);
}
*** include/MPEG2TransportFileServerMediaSubsession.hh 2007-08-03 06:44:
32.000000000 +0200
--- include/MPEG2TransportFileServerMediaSubsession.hh.new 2007-08-03
18:29:56.000000000 +0200
***************
*** 36,48 ****
static MPEG2TransportFileServerMediaSubsession*
createNew(UsageEnvironment& env,
char const* dataFileName, char const* indexFileName,
! Boolean reuseFirstSource);
protected:
MPEG2TransportFileServerMediaSubsession(UsageEnvironment& env,
char const* fileName,
MPEG2TransportStreamIndexFile*
indexFile,
! Boolean reuseFirstSource);
// called only by createNew();
virtual ~MPEG2TransportFileServerMediaSubsession();
--- 36,50 ----
static MPEG2TransportFileServerMediaSubsession*
createNew(UsageEnvironment& env,
char const* dataFileName, char const* indexFileName,
! Boolean reuseFirstSource,
! Boolean tearDownOnSourceEnd = False);
protected:
MPEG2TransportFileServerMediaSubsession(UsageEnvironment& env,
char const* fileName,
MPEG2TransportStreamIndexFile*
indexFile,
! Boolean reuseFirstSource,
! Boolean tearDownOnSourceEnd);
// called only by createNew();
virtual ~MPEG2TransportFileServerMediaSubsession();
*** MPEG2TransportFileServerMediaSubsession.cpp 2007-08-03 06:44:
32.000000000 +0200
--- MPEG2TransportFileServerMediaSubsession.cpp.new 2007-08-03 18:32:
31.000000000 +0200
***************
*** 71,77 ****
MPEG2TransportFileServerMediaSubsession::createNew(UsageEnvironment& env,
char const* fileName,
char const*
indexFileName,
! Boolean reuseFirstSource)
{
if (indexFileName != NULL && reuseFirstSource) {
// It makes no sense to support trick play if all clients use the same
source. Fix this:
env << "MPEG2TransportFileServerMediaSubsession::createNew(): ignoring
the index file name, because \"reuseFirstSource\" is set\n";
--- 71,78 ----
MPEG2TransportFileServerMediaSubsession::createNew(UsageEnvironment& env,
char const* fileName,
char const*
indexFileName,
! Boolean reuseFirstSource,
! Boolean
tearDownOnSourceEnd) {
if (indexFileName != NULL && reuseFirstSource) {
// It makes no sense to support trick play if all clients use the same
source. Fix this:
env << "MPEG2TransportFileServerMediaSubsession::createNew(): ignoring
the index file name, because \"reuseFirstSource\" is set\n";
***************
*** 79,93 ****
}
MPEG2TransportStreamIndexFile* indexFile =
MPEG2TransportStreamIndexFile::createNew(env, indexFileName);
return new MPEG2TransportFileServerMediaSubsession(env, fileName,
indexFile,
! reuseFirstSource);
}
MPEG2TransportFileServerMediaSubsession
::MPEG2TransportFileServerMediaSubsession(UsageEnvironment& env,
char const* fileName,
MPEG2TransportStreamIndexFile*
indexFile,
! Boolean reuseFirstSource)
! : FileServerMediaSubsession(env, fileName, reuseFirstSource),
fIndexFile(indexFile), fDuration(0.0), fClientSessionHashTable(NULL) {
if (fIndexFile != NULL) { // we support 'trick play'
fDuration = fIndexFile->getPlayingDuration();
--- 80,95 ----
}
MPEG2TransportStreamIndexFile* indexFile =
MPEG2TransportStreamIndexFile::createNew(env, indexFileName);
return new MPEG2TransportFileServerMediaSubsession(env, fileName,
indexFile,
! reuseFirstSource,
tearDownOnSourceEnd);
}
MPEG2TransportFileServerMediaSubsession
::MPEG2TransportFileServerMediaSubsession(UsageEnvironment& env,
char const* fileName,
MPEG2TransportStreamIndexFile*
indexFile,
! Boolean reuseFirstSource,
! Boolean tearDownOnSourceEnd)
! : FileServerMediaSubsession(env, fileName, reuseFirstSource,
tearDownOnSourceEnd),
fIndexFile(indexFile), fDuration(0.0), fClientSessionHashTable(NULL) {
if (fIndexFile != NULL) { // we support 'trick play'
fDuration = fIndexFile->getPlayingDuration();
Is this work correct ?
Thank you for your attention
Massimo Zito
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.live555.com/pipermail/live-devel/attachments/20070803/64a8124c/attachment-0001.html
More information about the live-devel
mailing list