[Live-devel] playback only working to localhost
Tom Pepper
tom at silocorp.com
Fri Feb 5 14:47:07 PST 2010
Hi, everyone:
I'm attempting to feed an H.264 stream from a live capture and encoder application we've written into Wowza 2 via live. I've managed to create a custom H264VideoStreamFramer (STH264VideoStreamFramer ) and DeviceSource (STMCVSource) that successfully forwards frames from our encoder (MainConcept) to vlc or openRTSP via localhost, but when I connect to the same instance from any other machine on the same subnet (whether directly attached to the NIC or through a switch) openRTSP on that client doesn't actually capture any frames after setting up the stream.
Thanks in advance for any help, and for the list archives which have been instrumental in getting this far. I'm sure it's something moronic w/r/t multicast that I'm missing.
The main code's closely based around testMPEG4VideoStreamer.cpp:
void *livertp(void *h264ProfilePtr) {
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
env = BasicUsageEnvironment::createNew(*scheduler);
struct in_addr destinationAddress;
destinationAddress.s_addr = chooseRandomIPv4SSMAddress(*env);
const unsigned short rtpPortNum = 18888;
const unsigned short rtcpPortNum = rtpPortNum + 1;
const unsigned char ttl = 255;
const Port rtpPort(rtpPortNum);
const Port rtcpPort(rtcpPortNum);
Groupsock rtpGroupsockVideo(*env, destinationAddress, rtpPort, ttl);
rtpGroupsockVideo.multicastSendOnly(); // we're a SSM source
Groupsock rtcpGroupsockVideo(*env, destinationAddress, rtcpPort, ttl);
rtcpGroupsockVideo.multicastSendOnly(); // we're a SSM source
videoSink = H264VideoRTPSink::createNew(*env, &rtpGroupsockVideo, 96, 0x41,
(char *) h264ProfilePtr);
const unsigned estimatedSessionBandwidthVideo = 1500; // in kbps; for RTCP b/w share
const unsigned maxCNAMElen = 100;
unsigned char CNAME[maxCNAMElen + 1];
gethostname((char*) CNAME, maxCNAMElen);
CNAME[maxCNAMElen] = '\0'; // just in case
RTCPInstance* videoRTCP = RTCPInstance::createNew(*env,
&rtcpGroupsockVideo, estimatedSessionBandwidthVideo, CNAME,
videoSink, NULL, true);
RTSPServer* rtspServer = RTSPServer::createNew(*env, 8554);
if (rtspServer == NULL) {
*env << "Failed to create RTSP server: " << env->getResultMsg() << "\n";
exit(1);
}
ServerMediaSession* sms = ServerMediaSession::createNew(*env, "testStream",
"frank", "Session streamed by frank", true);
sms->addSubsession(PassiveServerMediaSubsession::createNew(*videoSink,
videoRTCP));
rtspServer->addServerMediaSession(sms);
char* url = rtspServer->rtspURL(sms);
*env << "Play this stream using the URL \"" << url << "\"\n";
delete[] url;
play();
while (1) {
watchVariable = 0;
env->taskScheduler().doEventLoop(&watchVariable);
switch (watchVariable) {
case 'a': {
myH264VideoStreamFramer->doGetNextFrame();
break;
}
default: {
fprintf(stderr,
"Unhandled watchVariable! \n");
}
}
}
}
void play() {
// start the RTP sink
dp = new DeviceParameters;
videoDV = STMCVSource::createNew(*env, *dp);
myH264VideoStreamFramer = STH264VideoStreamFramer::createNew(*env, videoDV);
if (!videoSink->startPlaying(*myH264VideoStreamFramer, afterPlaying, videoSink)) {
fprintf(stderr, "videoSink->startPlaying() failed!!\n");
exit(-1);
}
}
=========
Sample output of openRTSP from client (10.0.22.53) on same subnet as server (10.0.22.60):
$ openRTSP -v rtsp://10.0.22.60:8554/testStream
Sending request: OPTIONS rtsp://10.0.22.60:8554/testStream RTSP/1.0
CSeq: 1
User-Agent: openRTSP (LIVE555 Streaming Media v2008.07.24)
Received OPTIONS response: RTSP/1.0 200 OK
CSeq: 1
Date: Fri, Feb 05 2010 22:41:23 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, SET_PARAMETER
Sending request: DESCRIBE rtsp://10.0.22.60:8554/testStream RTSP/1.0
CSeq: 2
Accept: application/sdp
User-Agent: openRTSP (LIVE555 Streaming Media v2008.07.24)
Received DESCRIBE response: RTSP/1.0 200 OK
CSeq: 2
Date: Fri, Feb 05 2010 22:41:23 GMT
Content-Base: rtsp://10.0.22.60:8554/testStream/
Content-Type: application/sdp
Content-Length: 554
Need to read 554 extra bytes
Read 554 extra bytes: v=0
o=- 1265409055205734 1 IN IP4 10.0.22.60
s=Session streamed by frank
i=frank
t=0 0
a=tool:LIVE555 Streaming Media v2010.01.22
a=type:broadcast
a=control:*
a=source-filter: incl IN IP4 * 10.0.22.60
a=rtcp-unicast: reflection
a=range:npt=0-
a=x-qt-text-nam:Session streamed by frank
a=x-qt-text-inf:frank
m=video 18888 RTP/AVP 96
c=IN IP4 232.187.115.56/255
b=AS:1500
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=000041;sprop-parameter-sets=AWdNQCmWUgCgFz5cBUIAAAfSAAHUwTtCxbLAAAAAAWjrc1I=
a=control:track1
Opened URL "rtsp://10.0.22.60:8554/testStream", returning a SDP description:
v=0
o=- 1265409055205734 1 IN IP4 10.0.22.60
s=Session streamed by frank
i=frank
t=0 0
a=tool:LIVE555 Streaming Media v2010.01.22
a=type:broadcast
a=control:*
a=source-filter: incl IN IP4 * 10.0.22.60
a=rtcp-unicast: reflection
a=range:npt=0-
a=x-qt-text-nam:Session streamed by frank
a=x-qt-text-inf:frank
m=video 18888 RTP/AVP 96
c=IN IP4 232.187.115.56/255
b=AS:1500
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=000041;sprop-parameter-sets=AWdNQCmWUgCgFz5cBUIAAAfSAAHUwTtCxbLAAAAAAWjrc1I=
a=control:track1
Created receiver for "video/H264" subsession (client ports 18888-18889)
Sending request: SETUP rtsp://10.0.22.60:8554/testStream/track1 RTSP/1.0
CSeq: 3
Transport: RTP/AVP;multicast;client_port=18888-18889
User-Agent: openRTSP (LIVE555 Streaming Media v2008.07.24)
Received SETUP response: RTSP/1.0 200 OK
CSeq: 3
Date: Fri, Feb 05 2010 22:41:23 GMT
Transport: RTP/AVP;multicast;destination=232.187.115.56;source=10.0.22.60;port=18888-18889;ttl=255
Session: 3E90B523
Setup "video/H264" subsession (client ports 18888-18889)
Outputting data from the "video/H264" subsession to 'stdout'
Sending request: PLAY rtsp://10.0.22.60:8554/testStream/ RTSP/1.0
CSeq: 4
Session: 3E90B523
Range: npt=0.000-
User-Agent: openRTSP (LIVE555 Streaming Media v2008.07.24)
Received PLAY response: RTSP/1.0 200 OK
CSeq: 4
Date: Fri, Feb 05 2010 22:41:23 GMT
Range: npt=0.000-
Session: 3E90B523
RTP-Info: url=rtsp://10.0.22.60:8554/testStream/track1;seq=545;rtptime=3289321397
Started playing session
Receiving streamed data (signal with "kill -HUP 8087" or "kill -USR1 8087" to terminate)...
[... no data ...]
Thanks,
-tom
More information about the live-devel
mailing list