From d5b5a6733de40e981c84cdd594bd99ff5f52470c Mon Sep 17 00:00:00 2001 From: Michel Promonet Date: Sat, 28 Mar 2015 10:25:22 +0000 Subject: [PATCH] fix some missing initialization + turn on multicast if an group is specified --- src/V4l2DeviceSource.cpp | 1 + src/main.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/V4l2DeviceSource.cpp b/src/V4l2DeviceSource.cpp index db11526..86c7884 100644 --- a/src/V4l2DeviceSource.cpp +++ b/src/V4l2DeviceSource.cpp @@ -62,6 +62,7 @@ V4L2DeviceSource::V4L2DeviceSource(UsageEnvironment& env, V4L2DeviceParameters p m_queueSize(queueSize) { m_eventTriggerId = envir().taskScheduler().createEventTrigger(V4L2DeviceSource::deliverFrameStub); + memset(&m_thid, 0, sizeof(m_thid)); if (m_device) { if (useThread) diff --git a/src/main.cpp b/src/main.cpp index 3c07580..3e38197 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -174,8 +174,8 @@ int main(int argc, char** argv) { case 'O': outputFile = optarg; break; case 'v': verbose = 1; if (optarg && *optarg=='v') verbose++; break; - case 'm': multicast = true; murl = optarg; break; - case 'M': maddr = inet_addr(optarg); break; + case 'm': multicast = true; if (optarg) murl = optarg; break; + case 'M': multicast = true; if (optarg) maddr = inet_addr(optarg); break; case 'W': width = atoi(optarg); break; case 'H': height = atoi(optarg); break; case 'Q': queueSize = atoi(optarg); break; @@ -197,12 +197,12 @@ int main(int argc, char** argv) std::cout << "\t RTSP options :" << std::endl; std::cout << "\t -u url : unicast url (default " << url << ")" << std::endl; std::cout << "\t -m url : multicast url (default " << murl << ")" << std::endl; - std::cout << "\t -M addr : multicast group (default is a random address)" << std::endl; + std::cout << "\t -M addr : multicast group (default is a random address)" << std::endl; std::cout << "\t -P port : RTSP port (default "<< rtspPort << ")" << std::endl; std::cout << "\t -H port : RTSP over HTTP port (default "<< rtspOverHTTPPort << ")" << std::endl; std::cout << "\t V4L2 options :" << std::endl; std::cout << "\t -r : V4L2 capture using read interface (default use memory mapped buffers)" << std::endl; - std::cout << "\t -s : V4L2 capture using live555 mainloop (default use a separated reading thread)" << std::endl; + std::cout << "\t -s : V4L2 capture using live555 mainloop (default use a reader thread)" << std::endl; std::cout << "\t -F fps : V4L2 capture framerate (default "<< fps << ")" << std::endl; std::cout << "\t -W width : V4L2 capture width (default "<< width << ")" << std::endl; std::cout << "\t -H height: V4L2 capture height (default "<< height << ")" << std::endl; @@ -260,7 +260,8 @@ int main(int argc, char** argv) { if (maddr == INADDR_NONE) maddr = chooseRandomIPv4SSMAddress(*env); destinationAddress.s_addr = maddr; - LOG(NOTICE) << "Mutlicast address " << inet_ntoa(destinationAddress); + LOG(NOTICE) << "RTP address " << inet_ntoa(destinationAddress) << ":" << rtpPortNum; + LOG(NOTICE) << "RTCP address " << inet_ntoa(destinationAddress) << ":" << rtcpPortNum; addSession(rtspServer, murl.c_str(), MulticastServerMediaSubsession::createNew(*env,destinationAddress, Port(rtpPortNum), Port(rtcpPortNum), ttl, replicator,format)); }