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

Definition at line 141 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 409 of file OnDemandServerMediaSubsession.cpp.
00414 : fMaster(master), fAreCurrentlyPlaying(False), fReferenceCount(1), 00415 fServerRTPPort(serverRTPPort), fServerRTCPPort(serverRTCPPort), 00416 fRTPSink(rtpSink), fUDPSink(udpSink), fStreamDuration(master.duration()), 00417 fTotalBW(totalBW), fRTCPInstance(NULL) /* created later */, 00418 fMediaSource(mediaSource), fStartNPT(0.0), fRTPgs(rtpGS), fRTCPgs(rtcpGS) { 00419 }
| StreamState::~StreamState | ( | ) | [virtual] |
Definition at line 421 of file OnDemandServerMediaSubsession.cpp.
References reclaim().
00421 { 00422 reclaim(); 00423 }
| void StreamState::startPlaying | ( | Destinations * | destinations, | |
| TaskFunc * | rtcpRRHandler, | |||
| void * | rtcpRRHandlerClientData, | |||
| ServerRequestAlternativeByteHandler * | serverRequestAlternativeByteHandler, | |||
| void * | serverRequestAlternativeByteHandlerClientData | |||
| ) |
Definition at line 426 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, RTCPInstance::sendReport(), RTPSink::setServerRequestAlternativeByteHandler(), RTCPInstance::setSpecificRRHandler(), MediaSink::startPlaying(), Destinations::tcpSocketNum, and True.
Referenced by OnDemandServerMediaSubsession::startStream().
00429 { 00430 if (dests == NULL) return; 00431 00432 if (fRTCPInstance == NULL && fRTPSink != NULL) { 00433 // Create (and start) a 'RTCP instance' for this RTP sink: 00434 fRTCPInstance 00435 = RTCPInstance::createNew(fRTPSink->envir(), fRTCPgs, 00436 fTotalBW, (unsigned char*)fMaster.fCNAME, 00437 fRTPSink, NULL /* we're a server */); 00438 // Note: This starts RTCP running automatically 00439 } 00440 00441 if (dests->isTCP) { 00442 // Change RTP and RTCP to use the TCP socket instead of UDP: 00443 if (fRTPSink != NULL) { 00444 fRTPSink->addStreamSocket(dests->tcpSocketNum, dests->rtpChannelId); 00445 fRTPSink->setServerRequestAlternativeByteHandler(dests->tcpSocketNum, serverRequestAlternativeByteHandler, serverRequestAlternativeByteHandlerClientData); 00446 } 00447 if (fRTCPInstance != NULL) { 00448 fRTCPInstance->addStreamSocket(dests->tcpSocketNum, dests->rtcpChannelId); 00449 fRTCPInstance->setSpecificRRHandler(dests->tcpSocketNum, dests->rtcpChannelId, 00450 rtcpRRHandler, rtcpRRHandlerClientData); 00451 } 00452 } else { 00453 // Tell the RTP and RTCP 'groupsocks' about this destination 00454 // (in case they don't already have it): 00455 if (fRTPgs != NULL) fRTPgs->addDestination(dests->addr, dests->rtpPort); 00456 if (fRTCPgs != NULL) fRTCPgs->addDestination(dests->addr, dests->rtcpPort); 00457 if (fRTCPInstance != NULL) { 00458 fRTCPInstance->setSpecificRRHandler(dests->addr.s_addr, dests->rtcpPort, 00459 rtcpRRHandler, rtcpRRHandlerClientData); 00460 } 00461 } 00462 00463 if (fRTCPInstance != NULL) { 00464 // Hack: Send an initial RTCP "SR" packet, before the initial RTP packet, so that receivers will (likely) be able to 00465 // get RTCP-synchronized presentation times immediately: 00466 fRTCPInstance->sendReport(); 00467 } 00468 00469 if (!fAreCurrentlyPlaying && fMediaSource != NULL) { 00470 if (fRTPSink != NULL) { 00471 fRTPSink->startPlaying(*fMediaSource, afterPlayingStreamState, this); 00472 fAreCurrentlyPlaying = True; 00473 } else if (fUDPSink != NULL) { 00474 fUDPSink->startPlaying(*fMediaSource, afterPlayingStreamState, this); 00475 fAreCurrentlyPlaying = True; 00476 } 00477 } 00478 }
| void StreamState::pause | ( | ) |
Definition at line 480 of file OnDemandServerMediaSubsession.cpp.
References False, fAreCurrentlyPlaying, fRTPSink, fUDPSink, NULL, and MediaSink::stopPlaying().
Referenced by OnDemandServerMediaSubsession::pauseStream().
00480 { 00481 if (fRTPSink != NULL) fRTPSink->stopPlaying(); 00482 if (fUDPSink != NULL) fUDPSink->stopPlaying(); 00483 fAreCurrentlyPlaying = False; 00484 }
| void StreamState::endPlaying | ( | Destinations * | destinations | ) |
Definition at line 486 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, RTCPInstance::sendBYE(), Destinations::tcpSocketNum, and RTCPInstance::unsetSpecificRRHandler().
Referenced by OnDemandServerMediaSubsession::deleteStream().
00486 { 00487 if (fRTCPInstance != NULL) { 00488 // Hack: Explicitly send a RTCP "BYE" packet now, because the code below will prevent that from happening later, 00489 // when "fRTCPInstance" gets deleted: 00490 fRTCPInstance->sendBYE(); 00491 } 00492 00493 if (dests->isTCP) { 00494 if (fRTPSink != NULL) { 00495 fRTPSink->removeStreamSocket(dests->tcpSocketNum, dests->rtpChannelId); 00496 } 00497 if (fRTCPInstance != NULL) { 00498 fRTCPInstance->removeStreamSocket(dests->tcpSocketNum, dests->rtcpChannelId); 00499 fRTCPInstance->unsetSpecificRRHandler(dests->tcpSocketNum, dests->rtcpChannelId); 00500 } 00501 } else { 00502 // Tell the RTP and RTCP 'groupsocks' to stop using these destinations: 00503 if (fRTPgs != NULL) fRTPgs->removeDestination(dests->addr, dests->rtpPort); 00504 if (fRTCPgs != NULL) fRTCPgs->removeDestination(dests->addr, dests->rtcpPort); 00505 if (fRTCPInstance != NULL) { 00506 fRTCPInstance->unsetSpecificRRHandler(dests->addr.s_addr, dests->rtcpPort); 00507 } 00508 } 00509 }
| void StreamState::reclaim | ( | ) |
Definition at line 511 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().
00511 { 00512 // Delete allocated media objects 00513 Medium::close(fRTCPInstance) /* will send a RTCP BYE */; fRTCPInstance = NULL; 00514 Medium::close(fRTPSink); fRTPSink = NULL; 00515 Medium::close(fUDPSink); fUDPSink = NULL; 00516 00517 fMaster.closeStreamSource(fMediaSource); fMediaSource = NULL; 00518 if (fMaster.fLastStreamToken == this) fMaster.fLastStreamToken = NULL; 00519 00520 delete fRTPgs; fRTPgs = NULL; 00521 delete fRTCPgs; fRTCPgs = NULL; 00522 }
| unsigned& StreamState::referenceCount | ( | ) | [inline] |
Definition at line 158 of file OnDemandServerMediaSubsession.hh.
References fReferenceCount.
Referenced by OnDemandServerMediaSubsession::deleteStream().
00158 { return fReferenceCount; }
| Port const& StreamState::serverRTPPort | ( | ) | const [inline] |
Definition at line 160 of file OnDemandServerMediaSubsession.hh.
References fServerRTPPort.
00160 { return fServerRTPPort; }
| Port const& StreamState::serverRTCPPort | ( | ) | const [inline] |
Definition at line 161 of file OnDemandServerMediaSubsession.hh.
References fServerRTCPPort.
00161 { return fServerRTCPPort; }
| RTPSink* StreamState::rtpSink | ( | ) | const [inline] |
Definition at line 163 of file OnDemandServerMediaSubsession.hh.
References fRTPSink.
Referenced by OnDemandServerMediaSubsession::getCurrentNPT(), OnDemandServerMediaSubsession::nullSeekStream(), OnDemandServerMediaSubsession::seekStream(), and OnDemandServerMediaSubsession::startStream().
00163 { return fRTPSink; }
| float StreamState::streamDuration | ( | ) | const [inline] |
Definition at line 165 of file OnDemandServerMediaSubsession.hh.
References fStreamDuration.
Referenced by afterPlayingStreamState().
00165 { return fStreamDuration; }
| FramedSource* StreamState::mediaSource | ( | ) | const [inline] |
Definition at line 167 of file OnDemandServerMediaSubsession.hh.
References fMediaSource.
Referenced by OnDemandServerMediaSubsession::getStreamSource(), OnDemandServerMediaSubsession::nullSeekStream(), OnDemandServerMediaSubsession::seekStream(), and OnDemandServerMediaSubsession::setStreamScale().
00167 { return fMediaSource; }
| float& StreamState::startNPT | ( | ) | [inline] |
Definition at line 168 of file OnDemandServerMediaSubsession.hh.
References fStartNPT.
Referenced by OnDemandServerMediaSubsession::getCurrentNPT(), OnDemandServerMediaSubsession::nullSeekStream(), and OnDemandServerMediaSubsession::seekStream().
00168 { return fStartNPT; }
Definition at line 171 of file OnDemandServerMediaSubsession.hh.
Referenced by reclaim(), and startPlaying().
Boolean StreamState::fAreCurrentlyPlaying [private] |
Definition at line 172 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 177 of file OnDemandServerMediaSubsession.hh.
Referenced by endPlaying(), pause(), reclaim(), rtpSink(), and startPlaying().
BasicUDPSink* StreamState::fUDPSink [private] |
Definition at line 178 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 182 of file OnDemandServerMediaSubsession.hh.
Referenced by endPlaying(), reclaim(), and startPlaying().
FramedSource* StreamState::fMediaSource [private] |
Definition at line 184 of file OnDemandServerMediaSubsession.hh.
Referenced by mediaSource(), reclaim(), and startPlaying().
float StreamState::fStartNPT [private] |
Groupsock* StreamState::fRTPgs [private] |
Definition at line 187 of file OnDemandServerMediaSubsession.hh.
Referenced by endPlaying(), reclaim(), and startPlaying().
Groupsock* StreamState::fRTCPgs [private] |
Definition at line 188 of file OnDemandServerMediaSubsession.hh.
Referenced by endPlaying(), reclaim(), and startPlaying().
1.5.2