#include <OnDemandServerMediaSubsession.hh>
Collaboration diagram for StreamState:

Definition at line 130 of file OnDemandServerMediaSubsession.hh.
| StreamState::StreamState | ( | OnDemandServerMediaSubsession & | master, | |
| Port const & | serverRTPPort, | |||
| Port const & | serverRTCPPort, | |||
| RTPSink * | rtpSink, | |||
| BasicUDPSink * | udpSink, | |||
| unsigned | totalBW, | |||
| FramedSource * | mediaSource, | |||
| Groupsock * | rtpGS, | |||
| Groupsock * | rtcpGS | |||
| ) |
Definition at line 361 of file OnDemandServerMediaSubsession.cpp.
00366 : fMaster(master), fAreCurrentlyPlaying(False), fReferenceCount(1), 00367 fServerRTPPort(serverRTPPort), fServerRTCPPort(serverRTCPPort), 00368 fRTPSink(rtpSink), fUDPSink(udpSink), fStreamDuration(master.duration()), 00369 fTotalBW(totalBW), fRTCPInstance(NULL) /* created later */, 00370 fMediaSource(mediaSource), fRTPgs(rtpGS), fRTCPgs(rtcpGS) { 00371 }
| StreamState::~StreamState | ( | ) | [virtual] |
Definition at line 373 of file OnDemandServerMediaSubsession.cpp.
References reclaim().
00373 { 00374 reclaim(); 00375 }
| void StreamState::startPlaying | ( | Destinations * | destinations, | |
| TaskFunc * | rtcpRRHandler, | |||
| void * | rtcpRRHandlerClientData, | |||
| ServerRequestAlternativeByteHandler * | serverRequestAlternativeByteHandler, | |||
| void * | serverRequestAlternativeByteHandlerClientData | |||
| ) |
Definition at line 378 of file OnDemandServerMediaSubsession.cpp.
References Groupsock::addDestination(), Destinations::addr, RTCPInstance::addStreamSocket(), RTPSink::addStreamSocket(), afterPlayingStreamState(), RTCPInstance::createNew(), Medium::envir(), fAreCurrentlyPlaying, OnDemandServerMediaSubsession::fCNAME, fMaster, fMediaSource, fRTCPgs, fRTCPInstance, fRTPgs, fRTPSink, fTotalBW, fUDPSink, Destinations::isTCP, NULL, Destinations::rtcpChannelId, Destinations::rtcpPort, Destinations::rtpChannelId, Destinations::rtpPort, RTPSink::setServerRequestAlternativeByteHandler(), RTCPInstance::setSpecificRRHandler(), MediaSink::startPlaying(), Destinations::tcpSocketNum, and True.
Referenced by OnDemandServerMediaSubsession::startStream().
00381 { 00382 if (dests == NULL) return; 00383 00384 if (fRTCPInstance == NULL && fRTPSink != NULL) { 00385 // Create (and start) a 'RTCP instance' for this RTP sink: 00386 fRTCPInstance 00387 = RTCPInstance::createNew(fRTPSink->envir(), fRTCPgs, 00388 fTotalBW, (unsigned char*)fMaster.fCNAME, 00389 fRTPSink, NULL /* we're a server */); 00390 // Note: This starts RTCP running automatically 00391 } 00392 00393 if (dests->isTCP) { 00394 // Change RTP and RTCP to use the TCP socket instead of UDP: 00395 if (fRTPSink != NULL) { 00396 fRTPSink->addStreamSocket(dests->tcpSocketNum, dests->rtpChannelId); 00397 fRTPSink->setServerRequestAlternativeByteHandler(dests->tcpSocketNum, serverRequestAlternativeByteHandler, serverRequestAlternativeByteHandlerClientData); 00398 } 00399 if (fRTCPInstance != NULL) { 00400 fRTCPInstance->addStreamSocket(dests->tcpSocketNum, dests->rtcpChannelId); 00401 fRTCPInstance->setSpecificRRHandler(dests->tcpSocketNum, dests->rtcpChannelId, 00402 rtcpRRHandler, rtcpRRHandlerClientData); 00403 } 00404 } else { 00405 // Tell the RTP and RTCP 'groupsocks' about this destination 00406 // (in case they don't already have it): 00407 if (fRTPgs != NULL) fRTPgs->addDestination(dests->addr, dests->rtpPort); 00408 if (fRTCPgs != NULL) fRTCPgs->addDestination(dests->addr, dests->rtcpPort); 00409 if (fRTCPInstance != NULL) { 00410 fRTCPInstance->setSpecificRRHandler(dests->addr.s_addr, dests->rtcpPort, 00411 rtcpRRHandler, rtcpRRHandlerClientData); 00412 } 00413 } 00414 00415 if (!fAreCurrentlyPlaying && fMediaSource != NULL) { 00416 if (fRTPSink != NULL) { 00417 fRTPSink->startPlaying(*fMediaSource, afterPlayingStreamState, this); 00418 fAreCurrentlyPlaying = True; 00419 } else if (fUDPSink != NULL) { 00420 fUDPSink->startPlaying(*fMediaSource, afterPlayingStreamState, this); 00421 fAreCurrentlyPlaying = True; 00422 } 00423 } 00424 }
| void StreamState::pause | ( | ) |
Definition at line 426 of file OnDemandServerMediaSubsession.cpp.
References False, fAreCurrentlyPlaying, fRTPSink, fUDPSink, NULL, and MediaSink::stopPlaying().
Referenced by OnDemandServerMediaSubsession::pauseStream().
00426 { 00427 if (fRTPSink != NULL) fRTPSink->stopPlaying(); 00428 if (fUDPSink != NULL) fUDPSink->stopPlaying(); 00429 fAreCurrentlyPlaying = False; 00430 }
| void StreamState::endPlaying | ( | Destinations * | destinations | ) |
Definition at line 432 of file OnDemandServerMediaSubsession.cpp.
References Destinations::addr, fRTCPgs, fRTCPInstance, fRTPgs, fRTPSink, Destinations::isTCP, NULL, Groupsock::removeDestination(), RTCPInstance::removeStreamSocket(), RTPSink::removeStreamSocket(), Destinations::rtcpChannelId, Destinations::rtcpPort, Destinations::rtpChannelId, Destinations::rtpPort, Destinations::tcpSocketNum, and RTCPInstance::unsetSpecificRRHandler().
Referenced by OnDemandServerMediaSubsession::deleteStream().
00432 { 00433 if (dests->isTCP) { 00434 if (fRTPSink != NULL) { 00435 fRTPSink->removeStreamSocket(dests->tcpSocketNum, dests->rtpChannelId); 00436 } 00437 if (fRTCPInstance != NULL) { 00438 fRTCPInstance->removeStreamSocket(dests->tcpSocketNum, dests->rtcpChannelId); 00439 fRTCPInstance->unsetSpecificRRHandler(dests->tcpSocketNum, dests->rtcpChannelId); 00440 } 00441 } else { 00442 // Tell the RTP and RTCP 'groupsocks' to stop using these destinations: 00443 if (fRTPgs != NULL) fRTPgs->removeDestination(dests->addr, dests->rtpPort); 00444 if (fRTCPgs != NULL) fRTCPgs->removeDestination(dests->addr, dests->rtcpPort); 00445 if (fRTCPInstance != NULL) { 00446 fRTCPInstance->unsetSpecificRRHandler(dests->addr.s_addr, dests->rtcpPort); 00447 } 00448 } 00449 }
| void StreamState::reclaim | ( | ) |
Definition at line 451 of file OnDemandServerMediaSubsession.cpp.
References Medium::close(), OnDemandServerMediaSubsession::closeStreamSource(), OnDemandServerMediaSubsession::fLastStreamToken, fMaster, fMediaSource, fRTCPgs, fRTCPInstance, fRTPgs, fRTPSink, fUDPSink, and NULL.
Referenced by afterPlayingStreamState(), and ~StreamState().
00451 { 00452 // Delete allocated media objects 00453 Medium::close(fRTCPInstance) /* will send a RTCP BYE */; fRTCPInstance = NULL; 00454 Medium::close(fRTPSink); fRTPSink = NULL; 00455 Medium::close(fUDPSink); fUDPSink = NULL; 00456 00457 fMaster.closeStreamSource(fMediaSource); fMediaSource = NULL; 00458 if (fMaster.fLastStreamToken == this) fMaster.fLastStreamToken = NULL; 00459 00460 delete fRTPgs; fRTPgs = NULL; 00461 delete fRTCPgs; fRTCPgs = NULL; 00462 }
| unsigned& StreamState::referenceCount | ( | ) | [inline] |
Definition at line 147 of file OnDemandServerMediaSubsession.hh.
References fReferenceCount.
Referenced by OnDemandServerMediaSubsession::deleteStream().
00147 { return fReferenceCount; }
| Port const& StreamState::serverRTPPort | ( | ) | const [inline] |
Definition at line 149 of file OnDemandServerMediaSubsession.hh.
References fServerRTPPort.
00149 { return fServerRTPPort; }
| Port const& StreamState::serverRTCPPort | ( | ) | const [inline] |
Definition at line 150 of file OnDemandServerMediaSubsession.hh.
References fServerRTCPPort.
00150 { return fServerRTCPPort; }
| RTPSink* StreamState::rtpSink | ( | ) | const [inline] |
Definition at line 152 of file OnDemandServerMediaSubsession.hh.
References fRTPSink.
Referenced by OnDemandServerMediaSubsession::startStream().
00152 { return fRTPSink; }
| float StreamState::streamDuration | ( | ) | const [inline] |
Definition at line 154 of file OnDemandServerMediaSubsession.hh.
References fStreamDuration.
Referenced by afterPlayingStreamState().
00154 { return fStreamDuration; }
| FramedSource* StreamState::mediaSource | ( | ) | const [inline] |
Definition at line 156 of file OnDemandServerMediaSubsession.hh.
References fMediaSource.
Referenced by OnDemandServerMediaSubsession::getStreamSource(), OnDemandServerMediaSubsession::seekStream(), and OnDemandServerMediaSubsession::setStreamScale().
00156 { return fMediaSource; }
Definition at line 159 of file OnDemandServerMediaSubsession.hh.
Referenced by reclaim(), and startPlaying().
Boolean StreamState::fAreCurrentlyPlaying [private] |
Definition at line 160 of file OnDemandServerMediaSubsession.hh.
Referenced by pause(), and startPlaying().
unsigned StreamState::fReferenceCount [private] |
Port StreamState::fServerRTPPort [private] |
Port StreamState::fServerRTCPPort [private] |
RTPSink* StreamState::fRTPSink [private] |
Definition at line 165 of file OnDemandServerMediaSubsession.hh.
Referenced by endPlaying(), pause(), reclaim(), rtpSink(), and startPlaying().
BasicUDPSink* StreamState::fUDPSink [private] |
Definition at line 166 of file OnDemandServerMediaSubsession.hh.
Referenced by pause(), reclaim(), and startPlaying().
float StreamState::fStreamDuration [private] |
unsigned StreamState::fTotalBW [private] |
RTCPInstance* StreamState::fRTCPInstance [private] |
Definition at line 170 of file OnDemandServerMediaSubsession.hh.
Referenced by endPlaying(), reclaim(), and startPlaying().
FramedSource* StreamState::fMediaSource [private] |
Definition at line 172 of file OnDemandServerMediaSubsession.hh.
Referenced by mediaSource(), reclaim(), and startPlaying().
Groupsock* StreamState::fRTPgs [private] |
Definition at line 174 of file OnDemandServerMediaSubsession.hh.
Referenced by endPlaying(), reclaim(), and startPlaying().
Groupsock* StreamState::fRTCPgs [private] |
Definition at line 175 of file OnDemandServerMediaSubsession.hh.
Referenced by endPlaying(), reclaim(), and startPlaying().
1.5.2