Skip to content

Commit

Permalink
fix sdpline computing for multicast
Browse files Browse the repository at this point in the history
  • Loading branch information
mpromonet committed Sep 28, 2024
1 parent 97a0436 commit 52c0484
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
13 changes: 9 additions & 4 deletions inc/MulticastServerMediaSubsession.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#pragma once

#include <map>
#include "BaseServerMediaSubsession.h"

// -----------------------------------------
Expand All @@ -34,7 +35,11 @@ class MulticastServerMediaSubsession : public BaseServerMediaSubsession, public
, m_rtcpInstance)
{}

virtual char const* sdpLines() ;
#if LIVEMEDIA_LIBRARY_VERSION_INT < 1610928000
virtual char const* sdpLines();
#else
virtual char const* sdpLines(int addressFamily);
#endif
virtual char const* getAuxSDPLine(RTPSink* rtpSink,FramedSource* inputSource);
RTPSink* createRtpSink(UsageEnvironment& env
, struct in_addr destinationAddress
Expand All @@ -43,9 +48,9 @@ class MulticastServerMediaSubsession : public BaseServerMediaSubsession, public
, StreamReplicator* replicator);

protected:
RTPSink* m_rtpSink;
RTCPInstance* m_rtcpInstance;
std::string m_SDPLines;
RTPSink* m_rtpSink;
RTCPInstance* m_rtcpInstance;
std::map<int,std::string> m_SDPLines;
};


Expand Down
18 changes: 11 additions & 7 deletions src/MulticastServerMediaSubsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,23 @@ RTPSink* MulticastServerMediaSubsession::createRtpSink(UsageEnvironment& env
return m_rtpSink;
}

char const* MulticastServerMediaSubsession::sdpLines()
{
if (m_SDPLines.empty())
#if LIVEMEDIA_LIBRARY_VERSION_INT < 1610928000
char const* MulticastServerMediaSubsession::sdpLines() {
int addressFamily = 0;
#else
char const* MulticastServerMediaSubsession::sdpLines(int addressFamily) {
#endif
if (m_SDPLines[addressFamily].empty())
{
// Ugly workaround to give SPS/PPS that are get from the RTPSink
#if LIVEMEDIA_LIBRARY_VERSION_INT < 1610928000
m_SDPLines.assign(PassiveServerMediaSubsession::sdpLines());
m_SDPLines[addressFamily].assign(PassiveServerMediaSubsession::sdpLines());
#else
m_SDPLines.assign(PassiveServerMediaSubsession::sdpLines(AF_INET));
m_SDPLines[addressFamily].assign(PassiveServerMediaSubsession::sdpLines(addressFamily));
#endif
m_SDPLines.append(getAuxSDPLine(m_rtpSink,NULL));
m_SDPLines[addressFamily].append(getAuxSDPLine(m_rtpSink,NULL));
}
return m_SDPLines.c_str();
return m_SDPLines[addressFamily].c_str();
}

char const* MulticastServerMediaSubsession::getAuxSDPLine(RTPSink* rtpSink,FramedSource* inputSource)
Expand Down

0 comments on commit 52c0484

Please sign in to comment.