void StreamState::endPlaying(Destinations* dests, char *videotype, char *audiotype) {

	Debug(ckite_log_message, "StreamState::endPlaying\n");
	if (dests->isTCP) {
		if (fRTPSink != NULL) {
			if (strcmp(videotype, "store") == 0 || strcmp(audiotype, "store") == 0) {
			}else{
				fRTPSink->removeStreamSocket(dests->tcpSocketNum, dests->rtpChannelId);
			}
		}
		if (fRTCPInstance != NULL) {
			if (strcmp(videotype, "store") == 0 || strcmp(audiotype, "store") == 0) {
			}else{
				fRTCPInstance->removeStreamSocket(dests->tcpSocketNum, dests->rtcpChannelId);
			}
			fRTCPInstance->setSpecificRRHandler(dests->tcpSocketNum, dests->rtcpChannelId,
					NULL, NULL);
		}
	} else {
		// Tell the RTP and RTCP 'groupsocks' to stop using these destinations:
		if (fRTPgs != NULL) fRTPgs->removeDestination(dests->addr, dests->rtpPort);
		if (fRTCPgs != NULL) fRTCPgs->removeDestination(dests->addr, dests->rtcpPort);
		if (fRTCPInstance != NULL) {
			fRTCPInstance->setSpecificRRHandler(dests->addr.s_addr, dests->rtcpPort,
					NULL, NULL);
		}
	}
}
void StreamState::endPlaying(Destinations* dests) {
  if (dests->isTCP) {
    if (fRTPSink != NULL) {
      fRTPSink->removeStreamSocket(dests->tcpSocketNum, dests->rtpChannelId);
    }
    if (fRTCPInstance != NULL) {
      fRTCPInstance->removeStreamSocket(dests->tcpSocketNum, dests->rtcpChannelId);
      fRTCPInstance->setSpecificRRHandler(dests->tcpSocketNum, dests->rtcpChannelId,
					  NULL, NULL);
    }
  } else {
    // Tell the RTP and RTCP 'groupsocks' to stop using these destinations:
    if (fRTPgs != NULL) fRTPgs->removeDestination(dests->addr, dests->rtpPort);
    if (fRTCPgs != NULL) fRTCPgs->removeDestination(dests->addr, dests->rtcpPort);
    if (fRTCPInstance != NULL) {
      fRTCPInstance->setSpecificRRHandler(dests->addr.s_addr, dests->rtcpPort,
					  NULL, NULL);
    }
  }
}