diff --git a/autogen.sh b/autogen.sh index c17d194..3587aee 100644 --- a/autogen.sh +++ b/autogen.sh @@ -1,22 +1,22 @@ -echo libtoolize -if [ `(uname -s) 2>/dev/null` == 'Darwin' ] -then - glibtoolize --copy --force -else - libtoolize --copy --force -fi - -echo "aclocal" -aclocal - -echo "autoheader" -autoheader - -echo "create NEWS, README, AUTHORS and ChangeLog" -touch NEWS README AUTHORS ChangeLog - -echo "autoreconf" -autoreconf -i - -echo "automake" +echo libtoolize +if [ `(uname -s) 2>/dev/null` == 'Darwin' ] +then + glibtoolize --copy --force +else + libtoolize --copy --force +fi + +echo "aclocal" +aclocal + +echo "autoheader" +autoheader + +echo "create NEWS, README, AUTHORS and ChangeLog" +touch NEWS README AUTHORS ChangeLog + +echo "autoreconf" +autoreconf -i + +echo "automake" automake -a \ No newline at end of file diff --git a/config.xml b/config.xml index deb0bd8..00f56cd 100644 --- a/config.xml +++ b/config.xml @@ -1,27 +1,27 @@ - - - - - INFO - - udp;*;10060 - ws;*;10060 - wss;*;10062 - - no - no - yes - 65535 - 100;400 - - pcma;pcmu;gsm;vp8;h264-bp;h264-mp;h263;h263+ - - - - - + + + + + INFO + + udp;*;10060 + ws;*;10060 + wss;*;10062 + + no + no + yes + 65535 + 100;400 + + pcma;pcmu;gsm;vp8;h264-bp;h264-mp;h263;h263+ + + + + + \ No newline at end of file diff --git a/doubango/tinyDAV.vcproj b/doubango/tinyDAV.vcproj index 430178d..5867fed 100644 --- a/doubango/tinyDAV.vcproj +++ b/doubango/tinyDAV.vcproj @@ -1,902 +1,902 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinyHTTP.vcproj b/doubango/tinyHTTP.vcproj index 52c0c28..2adbdd2 100644 --- a/doubango/tinyHTTP.vcproj +++ b/doubango/tinyHTTP.vcproj @@ -1,500 +1,500 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinyIPSec.vcproj b/doubango/tinyIPSec.vcproj index de4e90b..8a11495 100644 --- a/doubango/tinyIPSec.vcproj +++ b/doubango/tinyIPSec.vcproj @@ -1,237 +1,237 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinyMEDIA.vcproj b/doubango/tinyMEDIA.vcproj index b4496cf..c961499 100644 --- a/doubango/tinyMEDIA.vcproj +++ b/doubango/tinyMEDIA.vcproj @@ -1,396 +1,396 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinyMSRP.vcproj b/doubango/tinyMSRP.vcproj index a6c0193..d0511cb 100644 --- a/doubango/tinyMSRP.vcproj +++ b/doubango/tinyMSRP.vcproj @@ -1,528 +1,528 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinyNET.vcproj b/doubango/tinyNET.vcproj index b67407d..bd7930d 100644 --- a/doubango/tinyNET.vcproj +++ b/doubango/tinyNET.vcproj @@ -1,644 +1,644 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinyRTP.vcproj b/doubango/tinyRTP.vcproj index 47506ee..9e99bb9 100644 --- a/doubango/tinyRTP.vcproj +++ b/doubango/tinyRTP.vcproj @@ -1,372 +1,372 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinySAK.vcproj b/doubango/tinySAK.vcproj index cbd5331..7454eab 100644 --- a/doubango/tinySAK.vcproj +++ b/doubango/tinySAK.vcproj @@ -1,580 +1,580 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinySDP.vcproj b/doubango/tinySDP.vcproj index 3478cae..06b3142 100644 --- a/doubango/tinySDP.vcproj +++ b/doubango/tinySDP.vcproj @@ -1,464 +1,464 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinySIGCOMP.vcproj b/doubango/tinySIGCOMP.vcproj index 8a183fc..368e2f6 100644 --- a/doubango/tinySIGCOMP.vcproj +++ b/doubango/tinySIGCOMP.vcproj @@ -1,500 +1,500 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinySIP.vcproj b/doubango/tinySIP.vcproj index 73f99af..ff987f4 100644 --- a/doubango/tinySIP.vcproj +++ b/doubango/tinySIP.vcproj @@ -1,1810 +1,1810 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinySMS.vcproj b/doubango/tinySMS.vcproj index 410f77e..9fd5c6d 100644 --- a/doubango/tinySMS.vcproj +++ b/doubango/tinySMS.vcproj @@ -1,299 +1,299 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doubango/tinyXCAP.vcproj b/doubango/tinyXCAP.vcproj index c627892..d9eb30d 100644 --- a/doubango/tinyXCAP.vcproj +++ b/doubango/tinyXCAP.vcproj @@ -1,248 +1,248 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mediaproxy.sln b/mediaproxy.sln index 168bef3..4082803 100644 --- a/mediaproxy.sln +++ b/mediaproxy.sln @@ -1,225 +1,225 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mediaproxy", "mediaproxy.vcproj", "{19B6D461-7CB9-474F-B7F2-E2DA49904A6B}" - ProjectSection(ProjectDependencies) = postProject - {B3E45009-C7C3-4090-837C-2D30C9058443} = {B3E45009-C7C3-4090-837C-2D30C9058443} - {52814B0D-7DCA-45B8-9A16-8B147040D619} = {52814B0D-7DCA-45B8-9A16-8B147040D619} - {AA46AF16-9678-4054-8E48-98DC21ECEC82} = {AA46AF16-9678-4054-8E48-98DC21ECEC82} - {E45DB518-6562-4033-80E8-60030F0B169F} = {E45DB518-6562-4033-80E8-60030F0B169F} - {8E2F0B2E-2596-4010-BF4A-2F688975B5C1} = {8E2F0B2E-2596-4010-BF4A-2F688975B5C1} - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15} = {99B7D02F-8C70-4B45-AF3C-92313C3CEE15} - {4CE20732-9978-4A88-B586-CFEFCB63E82D} = {4CE20732-9978-4A88-B586-CFEFCB63E82D} - {570CF33D-E65F-448F-8AC2-F9AE2F23152F} = {570CF33D-E65F-448F-8AC2-F9AE2F23152F} - {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} - {002FF064-588F-402E-A096-C8D033F49F40} = {002FF064-588F-402E-A096-C8D033F49F40} - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - {76261DC8-25B3-43F4-9FB5-112C4AC0880E} = {76261DC8-25B3-43F4-9FB5-112C4AC0880E} - {9A3A5AF3-2333-4477-B880-7F901F9D8972} = {9A3A5AF3-2333-4477-B880-7F901F9D8972} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyDAV", "doubango\tinyDAV.vcproj", "{8E2F0B2E-2596-4010-BF4A-2F688975B5C1}" - ProjectSection(ProjectDependencies) = postProject - {52814B0D-7DCA-45B8-9A16-8B147040D619} = {52814B0D-7DCA-45B8-9A16-8B147040D619} - {AA46AF16-9678-4054-8E48-98DC21ECEC82} = {AA46AF16-9678-4054-8E48-98DC21ECEC82} - {E45DB518-6562-4033-80E8-60030F0B169F} = {E45DB518-6562-4033-80E8-60030F0B169F} - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15} = {99B7D02F-8C70-4B45-AF3C-92313C3CEE15} - {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyHTTP", "doubango\tinyHTTP.vcproj", "{B3E45009-C7C3-4090-837C-2D30C9058443}" - ProjectSection(ProjectDependencies) = postProject - {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyIPSec", "doubango\tinyIPSec.vcproj", "{002FF064-588F-402E-A096-C8D033F49F40}" - ProjectSection(ProjectDependencies) = postProject - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyMSRP", "doubango\tinyMSRP.vcproj", "{AA46AF16-9678-4054-8E48-98DC21ECEC82}" - ProjectSection(ProjectDependencies) = postProject - {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyMEDIA", "doubango\tinyMEDIA.vcproj", "{52814B0D-7DCA-45B8-9A16-8B147040D619}" - ProjectSection(ProjectDependencies) = postProject - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyNET", "doubango\tinyNET.vcproj", "{7522A458-92F4-4259-B906-E84C2A65D9F1}" - ProjectSection(ProjectDependencies) = postProject - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyRTP", "doubango\tinyRTP.vcproj", "{99B7D02F-8C70-4B45-AF3C-92313C3CEE15}" - ProjectSection(ProjectDependencies) = postProject - {52814B0D-7DCA-45B8-9A16-8B147040D619} = {52814B0D-7DCA-45B8-9A16-8B147040D619} - {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySAK", "doubango\tinySAK.vcproj", "{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySDP", "doubango\tinySDP.vcproj", "{E45DB518-6562-4033-80E8-60030F0B169F}" - ProjectSection(ProjectDependencies) = postProject - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySIGCOMP", "doubango\tinySIGCOMP.vcproj", "{76261DC8-25B3-43F4-9FB5-112C4AC0880E}" - ProjectSection(ProjectDependencies) = postProject - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySIP", "doubango\tinySIP.vcproj", "{4CE20732-9978-4A88-B586-CFEFCB63E82D}" - ProjectSection(ProjectDependencies) = postProject - {B3E45009-C7C3-4090-837C-2D30C9058443} = {B3E45009-C7C3-4090-837C-2D30C9058443} - {52814B0D-7DCA-45B8-9A16-8B147040D619} = {52814B0D-7DCA-45B8-9A16-8B147040D619} - {E45DB518-6562-4033-80E8-60030F0B169F} = {E45DB518-6562-4033-80E8-60030F0B169F} - {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} - {002FF064-588F-402E-A096-C8D033F49F40} = {002FF064-588F-402E-A096-C8D033F49F40} - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - {76261DC8-25B3-43F4-9FB5-112C4AC0880E} = {76261DC8-25B3-43F4-9FB5-112C4AC0880E} - {9A3A5AF3-2333-4477-B880-7F901F9D8972} = {9A3A5AF3-2333-4477-B880-7F901F9D8972} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySMS", "doubango\tinySMS.vcproj", "{9A3A5AF3-2333-4477-B880-7F901F9D8972}" - ProjectSection(ProjectDependencies) = postProject - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyXCAP", "doubango\tinyXCAP.vcproj", "{570CF33D-E65F-448F-8AC2-F9AE2F23152F}" - ProjectSection(ProjectDependencies) = postProject - {B3E45009-C7C3-4090-837C-2D30C9058443} = {B3E45009-C7C3-4090-837C-2D30C9058443} - {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Static_Debug|Win32 = Static_Debug|Win32 - Static_Release|Win32 = Static_Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Debug|Win32.ActiveCfg = Debug|Win32 - {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Debug|Win32.Build.0 = Debug|Win32 - {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Release|Win32.ActiveCfg = Release|Win32 - {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Release|Win32.Build.0 = Release|Win32 - {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Static_Debug|Win32.Build.0 = Debug|Win32 - {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Static_Release|Win32.ActiveCfg = Release|Win32 - {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Static_Release|Win32.Build.0 = Release|Win32 - {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Debug|Win32.ActiveCfg = Debug|Win32 - {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Debug|Win32.Build.0 = Debug|Win32 - {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Release|Win32.ActiveCfg = Release|Win32 - {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Release|Win32.Build.0 = Release|Win32 - {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Static_Debug|Win32.Build.0 = Debug|Win32 - {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Static_Release|Win32.ActiveCfg = Release|Win32 - {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Static_Release|Win32.Build.0 = Release|Win32 - {B3E45009-C7C3-4090-837C-2D30C9058443}.Debug|Win32.ActiveCfg = Debug|Win32 - {B3E45009-C7C3-4090-837C-2D30C9058443}.Debug|Win32.Build.0 = Debug|Win32 - {B3E45009-C7C3-4090-837C-2D30C9058443}.Release|Win32.ActiveCfg = Release|Win32 - {B3E45009-C7C3-4090-837C-2D30C9058443}.Release|Win32.Build.0 = Release|Win32 - {B3E45009-C7C3-4090-837C-2D30C9058443}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {B3E45009-C7C3-4090-837C-2D30C9058443}.Static_Debug|Win32.Build.0 = Debug|Win32 - {B3E45009-C7C3-4090-837C-2D30C9058443}.Static_Release|Win32.ActiveCfg = Release|Win32 - {B3E45009-C7C3-4090-837C-2D30C9058443}.Static_Release|Win32.Build.0 = Release|Win32 - {002FF064-588F-402E-A096-C8D033F49F40}.Debug|Win32.ActiveCfg = Debug|Win32 - {002FF064-588F-402E-A096-C8D033F49F40}.Debug|Win32.Build.0 = Debug|Win32 - {002FF064-588F-402E-A096-C8D033F49F40}.Release|Win32.ActiveCfg = Release|Win32 - {002FF064-588F-402E-A096-C8D033F49F40}.Release|Win32.Build.0 = Release|Win32 - {002FF064-588F-402E-A096-C8D033F49F40}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {002FF064-588F-402E-A096-C8D033F49F40}.Static_Debug|Win32.Build.0 = Debug|Win32 - {002FF064-588F-402E-A096-C8D033F49F40}.Static_Release|Win32.ActiveCfg = Release|Win32 - {002FF064-588F-402E-A096-C8D033F49F40}.Static_Release|Win32.Build.0 = Release|Win32 - {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Debug|Win32.ActiveCfg = Debug|Win32 - {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Debug|Win32.Build.0 = Debug|Win32 - {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Release|Win32.ActiveCfg = Release|Win32 - {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Release|Win32.Build.0 = Release|Win32 - {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Static_Debug|Win32.Build.0 = Debug|Win32 - {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Static_Release|Win32.ActiveCfg = Release|Win32 - {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Static_Release|Win32.Build.0 = Release|Win32 - {52814B0D-7DCA-45B8-9A16-8B147040D619}.Debug|Win32.ActiveCfg = Debug|Win32 - {52814B0D-7DCA-45B8-9A16-8B147040D619}.Debug|Win32.Build.0 = Debug|Win32 - {52814B0D-7DCA-45B8-9A16-8B147040D619}.Release|Win32.ActiveCfg = Release|Win32 - {52814B0D-7DCA-45B8-9A16-8B147040D619}.Release|Win32.Build.0 = Release|Win32 - {52814B0D-7DCA-45B8-9A16-8B147040D619}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {52814B0D-7DCA-45B8-9A16-8B147040D619}.Static_Debug|Win32.Build.0 = Debug|Win32 - {52814B0D-7DCA-45B8-9A16-8B147040D619}.Static_Release|Win32.ActiveCfg = Release|Win32 - {52814B0D-7DCA-45B8-9A16-8B147040D619}.Static_Release|Win32.Build.0 = Release|Win32 - {7522A458-92F4-4259-B906-E84C2A65D9F1}.Debug|Win32.ActiveCfg = Debug|Win32 - {7522A458-92F4-4259-B906-E84C2A65D9F1}.Debug|Win32.Build.0 = Debug|Win32 - {7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Win32.ActiveCfg = Release|Win32 - {7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Win32.Build.0 = Release|Win32 - {7522A458-92F4-4259-B906-E84C2A65D9F1}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {7522A458-92F4-4259-B906-E84C2A65D9F1}.Static_Debug|Win32.Build.0 = Debug|Win32 - {7522A458-92F4-4259-B906-E84C2A65D9F1}.Static_Release|Win32.ActiveCfg = Release|Win32 - {7522A458-92F4-4259-B906-E84C2A65D9F1}.Static_Release|Win32.Build.0 = Release|Win32 - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Debug|Win32.ActiveCfg = Debug|Win32 - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Debug|Win32.Build.0 = Debug|Win32 - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Release|Win32.ActiveCfg = Release|Win32 - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Release|Win32.Build.0 = Release|Win32 - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Debug|Win32.Build.0 = Debug|Win32 - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Release|Win32.ActiveCfg = Release|Win32 - {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Release|Win32.Build.0 = Release|Win32 - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Win32.ActiveCfg = Debug|Win32 - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Win32.Build.0 = Debug|Win32 - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Win32.ActiveCfg = Release|Win32 - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Win32.Build.0 = Release|Win32 - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Debug|Win32.ActiveCfg = Static_Debug|Win32 - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Debug|Win32.Build.0 = Static_Debug|Win32 - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Release|Win32.ActiveCfg = Static_Release|Win32 - {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Release|Win32.Build.0 = Static_Release|Win32 - {E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Win32.ActiveCfg = Debug|Win32 - {E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Win32.Build.0 = Debug|Win32 - {E45DB518-6562-4033-80E8-60030F0B169F}.Release|Win32.ActiveCfg = Release|Win32 - {E45DB518-6562-4033-80E8-60030F0B169F}.Release|Win32.Build.0 = Release|Win32 - {E45DB518-6562-4033-80E8-60030F0B169F}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {E45DB518-6562-4033-80E8-60030F0B169F}.Static_Debug|Win32.Build.0 = Debug|Win32 - {E45DB518-6562-4033-80E8-60030F0B169F}.Static_Release|Win32.ActiveCfg = Release|Win32 - {E45DB518-6562-4033-80E8-60030F0B169F}.Static_Release|Win32.Build.0 = Release|Win32 - {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Debug|Win32.ActiveCfg = Debug|Win32 - {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Debug|Win32.Build.0 = Debug|Win32 - {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Release|Win32.ActiveCfg = Release|Win32 - {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Release|Win32.Build.0 = Release|Win32 - {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Static_Debug|Win32.Build.0 = Debug|Win32 - {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Static_Release|Win32.ActiveCfg = Release|Win32 - {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Static_Release|Win32.Build.0 = Release|Win32 - {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Debug|Win32.Build.0 = Debug|Win32 - {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Release|Win32.ActiveCfg = Release|Win32 - {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Release|Win32.Build.0 = Release|Win32 - {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Static_Debug|Win32.Build.0 = Debug|Win32 - {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Static_Release|Win32.ActiveCfg = Release|Win32 - {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Static_Release|Win32.Build.0 = Release|Win32 - {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Debug|Win32.ActiveCfg = Debug|Win32 - {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Debug|Win32.Build.0 = Debug|Win32 - {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Release|Win32.ActiveCfg = Release|Win32 - {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Release|Win32.Build.0 = Release|Win32 - {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Static_Debug|Win32.Build.0 = Debug|Win32 - {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Static_Release|Win32.ActiveCfg = Release|Win32 - {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Static_Release|Win32.Build.0 = Release|Win32 - {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Debug|Win32.ActiveCfg = Debug|Win32 - {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Debug|Win32.Build.0 = Debug|Win32 - {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Release|Win32.ActiveCfg = Release|Win32 - {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Release|Win32.Build.0 = Release|Win32 - {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Static_Debug|Win32.ActiveCfg = Debug|Win32 - {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Static_Debug|Win32.Build.0 = Debug|Win32 - {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Static_Release|Win32.ActiveCfg = Release|Win32 - {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Static_Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mediaproxy", "mediaproxy.vcproj", "{19B6D461-7CB9-474F-B7F2-E2DA49904A6B}" + ProjectSection(ProjectDependencies) = postProject + {B3E45009-C7C3-4090-837C-2D30C9058443} = {B3E45009-C7C3-4090-837C-2D30C9058443} + {52814B0D-7DCA-45B8-9A16-8B147040D619} = {52814B0D-7DCA-45B8-9A16-8B147040D619} + {AA46AF16-9678-4054-8E48-98DC21ECEC82} = {AA46AF16-9678-4054-8E48-98DC21ECEC82} + {E45DB518-6562-4033-80E8-60030F0B169F} = {E45DB518-6562-4033-80E8-60030F0B169F} + {8E2F0B2E-2596-4010-BF4A-2F688975B5C1} = {8E2F0B2E-2596-4010-BF4A-2F688975B5C1} + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15} = {99B7D02F-8C70-4B45-AF3C-92313C3CEE15} + {4CE20732-9978-4A88-B586-CFEFCB63E82D} = {4CE20732-9978-4A88-B586-CFEFCB63E82D} + {570CF33D-E65F-448F-8AC2-F9AE2F23152F} = {570CF33D-E65F-448F-8AC2-F9AE2F23152F} + {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} + {002FF064-588F-402E-A096-C8D033F49F40} = {002FF064-588F-402E-A096-C8D033F49F40} + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + {76261DC8-25B3-43F4-9FB5-112C4AC0880E} = {76261DC8-25B3-43F4-9FB5-112C4AC0880E} + {9A3A5AF3-2333-4477-B880-7F901F9D8972} = {9A3A5AF3-2333-4477-B880-7F901F9D8972} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyDAV", "doubango\tinyDAV.vcproj", "{8E2F0B2E-2596-4010-BF4A-2F688975B5C1}" + ProjectSection(ProjectDependencies) = postProject + {52814B0D-7DCA-45B8-9A16-8B147040D619} = {52814B0D-7DCA-45B8-9A16-8B147040D619} + {AA46AF16-9678-4054-8E48-98DC21ECEC82} = {AA46AF16-9678-4054-8E48-98DC21ECEC82} + {E45DB518-6562-4033-80E8-60030F0B169F} = {E45DB518-6562-4033-80E8-60030F0B169F} + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15} = {99B7D02F-8C70-4B45-AF3C-92313C3CEE15} + {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyHTTP", "doubango\tinyHTTP.vcproj", "{B3E45009-C7C3-4090-837C-2D30C9058443}" + ProjectSection(ProjectDependencies) = postProject + {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyIPSec", "doubango\tinyIPSec.vcproj", "{002FF064-588F-402E-A096-C8D033F49F40}" + ProjectSection(ProjectDependencies) = postProject + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyMSRP", "doubango\tinyMSRP.vcproj", "{AA46AF16-9678-4054-8E48-98DC21ECEC82}" + ProjectSection(ProjectDependencies) = postProject + {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyMEDIA", "doubango\tinyMEDIA.vcproj", "{52814B0D-7DCA-45B8-9A16-8B147040D619}" + ProjectSection(ProjectDependencies) = postProject + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyNET", "doubango\tinyNET.vcproj", "{7522A458-92F4-4259-B906-E84C2A65D9F1}" + ProjectSection(ProjectDependencies) = postProject + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyRTP", "doubango\tinyRTP.vcproj", "{99B7D02F-8C70-4B45-AF3C-92313C3CEE15}" + ProjectSection(ProjectDependencies) = postProject + {52814B0D-7DCA-45B8-9A16-8B147040D619} = {52814B0D-7DCA-45B8-9A16-8B147040D619} + {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySAK", "doubango\tinySAK.vcproj", "{6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySDP", "doubango\tinySDP.vcproj", "{E45DB518-6562-4033-80E8-60030F0B169F}" + ProjectSection(ProjectDependencies) = postProject + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySIGCOMP", "doubango\tinySIGCOMP.vcproj", "{76261DC8-25B3-43F4-9FB5-112C4AC0880E}" + ProjectSection(ProjectDependencies) = postProject + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySIP", "doubango\tinySIP.vcproj", "{4CE20732-9978-4A88-B586-CFEFCB63E82D}" + ProjectSection(ProjectDependencies) = postProject + {B3E45009-C7C3-4090-837C-2D30C9058443} = {B3E45009-C7C3-4090-837C-2D30C9058443} + {52814B0D-7DCA-45B8-9A16-8B147040D619} = {52814B0D-7DCA-45B8-9A16-8B147040D619} + {E45DB518-6562-4033-80E8-60030F0B169F} = {E45DB518-6562-4033-80E8-60030F0B169F} + {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} + {002FF064-588F-402E-A096-C8D033F49F40} = {002FF064-588F-402E-A096-C8D033F49F40} + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + {76261DC8-25B3-43F4-9FB5-112C4AC0880E} = {76261DC8-25B3-43F4-9FB5-112C4AC0880E} + {9A3A5AF3-2333-4477-B880-7F901F9D8972} = {9A3A5AF3-2333-4477-B880-7F901F9D8972} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinySMS", "doubango\tinySMS.vcproj", "{9A3A5AF3-2333-4477-B880-7F901F9D8972}" + ProjectSection(ProjectDependencies) = postProject + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyXCAP", "doubango\tinyXCAP.vcproj", "{570CF33D-E65F-448F-8AC2-F9AE2F23152F}" + ProjectSection(ProjectDependencies) = postProject + {B3E45009-C7C3-4090-837C-2D30C9058443} = {B3E45009-C7C3-4090-837C-2D30C9058443} + {7522A458-92F4-4259-B906-E84C2A65D9F1} = {7522A458-92F4-4259-B906-E84C2A65D9F1} + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} = {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + Static_Debug|Win32 = Static_Debug|Win32 + Static_Release|Win32 = Static_Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Debug|Win32.ActiveCfg = Debug|Win32 + {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Debug|Win32.Build.0 = Debug|Win32 + {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Release|Win32.ActiveCfg = Release|Win32 + {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Release|Win32.Build.0 = Release|Win32 + {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Static_Debug|Win32.Build.0 = Debug|Win32 + {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Static_Release|Win32.ActiveCfg = Release|Win32 + {19B6D461-7CB9-474F-B7F2-E2DA49904A6B}.Static_Release|Win32.Build.0 = Release|Win32 + {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Debug|Win32.ActiveCfg = Debug|Win32 + {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Debug|Win32.Build.0 = Debug|Win32 + {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Release|Win32.ActiveCfg = Release|Win32 + {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Release|Win32.Build.0 = Release|Win32 + {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Static_Debug|Win32.Build.0 = Debug|Win32 + {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Static_Release|Win32.ActiveCfg = Release|Win32 + {8E2F0B2E-2596-4010-BF4A-2F688975B5C1}.Static_Release|Win32.Build.0 = Release|Win32 + {B3E45009-C7C3-4090-837C-2D30C9058443}.Debug|Win32.ActiveCfg = Debug|Win32 + {B3E45009-C7C3-4090-837C-2D30C9058443}.Debug|Win32.Build.0 = Debug|Win32 + {B3E45009-C7C3-4090-837C-2D30C9058443}.Release|Win32.ActiveCfg = Release|Win32 + {B3E45009-C7C3-4090-837C-2D30C9058443}.Release|Win32.Build.0 = Release|Win32 + {B3E45009-C7C3-4090-837C-2D30C9058443}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {B3E45009-C7C3-4090-837C-2D30C9058443}.Static_Debug|Win32.Build.0 = Debug|Win32 + {B3E45009-C7C3-4090-837C-2D30C9058443}.Static_Release|Win32.ActiveCfg = Release|Win32 + {B3E45009-C7C3-4090-837C-2D30C9058443}.Static_Release|Win32.Build.0 = Release|Win32 + {002FF064-588F-402E-A096-C8D033F49F40}.Debug|Win32.ActiveCfg = Debug|Win32 + {002FF064-588F-402E-A096-C8D033F49F40}.Debug|Win32.Build.0 = Debug|Win32 + {002FF064-588F-402E-A096-C8D033F49F40}.Release|Win32.ActiveCfg = Release|Win32 + {002FF064-588F-402E-A096-C8D033F49F40}.Release|Win32.Build.0 = Release|Win32 + {002FF064-588F-402E-A096-C8D033F49F40}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {002FF064-588F-402E-A096-C8D033F49F40}.Static_Debug|Win32.Build.0 = Debug|Win32 + {002FF064-588F-402E-A096-C8D033F49F40}.Static_Release|Win32.ActiveCfg = Release|Win32 + {002FF064-588F-402E-A096-C8D033F49F40}.Static_Release|Win32.Build.0 = Release|Win32 + {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Debug|Win32.ActiveCfg = Debug|Win32 + {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Debug|Win32.Build.0 = Debug|Win32 + {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Release|Win32.ActiveCfg = Release|Win32 + {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Release|Win32.Build.0 = Release|Win32 + {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Static_Debug|Win32.Build.0 = Debug|Win32 + {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Static_Release|Win32.ActiveCfg = Release|Win32 + {AA46AF16-9678-4054-8E48-98DC21ECEC82}.Static_Release|Win32.Build.0 = Release|Win32 + {52814B0D-7DCA-45B8-9A16-8B147040D619}.Debug|Win32.ActiveCfg = Debug|Win32 + {52814B0D-7DCA-45B8-9A16-8B147040D619}.Debug|Win32.Build.0 = Debug|Win32 + {52814B0D-7DCA-45B8-9A16-8B147040D619}.Release|Win32.ActiveCfg = Release|Win32 + {52814B0D-7DCA-45B8-9A16-8B147040D619}.Release|Win32.Build.0 = Release|Win32 + {52814B0D-7DCA-45B8-9A16-8B147040D619}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {52814B0D-7DCA-45B8-9A16-8B147040D619}.Static_Debug|Win32.Build.0 = Debug|Win32 + {52814B0D-7DCA-45B8-9A16-8B147040D619}.Static_Release|Win32.ActiveCfg = Release|Win32 + {52814B0D-7DCA-45B8-9A16-8B147040D619}.Static_Release|Win32.Build.0 = Release|Win32 + {7522A458-92F4-4259-B906-E84C2A65D9F1}.Debug|Win32.ActiveCfg = Debug|Win32 + {7522A458-92F4-4259-B906-E84C2A65D9F1}.Debug|Win32.Build.0 = Debug|Win32 + {7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Win32.ActiveCfg = Release|Win32 + {7522A458-92F4-4259-B906-E84C2A65D9F1}.Release|Win32.Build.0 = Release|Win32 + {7522A458-92F4-4259-B906-E84C2A65D9F1}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {7522A458-92F4-4259-B906-E84C2A65D9F1}.Static_Debug|Win32.Build.0 = Debug|Win32 + {7522A458-92F4-4259-B906-E84C2A65D9F1}.Static_Release|Win32.ActiveCfg = Release|Win32 + {7522A458-92F4-4259-B906-E84C2A65D9F1}.Static_Release|Win32.Build.0 = Release|Win32 + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Debug|Win32.ActiveCfg = Debug|Win32 + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Debug|Win32.Build.0 = Debug|Win32 + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Release|Win32.ActiveCfg = Release|Win32 + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Release|Win32.Build.0 = Release|Win32 + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Debug|Win32.Build.0 = Debug|Win32 + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Release|Win32.ActiveCfg = Release|Win32 + {99B7D02F-8C70-4B45-AF3C-92313C3CEE15}.Static_Release|Win32.Build.0 = Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Win32.ActiveCfg = Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Debug|Win32.Build.0 = Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Win32.ActiveCfg = Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Release|Win32.Build.0 = Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Debug|Win32.ActiveCfg = Static_Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Debug|Win32.Build.0 = Static_Debug|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Release|Win32.ActiveCfg = Static_Release|Win32 + {6BC9B796-10C6-4CF7-A6E4-E2DACCDA84DA}.Static_Release|Win32.Build.0 = Static_Release|Win32 + {E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Win32.ActiveCfg = Debug|Win32 + {E45DB518-6562-4033-80E8-60030F0B169F}.Debug|Win32.Build.0 = Debug|Win32 + {E45DB518-6562-4033-80E8-60030F0B169F}.Release|Win32.ActiveCfg = Release|Win32 + {E45DB518-6562-4033-80E8-60030F0B169F}.Release|Win32.Build.0 = Release|Win32 + {E45DB518-6562-4033-80E8-60030F0B169F}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {E45DB518-6562-4033-80E8-60030F0B169F}.Static_Debug|Win32.Build.0 = Debug|Win32 + {E45DB518-6562-4033-80E8-60030F0B169F}.Static_Release|Win32.ActiveCfg = Release|Win32 + {E45DB518-6562-4033-80E8-60030F0B169F}.Static_Release|Win32.Build.0 = Release|Win32 + {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Debug|Win32.ActiveCfg = Debug|Win32 + {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Debug|Win32.Build.0 = Debug|Win32 + {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Release|Win32.ActiveCfg = Release|Win32 + {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Release|Win32.Build.0 = Release|Win32 + {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Static_Debug|Win32.Build.0 = Debug|Win32 + {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Static_Release|Win32.ActiveCfg = Release|Win32 + {76261DC8-25B3-43F4-9FB5-112C4AC0880E}.Static_Release|Win32.Build.0 = Release|Win32 + {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Debug|Win32.ActiveCfg = Debug|Win32 + {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Debug|Win32.Build.0 = Debug|Win32 + {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Release|Win32.ActiveCfg = Release|Win32 + {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Release|Win32.Build.0 = Release|Win32 + {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Static_Debug|Win32.Build.0 = Debug|Win32 + {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Static_Release|Win32.ActiveCfg = Release|Win32 + {4CE20732-9978-4A88-B586-CFEFCB63E82D}.Static_Release|Win32.Build.0 = Release|Win32 + {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Debug|Win32.ActiveCfg = Debug|Win32 + {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Debug|Win32.Build.0 = Debug|Win32 + {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Release|Win32.ActiveCfg = Release|Win32 + {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Release|Win32.Build.0 = Release|Win32 + {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Static_Debug|Win32.Build.0 = Debug|Win32 + {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Static_Release|Win32.ActiveCfg = Release|Win32 + {9A3A5AF3-2333-4477-B880-7F901F9D8972}.Static_Release|Win32.Build.0 = Release|Win32 + {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Debug|Win32.ActiveCfg = Debug|Win32 + {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Debug|Win32.Build.0 = Debug|Win32 + {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Release|Win32.ActiveCfg = Release|Win32 + {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Release|Win32.Build.0 = Release|Win32 + {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Static_Debug|Win32.ActiveCfg = Debug|Win32 + {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Static_Debug|Win32.Build.0 = Debug|Win32 + {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Static_Release|Win32.ActiveCfg = Release|Win32 + {570CF33D-E65F-448F-8AC2-F9AE2F23152F}.Static_Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/mediaproxy.vcproj b/mediaproxy.vcproj index 16b584b..9655f54 100644 --- a/mediaproxy.vcproj +++ b/mediaproxy.vcproj @@ -1,463 +1,463 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mp_common.h b/mp_common.h index d90fac5..ff7d2bb 100644 --- a/mp_common.h +++ b/mp_common.h @@ -1,78 +1,78 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_COMMON_H_) -#define _MEDIAPROXY_COMMON_H_ - -#include "mp_config.h" - -#include "Common.h" - -namespace webrtc2sip { - -typedef enum MPMediaType_e -{ - MPMediaType_None = 0x00, - MPMediaType_Audio = (0x01<<0), - MPMediaType_Video = (0x01<<1), - MPMediaType_AudioVideo = (MPMediaType_Audio | MPMediaType_Video), - - MPMediaType_All = 0xFF, -} -MPMediaType_t; - -static enum twrap_media_type_e MPMediaType_GetNative(MPMediaType_t eType) -{ - enum twrap_media_type_e eNativeType = twrap_media_none; - - if((eType & MPMediaType_Audio)) eNativeType = (enum twrap_media_type_e)(eNativeType | twrap_media_audio); - if((eType & MPMediaType_Video)) eNativeType = (enum twrap_media_type_e)(eNativeType | twrap_media_video); - - return eNativeType; -} - -typedef enum MPPeerState_e -{ - MPPeerState_None, - MPPeerState_Connecting, - MPPeerState_Connected, - MPPeerState_Terminated -} -MPPeerState_t; - -typedef enum MPSessionState_e -{ - MPSessionState_None, - MPSessionState_Connecting, - MPSessionState_Connected, - MPSessionState_Terminated -} -MPSessionState_t; - -static MPSessionState_t MPPeerState_GetSessionState(MPPeerState_t eState) -{ - switch(eState){ - case MPPeerState_Connecting: return MPSessionState_Connecting; - case MPPeerState_Connected: return MPSessionState_Connected; - case MPSessionState_Terminated: return MPSessionState_Terminated; - default: return MPSessionState_None; - } -} - -} // namespace -#endif /* _MEDIAPROXY_COMMON_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_COMMON_H_) +#define _MEDIAPROXY_COMMON_H_ + +#include "mp_config.h" + +#include "Common.h" + +namespace webrtc2sip { + +typedef enum MPMediaType_e +{ + MPMediaType_None = 0x00, + MPMediaType_Audio = (0x01<<0), + MPMediaType_Video = (0x01<<1), + MPMediaType_AudioVideo = (MPMediaType_Audio | MPMediaType_Video), + + MPMediaType_All = 0xFF, +} +MPMediaType_t; + +static enum twrap_media_type_e MPMediaType_GetNative(MPMediaType_t eType) +{ + enum twrap_media_type_e eNativeType = twrap_media_none; + + if((eType & MPMediaType_Audio)) eNativeType = (enum twrap_media_type_e)(eNativeType | twrap_media_audio); + if((eType & MPMediaType_Video)) eNativeType = (enum twrap_media_type_e)(eNativeType | twrap_media_video); + + return eNativeType; +} + +typedef enum MPPeerState_e +{ + MPPeerState_None, + MPPeerState_Connecting, + MPPeerState_Connected, + MPPeerState_Terminated +} +MPPeerState_t; + +typedef enum MPSessionState_e +{ + MPSessionState_None, + MPSessionState_Connecting, + MPSessionState_Connected, + MPSessionState_Terminated +} +MPSessionState_t; + +static MPSessionState_t MPPeerState_GetSessionState(MPPeerState_t eState) +{ + switch(eState){ + case MPPeerState_Connecting: return MPSessionState_Connecting; + case MPPeerState_Connected: return MPSessionState_Connected; + case MPSessionState_Terminated: return MPSessionState_Terminated; + default: return MPSessionState_None; + } +} + +} // namespace +#endif /* _MEDIAPROXY_COMMON_H_ */ diff --git a/mp_config.h b/mp_config.h index fbc4e49..808c309 100644 --- a/mp_config.h +++ b/mp_config.h @@ -1,65 +1,65 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_CONFIG_H_) -#define _MEDIAPROXY_CONFIG_H_ - -#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE) -# define MP_UNDER_WINDOWS 1 -#endif - -#if MP_UNDER_WINDOWS -# if !defined(_WIN32_WINNT) -# define _WIN32_WINNT 0x0500 -# endif /* _WIN32_WINNT */ -#endif /* MP_UNDER_WINDOWS */ - -#ifdef _MSC_VER -# define _CRT_SECURE_NO_WARNINGS -# define MP_INLINE _inline -#else -# define MP_INLINE inline -#endif - -// Default audio values -#define MP_AUDIO_CHANNELS_DEFAULT 1 -#define MP_AUDIO_BITS_PER_SAMPLE_DEFAULT 16 -#define MP_AUDIO_RATE_DEFAULT 8000 -#define MP_AUDIO_PTIME_DEFAULT 20 - -#define MP_AUDIO_MIXER_VOL 0.8f -#define MP_AUDIO_MIXER_DIM MPDimension_2D - -#define MP_AUDIO_MAX_LATENCY 200 //ms -#define MP_AUDIO_RTP_TIMEOUT 2500 //ms - -// Default video values -#define MP_VIDEO_WIDTH_DEFAULT 1280 // HD 720p -#define MP_VIDEO_HEIGHT_DEFAULT 720 // HD 720p -#define MP_VIDEO_FPS_DEFAULT 15 - -#define MP_VIDEO_RTP_TIMEOUT 2500 //ms -#define MP_VIDEO_MIXER_DIM MPDimension_2D - -#define MP_INVALID_ID 0 - -#include - -#include "mp_common.h" - -#endif /* _MEDIAPROXY_CONFIG_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_CONFIG_H_) +#define _MEDIAPROXY_CONFIG_H_ + +#if defined(WIN32)|| defined(_WIN32) || defined(_WIN32_WCE) +# define MP_UNDER_WINDOWS 1 +#endif + +#if MP_UNDER_WINDOWS +# if !defined(_WIN32_WINNT) +# define _WIN32_WINNT 0x0500 +# endif /* _WIN32_WINNT */ +#endif /* MP_UNDER_WINDOWS */ + +#ifdef _MSC_VER +# define _CRT_SECURE_NO_WARNINGS +# define MP_INLINE _inline +#else +# define MP_INLINE inline +#endif + +// Default audio values +#define MP_AUDIO_CHANNELS_DEFAULT 1 +#define MP_AUDIO_BITS_PER_SAMPLE_DEFAULT 16 +#define MP_AUDIO_RATE_DEFAULT 8000 +#define MP_AUDIO_PTIME_DEFAULT 20 + +#define MP_AUDIO_MIXER_VOL 0.8f +#define MP_AUDIO_MIXER_DIM MPDimension_2D + +#define MP_AUDIO_MAX_LATENCY 200 //ms +#define MP_AUDIO_RTP_TIMEOUT 2500 //ms + +// Default video values +#define MP_VIDEO_WIDTH_DEFAULT 1280 // HD 720p +#define MP_VIDEO_HEIGHT_DEFAULT 720 // HD 720p +#define MP_VIDEO_FPS_DEFAULT 15 + +#define MP_VIDEO_RTP_TIMEOUT 2500 //ms +#define MP_VIDEO_MIXER_DIM MPDimension_2D + +#define MP_INVALID_ID 0 + +#include + +#include "mp_common.h" + +#endif /* _MEDIAPROXY_CONFIG_H_ */ diff --git a/mp_engine.cc b/mp_engine.cc index 2b36997..53c748c 100644 --- a/mp_engine.cc +++ b/mp_engine.cc @@ -1,311 +1,311 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_engine.h" -#include "mp_proxyplugin_mgr.h" - -#include "SipStack.h" -#include "MediaSessionMgr.h" - -#include -#include -#include - -#if !defined(MP_USER_AGENT_STR) -# define MP_USER_AGENT_STR "webrtc2sip Media Server 2.0" -#endif - -#if !defined(MP_REALM) -# define MP_REALM "webrtc2sip.org" -#endif -#if !defined(MP_IMPI) -# define MP_IMPI "webrtc2sip" -#endif -#if !defined(MP_IMPU) -# define MP_IMPU "webrtc2sip" -#endif - -namespace webrtc2sip { - -bool MPEngine::g_bInitialized = false; - -struct _PeerBySessionIdLeft: public std::binary_function< std::pair >, uint64_t, bool > { - bool operator () ( std::pair > pair, const uint64_t &nSessionId ) const { - return pair.second->getSessionIdLeft() == nSessionId; - } -}; -struct _PeerBySessionIdRight: public std::binary_function< std::pair >, uint64_t, bool > { - bool operator () ( std::pair > pair, const uint64_t &nSessionId ) const { - return pair.second->getSessionIdRight() == nSessionId; - } -}; - -MPEngine::MPEngine(const char* pRealmUri, const char* pPrivateIdentity, const char* pPublicIdentity) -: m_bStarted(false) -, m_bValid(false) -{ - if(!MPEngine::g_bInitialized){ - SipStack::initialize(); - MPProxyPluginMgr::initialize(); - MPEngine::g_bInitialized = true; - } - - m_oMutex = MPMutex::New(); - m_oMutexPeers = MPMutex::New(); - - if((m_oCallback = MPSipCallback::New(this))){ - if((m_oStack = MPSipStack::New(m_oCallback, pRealmUri, pPrivateIdentity, pPublicIdentity))){ - if(!const_cast(m_oStack->getWrappedStack())->setMode(tsip_stack_mode_webrtc2sip)){ - TSK_DEBUG_ERROR("SipStack::setModeServer failed"); - return; - } - const_cast(m_oStack->getWrappedStack())->addHeader("User-Agent", MP_USER_AGENT_STR); - m_bValid = true; - } - } - -} - -MPEngine::~MPEngine() -{ - -} - -bool MPEngine::setDebugLevel(const char* pcLevel) -{ - struct debug_level { const char* name; int level; }; - static const debug_level debug_levels[] = - { - {"INFO", DEBUG_LEVEL_INFO}, - {"WARN", DEBUG_LEVEL_WARN}, - {"ERROR", DEBUG_LEVEL_ERROR}, - {"FATAL", DEBUG_LEVEL_FATAL}, - }; - static const int debug_levels_count = sizeof(debug_levels)/sizeof(debug_levels[0]); - int i; - for(i = 0; i < debug_levels_count; ++i){ - if(tsk_striequals(debug_levels[i].name, pcLevel)){ - tsk_debug_set_level(debug_levels[i].level); - return true; - } - } - return false; -} - -bool MPEngine::addTransport(const char* pTransport, uint16_t pLocalPort, const char* pLocalIP /*= tsk_null*/) -{ - if(!isValid()){ - TSK_DEBUG_ERROR("Engine not valid"); - return false; - } - bool bRet = const_cast(m_oStack->getWrappedStack())->setLocalIP(pLocalIP, pTransport); - bRet &= const_cast(m_oStack->getWrappedStack())->setLocalPort(pLocalPort, pTransport); - return bRet; -} - -bool MPEngine::set100relEnabled(bool bEnabled) -{ - return MediaSessionMgr::defaultsSet100relEnabled(bEnabled); -} - -bool MPEngine::setMediaCoderEnabled(bool bEnabled) -{ - return MediaSessionMgr::defaultsSetByPassEncoding(!bEnabled) && - MediaSessionMgr::defaultsSetByPassDecoding(!bEnabled); -} - -bool MPEngine::setVideoJbEnabled(bool bEnabled) -{ - return MediaSessionMgr::defaultsSetVideoJbEnabled(false); -} - -bool MPEngine::setRtpBuffSize(int32_t nSize) -{ - return MediaSessionMgr::defaultsSetRtpBuffSize(0xffff); -} - -bool MPEngine::setAvpfTail(int32_t nMin, int32_t nMax) -{ - if(!nMin || (nMin > nMax)) - { - TSK_DEBUG_ERROR("[%d-%d] not valid as AVPF tail", nMin, nMax); - return false; - } - return MediaSessionMgr::defaultsSetAvpfTail(nMin, nMax); -} - -bool MPEngine::setSSLCertificate(const char* pcPrivateKey, const char* pcPublicKey, const char* pcCA) -{ - if(!isValid()) - { - TSK_DEBUG_ERROR("Engine not valid"); - return false; - } - return const_cast(m_oStack->getWrappedStack())->setSSLCretificates( - pcPrivateKey, - pcPublicKey, - pcCA - ); -} - -bool MPEngine::setCodecs(int64_t nCodecs) -{ - if(!isValid()) - { - TSK_DEBUG_ERROR("Engine not valid"); - return false; - } - const_cast(m_oStack->getWrappedStack())->setCodecs_2(nCodecs); - return true; -} - -bool MPEngine::addDNSServer(const char* pcDNSServer) -{ - if(!isValid()) - { - TSK_DEBUG_ERROR("Engine not valid"); - return false; - } - return const_cast(m_oStack->getWrappedStack())->addDnsServer(pcDNSServer); -} - -bool MPEngine::start() -{ - int ret = 0; - m_oMutex->lock(); - - if(isStarted()){ - goto bail; - } - - if(!isValid()){ - TSK_DEBUG_ERROR("Engine not valid"); - ret = -1; - goto bail; - } - if(const_cast(m_oStack->getWrappedStack())->start()){ - setStarted(true); - } - else{ - TSK_DEBUG_ERROR("Failed to start SIP stack"); - ret = -2; - goto bail; - } - -bail: - m_oMutex->unlock(); - return (ret == 0); -} - -bool MPEngine::stop() -{ - int ret = 0; - - m_oMutex->lock(); - - if(!isStarted()){ - goto bail; - } - - if(!isValid()){ - TSK_DEBUG_ERROR("Engine not valid"); - ret = -1; - goto bail; - } - - if(const_cast(m_oStack->getWrappedStack())->stop()){ - setStarted(false); - } - else{ - TSK_DEBUG_ERROR("Failed to stop SIP stack"); - ret = -2; - goto bail; - } - -bail: - m_oMutex->unlock(); - return (ret == 0); -} - -MPObjectWrapper MPEngine::getPeerById(uint64_t nId) -{ - MPObjectWrapper m_Peer = NULL; - - m_oMutexPeers->lock(); - - std::map >::iterator iter = m_Peers.find(nId); - if(iter != m_Peers.end()){ - m_Peer = iter->second; - } - - m_oMutexPeers->unlock(); - - return m_Peer; -} - -MPObjectWrapper MPEngine::getPeerBySessionId(uint64_t nId, bool bSessionLeft) -{ - m_oMutexPeers->lock(); - - std::map >::iterator iter; - MPObjectWrapper m_Peer = NULL; - - iter = bSessionLeft - ? std::find_if(m_Peers.begin(), m_Peers.end(), std::bind2nd( _PeerBySessionIdLeft(), nId )) - : std::find_if(m_Peers.begin(), m_Peers.end(), std::bind2nd( _PeerBySessionIdRight(), nId )); - if(iter != m_Peers.end()){ - m_Peer = iter->second; - } - - m_oMutexPeers->unlock(); - - return m_Peer; -} - -void MPEngine::insertPeer(MPObjectWrapper oPeer) -{ - if(oPeer){ - m_oMutexPeers->lock(); - m_Peers.insert( std::pair >(oPeer->getId(), oPeer) ); - m_oMutexPeers->unlock(); - } -} - -void MPEngine::removePeer(uint64_t nId) -{ - m_oMutexPeers->lock(); - std::map >::iterator iter; - if((iter = m_Peers.find(nId)) != m_Peers.end()){ - MPObjectWrapper oPeer = iter->second; - m_Peers.erase(iter); - } - m_oMutexPeers->unlock(); -} - -MPObjectWrapper MPEngine::New() -{ - MPObjectWrapper oMPEngine = new MPEngine(MP_REALM, MP_IMPI, MP_IMPU); - return oMPEngine; -} - - - - - - +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_engine.h" +#include "mp_proxyplugin_mgr.h" + +#include "SipStack.h" +#include "MediaSessionMgr.h" + +#include +#include +#include + +#if !defined(MP_USER_AGENT_STR) +# define MP_USER_AGENT_STR "webrtc2sip Media Server 2.0" +#endif + +#if !defined(MP_REALM) +# define MP_REALM "webrtc2sip.org" +#endif +#if !defined(MP_IMPI) +# define MP_IMPI "webrtc2sip" +#endif +#if !defined(MP_IMPU) +# define MP_IMPU "webrtc2sip" +#endif + +namespace webrtc2sip { + +bool MPEngine::g_bInitialized = false; + +struct _PeerBySessionIdLeft: public std::binary_function< std::pair >, uint64_t, bool > { + bool operator () ( std::pair > pair, const uint64_t &nSessionId ) const { + return pair.second->getSessionIdLeft() == nSessionId; + } +}; +struct _PeerBySessionIdRight: public std::binary_function< std::pair >, uint64_t, bool > { + bool operator () ( std::pair > pair, const uint64_t &nSessionId ) const { + return pair.second->getSessionIdRight() == nSessionId; + } +}; + +MPEngine::MPEngine(const char* pRealmUri, const char* pPrivateIdentity, const char* pPublicIdentity) +: m_bStarted(false) +, m_bValid(false) +{ + if(!MPEngine::g_bInitialized){ + SipStack::initialize(); + MPProxyPluginMgr::initialize(); + MPEngine::g_bInitialized = true; + } + + m_oMutex = MPMutex::New(); + m_oMutexPeers = MPMutex::New(); + + if((m_oCallback = MPSipCallback::New(this))){ + if((m_oStack = MPSipStack::New(m_oCallback, pRealmUri, pPrivateIdentity, pPublicIdentity))){ + if(!const_cast(m_oStack->getWrappedStack())->setMode(tsip_stack_mode_webrtc2sip)){ + TSK_DEBUG_ERROR("SipStack::setModeServer failed"); + return; + } + const_cast(m_oStack->getWrappedStack())->addHeader("User-Agent", MP_USER_AGENT_STR); + m_bValid = true; + } + } + +} + +MPEngine::~MPEngine() +{ + +} + +bool MPEngine::setDebugLevel(const char* pcLevel) +{ + struct debug_level { const char* name; int level; }; + static const debug_level debug_levels[] = + { + {"INFO", DEBUG_LEVEL_INFO}, + {"WARN", DEBUG_LEVEL_WARN}, + {"ERROR", DEBUG_LEVEL_ERROR}, + {"FATAL", DEBUG_LEVEL_FATAL}, + }; + static const int debug_levels_count = sizeof(debug_levels)/sizeof(debug_levels[0]); + int i; + for(i = 0; i < debug_levels_count; ++i){ + if(tsk_striequals(debug_levels[i].name, pcLevel)){ + tsk_debug_set_level(debug_levels[i].level); + return true; + } + } + return false; +} + +bool MPEngine::addTransport(const char* pTransport, uint16_t pLocalPort, const char* pLocalIP /*= tsk_null*/) +{ + if(!isValid()){ + TSK_DEBUG_ERROR("Engine not valid"); + return false; + } + bool bRet = const_cast(m_oStack->getWrappedStack())->setLocalIP(pLocalIP, pTransport); + bRet &= const_cast(m_oStack->getWrappedStack())->setLocalPort(pLocalPort, pTransport); + return bRet; +} + +bool MPEngine::set100relEnabled(bool bEnabled) +{ + return MediaSessionMgr::defaultsSet100relEnabled(bEnabled); +} + +bool MPEngine::setMediaCoderEnabled(bool bEnabled) +{ + return MediaSessionMgr::defaultsSetByPassEncoding(!bEnabled) && + MediaSessionMgr::defaultsSetByPassDecoding(!bEnabled); +} + +bool MPEngine::setVideoJbEnabled(bool bEnabled) +{ + return MediaSessionMgr::defaultsSetVideoJbEnabled(false); +} + +bool MPEngine::setRtpBuffSize(int32_t nSize) +{ + return MediaSessionMgr::defaultsSetRtpBuffSize(0xffff); +} + +bool MPEngine::setAvpfTail(int32_t nMin, int32_t nMax) +{ + if(!nMin || (nMin > nMax)) + { + TSK_DEBUG_ERROR("[%d-%d] not valid as AVPF tail", nMin, nMax); + return false; + } + return MediaSessionMgr::defaultsSetAvpfTail(nMin, nMax); +} + +bool MPEngine::setSSLCertificate(const char* pcPrivateKey, const char* pcPublicKey, const char* pcCA) +{ + if(!isValid()) + { + TSK_DEBUG_ERROR("Engine not valid"); + return false; + } + return const_cast(m_oStack->getWrappedStack())->setSSLCretificates( + pcPrivateKey, + pcPublicKey, + pcCA + ); +} + +bool MPEngine::setCodecs(int64_t nCodecs) +{ + if(!isValid()) + { + TSK_DEBUG_ERROR("Engine not valid"); + return false; + } + const_cast(m_oStack->getWrappedStack())->setCodecs_2(nCodecs); + return true; +} + +bool MPEngine::addDNSServer(const char* pcDNSServer) +{ + if(!isValid()) + { + TSK_DEBUG_ERROR("Engine not valid"); + return false; + } + return const_cast(m_oStack->getWrappedStack())->addDnsServer(pcDNSServer); +} + +bool MPEngine::start() +{ + int ret = 0; + m_oMutex->lock(); + + if(isStarted()){ + goto bail; + } + + if(!isValid()){ + TSK_DEBUG_ERROR("Engine not valid"); + ret = -1; + goto bail; + } + if(const_cast(m_oStack->getWrappedStack())->start()){ + setStarted(true); + } + else{ + TSK_DEBUG_ERROR("Failed to start SIP stack"); + ret = -2; + goto bail; + } + +bail: + m_oMutex->unlock(); + return (ret == 0); +} + +bool MPEngine::stop() +{ + int ret = 0; + + m_oMutex->lock(); + + if(!isStarted()){ + goto bail; + } + + if(!isValid()){ + TSK_DEBUG_ERROR("Engine not valid"); + ret = -1; + goto bail; + } + + if(const_cast(m_oStack->getWrappedStack())->stop()){ + setStarted(false); + } + else{ + TSK_DEBUG_ERROR("Failed to stop SIP stack"); + ret = -2; + goto bail; + } + +bail: + m_oMutex->unlock(); + return (ret == 0); +} + +MPObjectWrapper MPEngine::getPeerById(uint64_t nId) +{ + MPObjectWrapper m_Peer = NULL; + + m_oMutexPeers->lock(); + + std::map >::iterator iter = m_Peers.find(nId); + if(iter != m_Peers.end()){ + m_Peer = iter->second; + } + + m_oMutexPeers->unlock(); + + return m_Peer; +} + +MPObjectWrapper MPEngine::getPeerBySessionId(uint64_t nId, bool bSessionLeft) +{ + m_oMutexPeers->lock(); + + std::map >::iterator iter; + MPObjectWrapper m_Peer = NULL; + + iter = bSessionLeft + ? std::find_if(m_Peers.begin(), m_Peers.end(), std::bind2nd( _PeerBySessionIdLeft(), nId )) + : std::find_if(m_Peers.begin(), m_Peers.end(), std::bind2nd( _PeerBySessionIdRight(), nId )); + if(iter != m_Peers.end()){ + m_Peer = iter->second; + } + + m_oMutexPeers->unlock(); + + return m_Peer; +} + +void MPEngine::insertPeer(MPObjectWrapper oPeer) +{ + if(oPeer){ + m_oMutexPeers->lock(); + m_Peers.insert( std::pair >(oPeer->getId(), oPeer) ); + m_oMutexPeers->unlock(); + } +} + +void MPEngine::removePeer(uint64_t nId) +{ + m_oMutexPeers->lock(); + std::map >::iterator iter; + if((iter = m_Peers.find(nId)) != m_Peers.end()){ + MPObjectWrapper oPeer = iter->second; + m_Peers.erase(iter); + } + m_oMutexPeers->unlock(); +} + +MPObjectWrapper MPEngine::New() +{ + MPObjectWrapper oMPEngine = new MPEngine(MP_REALM, MP_IMPI, MP_IMPU); + return oMPEngine; +} + + + + + + }// namespace \ No newline at end of file diff --git a/mp_engine.h b/mp_engine.h index 73919b4..9bdd388 100644 --- a/mp_engine.h +++ b/mp_engine.h @@ -1,84 +1,84 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_ENGINE_H_) -#define _MEDIAPROXY_ENGINE_H_ - -#include "mp_config.h" -#include "mp_object.h" -#include "mp_mutex.h" -#include "mp_wrap.h" -#include "mp_peer.h" - -#include - -namespace webrtc2sip { - -// -// MPEngine -// -class MPEngine : public MPObject -{ - friend class MPSipCallback; -protected: - MPEngine(const char* pRealmUri, const char* pPrivateIdentity, const char* pPublicIdentity); -public: - virtual ~MPEngine(); - virtual MP_INLINE const char* getObjectId() { return "MPEngine"; } - virtual MP_INLINE bool isValid(){ return m_bValid; } - virtual MP_INLINE bool isStarted(){ return m_bStarted; } - virtual bool setDebugLevel(const char* pcLevel); - virtual bool addTransport(const char* pTransport, uint16_t pLocalPort, const char* pLocalIP = tsk_null); - virtual bool set100relEnabled(bool bEnabled); - virtual bool setMediaCoderEnabled(bool bEnabled); - virtual bool setVideoJbEnabled(bool bEnabled); - virtual bool setRtpBuffSize(int32_t nSize); - virtual bool setAvpfTail(int32_t nMin, int32_t nMax); - virtual bool setSSLCertificate(const char* pcPrivateKey, const char* pcPublicKey, const char* pcCA); - virtual bool setCodecs(int64_t nCodecs); - virtual bool addDNSServer(const char* pcDNSServer); - virtual bool start(); - virtual bool stop(); - - static MPObjectWrapper New(); - - -protected: - virtual MP_INLINE void setStarted(bool bStarted){ m_bStarted = bStarted; } - virtual MPObjectWrapper getPeerById(uint64_t nId); - virtual MPObjectWrapper getPeerBySessionId(uint64_t nId, bool bSessionLeft); - virtual void insertPeer(MPObjectWrapper oPeer); - virtual void removePeer(uint64_t nId); - -private: - MPObjectWrapper m_oMutex; - MPObjectWrapper m_oCallback; - MPObjectWrapper m_oStack; - - std::map > m_Peers; - MPObjectWrapper m_oMutexPeers; - - bool m_bStarted; - bool m_bValid; - - static bool g_bInitialized; -}; - - -} // namespace -#endif /* _MEDIAPROXY_ENGINE_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_ENGINE_H_) +#define _MEDIAPROXY_ENGINE_H_ + +#include "mp_config.h" +#include "mp_object.h" +#include "mp_mutex.h" +#include "mp_wrap.h" +#include "mp_peer.h" + +#include + +namespace webrtc2sip { + +// +// MPEngine +// +class MPEngine : public MPObject +{ + friend class MPSipCallback; +protected: + MPEngine(const char* pRealmUri, const char* pPrivateIdentity, const char* pPublicIdentity); +public: + virtual ~MPEngine(); + virtual MP_INLINE const char* getObjectId() { return "MPEngine"; } + virtual MP_INLINE bool isValid(){ return m_bValid; } + virtual MP_INLINE bool isStarted(){ return m_bStarted; } + virtual bool setDebugLevel(const char* pcLevel); + virtual bool addTransport(const char* pTransport, uint16_t pLocalPort, const char* pLocalIP = tsk_null); + virtual bool set100relEnabled(bool bEnabled); + virtual bool setMediaCoderEnabled(bool bEnabled); + virtual bool setVideoJbEnabled(bool bEnabled); + virtual bool setRtpBuffSize(int32_t nSize); + virtual bool setAvpfTail(int32_t nMin, int32_t nMax); + virtual bool setSSLCertificate(const char* pcPrivateKey, const char* pcPublicKey, const char* pcCA); + virtual bool setCodecs(int64_t nCodecs); + virtual bool addDNSServer(const char* pcDNSServer); + virtual bool start(); + virtual bool stop(); + + static MPObjectWrapper New(); + + +protected: + virtual MP_INLINE void setStarted(bool bStarted){ m_bStarted = bStarted; } + virtual MPObjectWrapper getPeerById(uint64_t nId); + virtual MPObjectWrapper getPeerBySessionId(uint64_t nId, bool bSessionLeft); + virtual void insertPeer(MPObjectWrapper oPeer); + virtual void removePeer(uint64_t nId); + +private: + MPObjectWrapper m_oMutex; + MPObjectWrapper m_oCallback; + MPObjectWrapper m_oStack; + + std::map > m_Peers; + MPObjectWrapper m_oMutexPeers; + + bool m_bStarted; + bool m_bValid; + + static bool g_bInitialized; +}; + + +} // namespace +#endif /* _MEDIAPROXY_ENGINE_H_ */ diff --git a/mp_mutex.cc b/mp_mutex.cc index 01cd7ef..758de8c 100644 --- a/mp_mutex.cc +++ b/mp_mutex.cc @@ -1,55 +1,55 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_mutex.h" - -namespace webrtc2sip { - -MPMutex::MPMutex(bool bRecursive /*= true*/) -{ - m_phMPMutex = tsk_mutex_create_2(bRecursive ? tsk_true : tsk_false); -} - -MPMutex::~MPMutex() -{ - if(m_phMPMutex){ - tsk_mutex_destroy(&m_phMPMutex); - } -} - -bool MPMutex::lock() -{ - return (tsk_mutex_lock(m_phMPMutex) == 0); -} - -bool MPMutex::unlock() -{ - return (tsk_mutex_unlock(m_phMPMutex) == 0); -} - -MPObjectWrapper MPMutex::New(bool bRecursive /*= true*/) -{ - MPObjectWrapper oMPMutex = new MPMutex(bRecursive); - if(!oMPMutex->m_phMPMutex){ - TSK_DEBUG_ERROR("Not wrapping valid mutex handle"); - MPObjectSafeRelease(oMPMutex); - } - return oMPMutex; -} - +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_mutex.h" + +namespace webrtc2sip { + +MPMutex::MPMutex(bool bRecursive /*= true*/) +{ + m_phMPMutex = tsk_mutex_create_2(bRecursive ? tsk_true : tsk_false); +} + +MPMutex::~MPMutex() +{ + if(m_phMPMutex){ + tsk_mutex_destroy(&m_phMPMutex); + } +} + +bool MPMutex::lock() +{ + return (tsk_mutex_lock(m_phMPMutex) == 0); +} + +bool MPMutex::unlock() +{ + return (tsk_mutex_unlock(m_phMPMutex) == 0); +} + +MPObjectWrapper MPMutex::New(bool bRecursive /*= true*/) +{ + MPObjectWrapper oMPMutex = new MPMutex(bRecursive); + if(!oMPMutex->m_phMPMutex){ + TSK_DEBUG_ERROR("Not wrapping valid mutex handle"); + MPObjectSafeRelease(oMPMutex); + } + return oMPMutex; +} + }// namespace \ No newline at end of file diff --git a/mp_mutex.h b/mp_mutex.h index 36a2eda..a4ec1c8 100644 --- a/mp_mutex.h +++ b/mp_mutex.h @@ -1,44 +1,44 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_MUTEX_H_) -#define _MEDIAPROXY_MUTEX_H_ - -#include "mp_config.h" -#include "mp_object.h" -#include "tsk_mutex.h" - -namespace webrtc2sip { - -class MPMutex : public MPObject -{ -protected: - MPMutex(bool bRecursive = true); -public: - virtual ~MPMutex(); - virtual MP_INLINE const char* getObjectId() { return "MPMutex"; } - bool lock(); - bool unlock(); - static MPObjectWrapper New(bool bRecursive = true); - -private: - tsk_mutex_handle_t* m_phMPMutex; -}; - -}// namespace -#endif /* _MEDIAPROXY_MUTEX_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_MUTEX_H_) +#define _MEDIAPROXY_MUTEX_H_ + +#include "mp_config.h" +#include "mp_object.h" +#include "tsk_mutex.h" + +namespace webrtc2sip { + +class MPMutex : public MPObject +{ +protected: + MPMutex(bool bRecursive = true); +public: + virtual ~MPMutex(); + virtual MP_INLINE const char* getObjectId() { return "MPMutex"; } + bool lock(); + bool unlock(); + static MPObjectWrapper New(bool bRecursive = true); + +private: + tsk_mutex_handle_t* m_phMPMutex; +}; + +}// namespace +#endif /* _MEDIAPROXY_MUTEX_H_ */ diff --git a/mp_object.cc b/mp_object.cc index 876b83e..01bf599 100644 --- a/mp_object.cc +++ b/mp_object.cc @@ -1,57 +1,57 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_object.h" - -namespace webrtc2sip { - -MPObject::MPObject() -{ - m_nRefCount = 0; -} - -MPObject::MPObject(const MPObject &) -{ - m_nRefCount = 0; -} - -MPObject::~MPObject() -{ - -} - -void MPObject::operator=(const MPObject &){ -} - -int MPObject::takeRef() const{ - // lock - m_nRefCount++; - // unlock - return m_nRefCount; -} - -int MPObject::releaseRef() const{ - // lock - if(m_nRefCount){ - m_nRefCount--; - } - // unlock - return m_nRefCount; -} - +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_object.h" + +namespace webrtc2sip { + +MPObject::MPObject() +{ + m_nRefCount = 0; +} + +MPObject::MPObject(const MPObject &) +{ + m_nRefCount = 0; +} + +MPObject::~MPObject() +{ + +} + +void MPObject::operator=(const MPObject &){ +} + +int MPObject::takeRef() const{ + // lock + m_nRefCount++; + // unlock + return m_nRefCount; +} + +int MPObject::releaseRef() const{ + // lock + if(m_nRefCount){ + m_nRefCount--; + } + // unlock + return m_nRefCount; +} + } // namespace \ No newline at end of file diff --git a/mp_object.h b/mp_object.h index 92140aa..2921c8d 100644 --- a/mp_object.h +++ b/mp_object.h @@ -1,195 +1,195 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_OBJECT_H_) -#define _MEDIAPROXY_OBJECT_H_ - -#include "mp_config.h" -#include "tsk_debug.h" - -#define MPObjectSafeRelease(pMPObject) (pMPObject) = NULL -#define MPObjectSafeFree MPObjectSafeRelease - -namespace webrtc2sip { - -class MPObject -{ -public: - MPObject(); - MPObject(const MPObject &); - virtual ~MPObject(); - -public: - virtual MP_INLINE const char* getObjectId() = 0; -#if !defined(SWIG) - MP_INLINE int GetRefCount() const{ - return m_nRefCount; - } - void operator=(const MPObject &); -#endif - - -public: - int takeRef() const; - int releaseRef() const; - -private: - mutable int m_nRefCount; -}; - - -// -// MPObjectWrapper declaration -// -template -class MPObjectWrapper{ - -public: - MP_INLINE MPObjectWrapper(MPObjectType obj = NULL); - MP_INLINE MPObjectWrapper(const MPObjectWrapper &obj); - MP_INLINE virtual ~MPObjectWrapper(); - -#if !defined(SWIG) -public: - MP_INLINE MPObjectWrapper& operator=(const MPObjectType other); - MP_INLINE MPObjectWrapper& operator=(const MPObjectWrapper &other); - MP_INLINE bool operator ==(const MPObjectWrapper other) const; - MP_INLINE bool operator!=(const MPObjectWrapper &other) const; - MP_INLINE bool operator <(const MPObjectWrapper other) const; - MP_INLINE MPObjectType operator->() const; - MP_INLINE MPObjectType operator*() const; - MP_INLINE operator bool() const; -#endif - -protected: - MP_INLINE int takeRef(); - MP_INLINE int releaseRef(); - - MP_INLINE MPObjectType GetWrappedMPObject() const; - MP_INLINE void WrapMPObject(MPObjectType obj); - -private: - MPObjectType m_WrappedMPObject; -}; - -// -// MPObjectWrapper implementation -// -template -MPObjectWrapper::MPObjectWrapper(MPObjectType obj) { - WrapMPObject(obj), takeRef(); -} - -template -MPObjectWrapper::MPObjectWrapper(const MPObjectWrapper &obj) { - WrapMPObject(obj.GetWrappedMPObject()), - takeRef(); -} - -template -MPObjectWrapper::~MPObjectWrapper(){ - releaseRef(), - WrapMPObject(NULL); -} - - -template -int MPObjectWrapper::takeRef(){ - if(m_WrappedMPObject /*&& m_WrappedMPObject->getRefCount() At startup*/){ - return m_WrappedMPObject->takeRef(); - } - return 0; -} - -template -int MPObjectWrapper::releaseRef() { - if(m_WrappedMPObject && m_WrappedMPObject->GetRefCount()){ - if(m_WrappedMPObject->releaseRef() == 0){ - delete m_WrappedMPObject, m_WrappedMPObject = NULL; - } - else{ - return m_WrappedMPObject->GetRefCount(); - } - } - return 0; -} - -template -MPObjectType MPObjectWrapper::GetWrappedMPObject() const{ - return m_WrappedMPObject; -} - -template -void MPObjectWrapper::WrapMPObject(const MPObjectType obj){ - if(obj){ - if(!(m_WrappedMPObject = dynamic_cast(obj))){ - TSK_DEBUG_ERROR("Trying to wrap an object with an invalid type"); - } - } - else{ - m_WrappedMPObject = NULL; - } -} - -template -MPObjectWrapper& MPObjectWrapper::operator=(const MPObjectType obj){ - releaseRef(); - WrapMPObject(obj), takeRef(); - return *this; -} - -template -MPObjectWrapper& MPObjectWrapper::operator=(const MPObjectWrapper &obj){ - releaseRef(); - WrapMPObject(obj.GetWrappedMPObject()), takeRef(); - return *this; -} - - -template -bool MPObjectWrapper::operator ==(const MPObjectWrapper other) const { - return GetWrappedMPObject() == other.GetWrappedMPObject(); -} - -template -bool MPObjectWrapper::operator!=(const MPObjectWrapper &other) const { - return GetWrappedMPObject() != other.GetWrappedMPObject(); -} - -template -bool MPObjectWrapper::operator <(const MPObjectWrapper other) const { - return GetWrappedMPObject() < other.GetWrappedMPObject(); -} - -template -MPObjectWrapper::operator bool() const { - return (GetWrappedMPObject() != NULL); -} - -template -MPObjectType MPObjectWrapper::operator->() const { - return GetWrappedMPObject(); -} - -template -MPObjectType MPObjectWrapper::operator*() const{ - return GetWrappedMPObject(); -} - -} // namespace -#endif /* _MEDIAPROXY_OBJECT_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_OBJECT_H_) +#define _MEDIAPROXY_OBJECT_H_ + +#include "mp_config.h" +#include "tsk_debug.h" + +#define MPObjectSafeRelease(pMPObject) (pMPObject) = NULL +#define MPObjectSafeFree MPObjectSafeRelease + +namespace webrtc2sip { + +class MPObject +{ +public: + MPObject(); + MPObject(const MPObject &); + virtual ~MPObject(); + +public: + virtual MP_INLINE const char* getObjectId() = 0; +#if !defined(SWIG) + MP_INLINE int GetRefCount() const{ + return m_nRefCount; + } + void operator=(const MPObject &); +#endif + + +public: + int takeRef() const; + int releaseRef() const; + +private: + mutable int m_nRefCount; +}; + + +// +// MPObjectWrapper declaration +// +template +class MPObjectWrapper{ + +public: + MP_INLINE MPObjectWrapper(MPObjectType obj = NULL); + MP_INLINE MPObjectWrapper(const MPObjectWrapper &obj); + MP_INLINE virtual ~MPObjectWrapper(); + +#if !defined(SWIG) +public: + MP_INLINE MPObjectWrapper& operator=(const MPObjectType other); + MP_INLINE MPObjectWrapper& operator=(const MPObjectWrapper &other); + MP_INLINE bool operator ==(const MPObjectWrapper other) const; + MP_INLINE bool operator!=(const MPObjectWrapper &other) const; + MP_INLINE bool operator <(const MPObjectWrapper other) const; + MP_INLINE MPObjectType operator->() const; + MP_INLINE MPObjectType operator*() const; + MP_INLINE operator bool() const; +#endif + +protected: + MP_INLINE int takeRef(); + MP_INLINE int releaseRef(); + + MP_INLINE MPObjectType GetWrappedMPObject() const; + MP_INLINE void WrapMPObject(MPObjectType obj); + +private: + MPObjectType m_WrappedMPObject; +}; + +// +// MPObjectWrapper implementation +// +template +MPObjectWrapper::MPObjectWrapper(MPObjectType obj) { + WrapMPObject(obj), takeRef(); +} + +template +MPObjectWrapper::MPObjectWrapper(const MPObjectWrapper &obj) { + WrapMPObject(obj.GetWrappedMPObject()), + takeRef(); +} + +template +MPObjectWrapper::~MPObjectWrapper(){ + releaseRef(), + WrapMPObject(NULL); +} + + +template +int MPObjectWrapper::takeRef(){ + if(m_WrappedMPObject /*&& m_WrappedMPObject->getRefCount() At startup*/){ + return m_WrappedMPObject->takeRef(); + } + return 0; +} + +template +int MPObjectWrapper::releaseRef() { + if(m_WrappedMPObject && m_WrappedMPObject->GetRefCount()){ + if(m_WrappedMPObject->releaseRef() == 0){ + delete m_WrappedMPObject, m_WrappedMPObject = NULL; + } + else{ + return m_WrappedMPObject->GetRefCount(); + } + } + return 0; +} + +template +MPObjectType MPObjectWrapper::GetWrappedMPObject() const{ + return m_WrappedMPObject; +} + +template +void MPObjectWrapper::WrapMPObject(const MPObjectType obj){ + if(obj){ + if(!(m_WrappedMPObject = dynamic_cast(obj))){ + TSK_DEBUG_ERROR("Trying to wrap an object with an invalid type"); + } + } + else{ + m_WrappedMPObject = NULL; + } +} + +template +MPObjectWrapper& MPObjectWrapper::operator=(const MPObjectType obj){ + releaseRef(); + WrapMPObject(obj), takeRef(); + return *this; +} + +template +MPObjectWrapper& MPObjectWrapper::operator=(const MPObjectWrapper &obj){ + releaseRef(); + WrapMPObject(obj.GetWrappedMPObject()), takeRef(); + return *this; +} + + +template +bool MPObjectWrapper::operator ==(const MPObjectWrapper other) const { + return GetWrappedMPObject() == other.GetWrappedMPObject(); +} + +template +bool MPObjectWrapper::operator!=(const MPObjectWrapper &other) const { + return GetWrappedMPObject() != other.GetWrappedMPObject(); +} + +template +bool MPObjectWrapper::operator <(const MPObjectWrapper other) const { + return GetWrappedMPObject() < other.GetWrappedMPObject(); +} + +template +MPObjectWrapper::operator bool() const { + return (GetWrappedMPObject() != NULL); +} + +template +MPObjectType MPObjectWrapper::operator->() const { + return GetWrappedMPObject(); +} + +template +MPObjectType MPObjectWrapper::operator*() const{ + return GetWrappedMPObject(); +} + +} // namespace +#endif /* _MEDIAPROXY_OBJECT_H_ */ diff --git a/mp_peer.cc b/mp_peer.cc index a24a28b..bf1d822 100644 --- a/mp_peer.cc +++ b/mp_peer.cc @@ -1,56 +1,56 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_peer.h" - -#include - -namespace webrtc2sip { - -uint64_t g_nId = 0; - -MPPeer::MPPeer(MPObjectWrapper oCallSessionLeft) -: m_nSessionIdLeft(0) -, m_nSessionIdRight(0) -, m_eSessionLeftState(MPPeerState_None) -, m_eSessionRightState(MPPeerState_None) -, m_nLastSipResponseLeft(0) -, m_nLastSipResponseRight(0) -, m_eMediaType(MPMediaType_None) -{ - assert(*oCallSessionLeft); - - m_nId = ++g_nId; - m_oCallSessionLeft = oCallSessionLeft; - m_nSessionIdLeft = m_oCallSessionLeft->getWrappedSession()->getId(); -} - -MPPeer::~MPPeer() -{ - TSK_DEBUG_INFO("MPPeer object destroyed"); -} - -void MPPeer::setCallSessionRight(MPObjectWrapper oCallSession) -{ - assert(*oCallSession); - - m_oCallSessionRight = oCallSession; - m_nSessionIdRight = m_oCallSessionRight->getWrappedSession()->getId(); -} - +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_peer.h" + +#include + +namespace webrtc2sip { + +uint64_t g_nId = 0; + +MPPeer::MPPeer(MPObjectWrapper oCallSessionLeft) +: m_nSessionIdLeft(0) +, m_nSessionIdRight(0) +, m_eSessionLeftState(MPPeerState_None) +, m_eSessionRightState(MPPeerState_None) +, m_nLastSipResponseLeft(0) +, m_nLastSipResponseRight(0) +, m_eMediaType(MPMediaType_None) +{ + assert(*oCallSessionLeft); + + m_nId = ++g_nId; + m_oCallSessionLeft = oCallSessionLeft; + m_nSessionIdLeft = m_oCallSessionLeft->getWrappedSession()->getId(); +} + +MPPeer::~MPPeer() +{ + TSK_DEBUG_INFO("MPPeer object destroyed"); +} + +void MPPeer::setCallSessionRight(MPObjectWrapper oCallSession) +{ + assert(*oCallSession); + + m_oCallSessionRight = oCallSession; + m_nSessionIdRight = m_oCallSessionRight->getWrappedSession()->getId(); +} + } // namespace \ No newline at end of file diff --git a/mp_peer.h b/mp_peer.h index a0652ca..0a6bf03 100644 --- a/mp_peer.h +++ b/mp_peer.h @@ -1,88 +1,88 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_PEER_H_) -#define _MEDIAPROXY_PEER_H_ - -#include "mp_config.h" -#include "mp_object.h" -#include "mp_session_av.h" - -namespace webrtc2sip { - -class MPPeer : public MPObject -{ -public: - MPPeer(MPObjectWrapper oCallSessionLeft); - virtual ~MPPeer(); - MP_INLINE virtual const char* getObjectId() { return "MPPeer"; } - - MP_INLINE uint64_t getId(){ return m_nId; } - MP_INLINE MPMediaType_t getMediaType(){ return m_eMediaType; } - MP_INLINE void setMediaType(MPMediaType_t eType){ m_eMediaType = eType; } - MP_INLINE void setSessionIdLeft(uint64_t nId){ m_nSessionIdLeft = nId; } - MP_INLINE uint64_t getSessionIdLeft(){ return m_nSessionIdLeft; } - MP_INLINE void setSessionIdRight(uint64_t nId){ m_nSessionIdRight = nId; } - MP_INLINE uint64_t getSessionIdRight(){ return m_nSessionIdRight; } - MP_INLINE MPObjectWrapper getCallSessionLeft(){ return m_oCallSessionLeft; } - MP_INLINE MPObjectWrapper getCallSessionRight(){ return m_oCallSessionRight; } - void setCallSessionRight(MPObjectWrapper oCallSession); - MP_INLINE bool isSessionLeftActive(){ - switch(m_eSessionLeftState){ - case MPPeerState_Connecting: case MPPeerState_Connected: return true; - default: return false; - } - } - MP_INLINE bool isSessionRightActive(){ - switch(m_eSessionRightState){ - case MPPeerState_Connecting: case MPPeerState_Connected: return true; - default: return false; - } - } - MP_INLINE bool isSessionLeftConnected(){ return (m_eSessionLeftState == MPPeerState_Connected); } - MP_INLINE bool isSessionRightConnected(){ return (m_eSessionRightState == MPPeerState_Connected); } - MP_INLINE void setSessionLeftState(MPPeerState_t eState){ - m_eSessionLeftState = eState; - if(m_oCallSessionLeft){ - m_oCallSessionLeft->setState(MPPeerState_GetSessionState(eState)); - } - } - MP_INLINE void setSessionRightState(MPPeerState_t eState){ - m_eSessionRightState = eState; - if(m_oCallSessionRight){ - m_oCallSessionRight->setState(MPPeerState_GetSessionState(eState)); - } - } - MP_INLINE MPPeerState_t getSessionLeftState(){ return m_eSessionLeftState; } - MP_INLINE MPPeerState_t getSessionRightState(){ return m_eSessionRightState; } - MP_INLINE void setLastSipResponseLeft(short nCode){ m_nLastSipResponseLeft = nCode; } - MP_INLINE void setLastSipResponseRight(short nCode){ m_nLastSipResponseRight = nCode; } - MP_INLINE short getLastSipResponseLeft(){ return m_nLastSipResponseLeft; } - MP_INLINE short getLastSipResponseRight(){ return m_nLastSipResponseRight; } - -private: - uint64_t m_nId, m_nSessionIdLeft, m_nSessionIdRight; - short m_nLastSipResponseLeft, m_nLastSipResponseRight; - MPObjectWrapper m_oCallSessionLeft; - MPObjectWrapper m_oCallSessionRight; - MPPeerState_t m_eSessionLeftState, m_eSessionRightState; - MPMediaType_t m_eMediaType; -}; - -} // namespace -#endif /* _MEDIAPROXY_PEER_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_PEER_H_) +#define _MEDIAPROXY_PEER_H_ + +#include "mp_config.h" +#include "mp_object.h" +#include "mp_session_av.h" + +namespace webrtc2sip { + +class MPPeer : public MPObject +{ +public: + MPPeer(MPObjectWrapper oCallSessionLeft); + virtual ~MPPeer(); + MP_INLINE virtual const char* getObjectId() { return "MPPeer"; } + + MP_INLINE uint64_t getId(){ return m_nId; } + MP_INLINE MPMediaType_t getMediaType(){ return m_eMediaType; } + MP_INLINE void setMediaType(MPMediaType_t eType){ m_eMediaType = eType; } + MP_INLINE void setSessionIdLeft(uint64_t nId){ m_nSessionIdLeft = nId; } + MP_INLINE uint64_t getSessionIdLeft(){ return m_nSessionIdLeft; } + MP_INLINE void setSessionIdRight(uint64_t nId){ m_nSessionIdRight = nId; } + MP_INLINE uint64_t getSessionIdRight(){ return m_nSessionIdRight; } + MP_INLINE MPObjectWrapper getCallSessionLeft(){ return m_oCallSessionLeft; } + MP_INLINE MPObjectWrapper getCallSessionRight(){ return m_oCallSessionRight; } + void setCallSessionRight(MPObjectWrapper oCallSession); + MP_INLINE bool isSessionLeftActive(){ + switch(m_eSessionLeftState){ + case MPPeerState_Connecting: case MPPeerState_Connected: return true; + default: return false; + } + } + MP_INLINE bool isSessionRightActive(){ + switch(m_eSessionRightState){ + case MPPeerState_Connecting: case MPPeerState_Connected: return true; + default: return false; + } + } + MP_INLINE bool isSessionLeftConnected(){ return (m_eSessionLeftState == MPPeerState_Connected); } + MP_INLINE bool isSessionRightConnected(){ return (m_eSessionRightState == MPPeerState_Connected); } + MP_INLINE void setSessionLeftState(MPPeerState_t eState){ + m_eSessionLeftState = eState; + if(m_oCallSessionLeft){ + m_oCallSessionLeft->setState(MPPeerState_GetSessionState(eState)); + } + } + MP_INLINE void setSessionRightState(MPPeerState_t eState){ + m_eSessionRightState = eState; + if(m_oCallSessionRight){ + m_oCallSessionRight->setState(MPPeerState_GetSessionState(eState)); + } + } + MP_INLINE MPPeerState_t getSessionLeftState(){ return m_eSessionLeftState; } + MP_INLINE MPPeerState_t getSessionRightState(){ return m_eSessionRightState; } + MP_INLINE void setLastSipResponseLeft(short nCode){ m_nLastSipResponseLeft = nCode; } + MP_INLINE void setLastSipResponseRight(short nCode){ m_nLastSipResponseRight = nCode; } + MP_INLINE short getLastSipResponseLeft(){ return m_nLastSipResponseLeft; } + MP_INLINE short getLastSipResponseRight(){ return m_nLastSipResponseRight; } + +private: + uint64_t m_nId, m_nSessionIdLeft, m_nSessionIdRight; + short m_nLastSipResponseLeft, m_nLastSipResponseRight; + MPObjectWrapper m_oCallSessionLeft; + MPObjectWrapper m_oCallSessionRight; + MPPeerState_t m_eSessionLeftState, m_eSessionRightState; + MPMediaType_t m_eMediaType; +}; + +} // namespace +#endif /* _MEDIAPROXY_PEER_H_ */ diff --git a/mp_proxyplugin.cc b/mp_proxyplugin.cc index cc4c5e4..faa0636 100644 --- a/mp_proxyplugin.cc +++ b/mp_proxyplugin.cc @@ -1,41 +1,41 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_proxyplugin.h" - -namespace webrtc2sip { - -MPProxyPlugin::MPProxyPlugin(MPMediaType_t eMediaType, uint64_t nId, const ProxyPlugin* pcProxyPlugin) -: MPObject() -{ - m_eMediaType = eMediaType; - m_nId = nId; - m_pcProxyPlugin = pcProxyPlugin; - m_bValid = true; - m_bStarted = false; - m_bPaused = false; - m_oMutex = MPMutex::New(); -} - - -MPProxyPlugin::~MPProxyPlugin() -{ - m_pcProxyPlugin = NULL; -} - +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_proxyplugin.h" + +namespace webrtc2sip { + +MPProxyPlugin::MPProxyPlugin(MPMediaType_t eMediaType, uint64_t nId, const ProxyPlugin* pcProxyPlugin) +: MPObject() +{ + m_eMediaType = eMediaType; + m_nId = nId; + m_pcProxyPlugin = pcProxyPlugin; + m_bValid = true; + m_bStarted = false; + m_bPaused = false; + m_oMutex = MPMutex::New(); +} + + +MPProxyPlugin::~MPProxyPlugin() +{ + m_pcProxyPlugin = NULL; +} + }//namespace \ No newline at end of file diff --git a/mp_proxyplugin.h b/mp_proxyplugin.h index a0fa574..668561a 100644 --- a/mp_proxyplugin.h +++ b/mp_proxyplugin.h @@ -1,67 +1,67 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_PROXYPLUGIN_H_) -#define _MEDIAPROXY_PROXYPLUGIN_H_ - -#include "mp_config.h" -#include "mp_object.h" -#include "mp_mutex.h" - -#include "ProxyPluginMgr.h" - -namespace webrtc2sip { - -class MPProxyPlugin : public MPObject -{ -protected: - MPProxyPlugin(MPMediaType_t eMediaType, uint64_t nId, const ProxyPlugin* pcProxyPlugin); - -public: - virtual ~MPProxyPlugin(); - MP_INLINE virtual const char* getObjectId() { return "MPProxyPlugin"; } - MP_INLINE bool operator ==(const MPProxyPlugin& other) const{ - return m_nId == other.m_nId; - } - MP_INLINE virtual uint64_t getId() { return m_nId; } - MP_INLINE virtual MPMediaType_t getMediaType() { return m_eMediaType; } - MP_INLINE virtual void invalidate(){ m_bValid = false; } - MP_INLINE virtual bool isValid() { return m_bValid; } - MP_INLINE virtual bool isPrepared() { return m_bPrepared; } - MP_INLINE virtual bool isPaused() { return m_bPaused; } - MP_INLINE virtual bool isStarted() { return m_bStarted; } - -protected: - MP_INLINE int prepare() { m_bPrepared = true; return 0; } - MP_INLINE int start() { m_bStarted = true; return 0; } - MP_INLINE int pause() { m_bPaused = true; return 0; } - MP_INLINE int stop() { m_bStarted = false; return 0; } - -protected: - bool m_bValid; - bool m_bPrepared; - bool m_bStarted; - bool m_bPaused; - uint64_t m_nId; - MPMediaType_t m_eMediaType; - const ProxyPlugin* m_pcProxyPlugin; - MPObjectWrapper m_oMutex; -}; - -} // namespace -#endif /* _MEDIAPROXY_PROXYPLUGIN_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_PROXYPLUGIN_H_) +#define _MEDIAPROXY_PROXYPLUGIN_H_ + +#include "mp_config.h" +#include "mp_object.h" +#include "mp_mutex.h" + +#include "ProxyPluginMgr.h" + +namespace webrtc2sip { + +class MPProxyPlugin : public MPObject +{ +protected: + MPProxyPlugin(MPMediaType_t eMediaType, uint64_t nId, const ProxyPlugin* pcProxyPlugin); + +public: + virtual ~MPProxyPlugin(); + MP_INLINE virtual const char* getObjectId() { return "MPProxyPlugin"; } + MP_INLINE bool operator ==(const MPProxyPlugin& other) const{ + return m_nId == other.m_nId; + } + MP_INLINE virtual uint64_t getId() { return m_nId; } + MP_INLINE virtual MPMediaType_t getMediaType() { return m_eMediaType; } + MP_INLINE virtual void invalidate(){ m_bValid = false; } + MP_INLINE virtual bool isValid() { return m_bValid; } + MP_INLINE virtual bool isPrepared() { return m_bPrepared; } + MP_INLINE virtual bool isPaused() { return m_bPaused; } + MP_INLINE virtual bool isStarted() { return m_bStarted; } + +protected: + MP_INLINE int prepare() { m_bPrepared = true; return 0; } + MP_INLINE int start() { m_bStarted = true; return 0; } + MP_INLINE int pause() { m_bPaused = true; return 0; } + MP_INLINE int stop() { m_bStarted = false; return 0; } + +protected: + bool m_bValid; + bool m_bPrepared; + bool m_bStarted; + bool m_bPaused; + uint64_t m_nId; + MPMediaType_t m_eMediaType; + const ProxyPlugin* m_pcProxyPlugin; + MPObjectWrapper m_oMutex; +}; + +} // namespace +#endif /* _MEDIAPROXY_PROXYPLUGIN_H_ */ diff --git a/mp_proxyplugin_consumer_audio.cc b/mp_proxyplugin_consumer_audio.cc index 755ba43..8f15476 100644 --- a/mp_proxyplugin_consumer_audio.cc +++ b/mp_proxyplugin_consumer_audio.cc @@ -1,177 +1,177 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_proxyplugin_consumer_audio.h" - -#include "MediaSessionMgr.h" - -namespace webrtc2sip { - -// -// MPProxyPluginConsumerAudio -// -MPProxyPluginConsumerAudio::MPProxyPluginConsumerAudio(uint64_t nId, const ProxyAudioConsumer* pcConsumer) -: MPProxyPlugin(MPMediaType_Audio, nId, dynamic_cast(pcConsumer)), m_pcWrappedConsumer(pcConsumer), -m_nPtime(MP_AUDIO_PTIME_DEFAULT), -m_nRate(MP_AUDIO_RATE_DEFAULT), -m_nChannels(MP_AUDIO_CHANNELS_DEFAULT) -{ - m_nVolumeComputeCount = 0; - m_nVolume = 0.0; - m_nLatency = 0; - m_nLastPullTime = 0; - m_pHeldBufferPtr = NULL; - m_nHeldBufferSize = 0; - m_nHeldBufferPos = 0; - m_nLastRTPPacketTime = 0; - m_bByPassDecoding = MediaSessionMgr::defaultsGetByPassDecoding(); - - if((m_oCallback = new MPProxyPluginConsumerAudioCallback(this))){ - const_cast(m_pcWrappedConsumer)->setCallback(*m_oCallback); - } -} - -MPProxyPluginConsumerAudio::~MPProxyPluginConsumerAudio() -{ - m_pcWrappedConsumer = NULL; - TSK_FREE(m_pHeldBufferPtr); - - TSK_DEBUG_INFO("MPProxyPluginConsumerAudio object destroyed"); -} - -int MPProxyPluginConsumerAudio::prepareCallback(int ptime, int rate, int channels) -{ - m_nPtime = ptime; - m_nRate = rate; - m_nChannels = channels; - return MPProxyPlugin::prepare(); -} - -int MPProxyPluginConsumerAudio::startCallback() -{ - // call parent - return MPProxyPlugin::start(); -} - -int MPProxyPluginConsumerAudio::pauseCallback() -{ - // call parent - return MPProxyPlugin::pause(); -} - -int MPProxyPluginConsumerAudio::stopCallback() -{ - // call parent - return MPProxyPlugin::stop(); -} - -int MPProxyPluginConsumerAudio::consumeCallback(const void* buffer_ptr, tsk_size_t buffer_size, const tsk_object_t* proto_hdr) -{ - if(m_oProducerOpposite && m_oProducerOpposite->isValid()){ - return m_oProducerOpposite->push(buffer_ptr, buffer_size); - } - return 0; -} - -unsigned MPProxyPluginConsumerAudio::pullAndHold() -{ -#if 0 - if(!isPrepared()){ - return 0; - } - - if(!m_pHeldBufferPtr){ - m_nHeldBufferSize = (m_nRate * (MP_AUDIO_BITS_PER_SAMPLE_DEFAULT >> 3) * m_nChannels * m_nPtime)/1000; - assert((m_pHeldBufferPtr = tsk_calloc(m_nHeldBufferSize, sizeof(uint8_t)))); - } - - bool bReset = false; - if(m_nLastPullTime){ - m_nLatency += (MPTime::GetNow() - m_nLastPullTime) - m_nPtime; - m_nLatency = TSK_CLAMP(0, m_nLatency, MP_AUDIO_MAX_LATENCY); - - // TSK_DEBUG_INFO("m_nLatency=%lld", m_nLatency); - if(m_nLatency >= MP_AUDIO_MAX_LATENCY){ - m_nLatency = 0; - bReset = true; - } - } - - m_nHeldBufferPos = Pull(m_pHeldBufferPtr, m_nHeldBufferSize); - if(m_nHeldBufferPos){ - m_nVolumeComputeCount+=m_nPtime; - if(m_nVolumeComputeCount >= 1000/* FIXME */){ - m_nVolumeComputeCount = 0; - m_nVolume = 0; - } - int16_t* pHeldBufferPtr = (int16_t*)m_pHeldBufferPtr; - double nValue = 0; - for(uint32_t i = 0; i< m_nHeldBufferSize>>1; ++i){ - nValue += (pHeldBufferPtr[i] > 0) ? 20.0 * log10((double)TSK_ABS(pHeldBufferPtr[i]) / 32768.0) : 72.f; - } - nValue /= m_nHeldBufferSize>>1; - m_nVolume = (m_nVolume + nValue)/(m_nVolumeComputeCount == 0 ? 1 : 2); - //TSK_DEBUG_INFO("m_nVolume=%f", m_nVolume); - } - else{ - m_nVolume /= 2; - //TSK_DEBUG_INFO("No Sound"); - } - - m_nLastPullTime = MPTime::GetNow(); - - if(bReset){ - TSK_DEBUG_INFO("======BOUUUUH======"); - } - - if(m_nHeldBufferPos > 0){ - m_nLastRTPPacketTime = MPTime::GetNow(); - } - - return m_nHeldBufferPos; -#else - return 0; -#endif -} - -unsigned MPProxyPluginConsumerAudio::copyFromHeldBuffer(void* output, unsigned size) -{ - if(!output || !size){ - TSK_DEBUG_ERROR("Invalid parameter"); - return 0; - } - - unsigned nRetSize = 0; - - if(m_pHeldBufferPtr){ - nRetSize = TSK_MIN(m_nHeldBufferPos, size); - if(nRetSize){ - memcpy(output, m_pHeldBufferPtr, nRetSize); - } - } - - if(nRetSize < size){ - // complete with silence - memset(((uint8_t*)output) + nRetSize, 0, (size - nRetSize)); - } - - return nRetSize; -} - - +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_proxyplugin_consumer_audio.h" + +#include "MediaSessionMgr.h" + +namespace webrtc2sip { + +// +// MPProxyPluginConsumerAudio +// +MPProxyPluginConsumerAudio::MPProxyPluginConsumerAudio(uint64_t nId, const ProxyAudioConsumer* pcConsumer) +: MPProxyPlugin(MPMediaType_Audio, nId, dynamic_cast(pcConsumer)), m_pcWrappedConsumer(pcConsumer), +m_nPtime(MP_AUDIO_PTIME_DEFAULT), +m_nRate(MP_AUDIO_RATE_DEFAULT), +m_nChannels(MP_AUDIO_CHANNELS_DEFAULT) +{ + m_nVolumeComputeCount = 0; + m_nVolume = 0.0; + m_nLatency = 0; + m_nLastPullTime = 0; + m_pHeldBufferPtr = NULL; + m_nHeldBufferSize = 0; + m_nHeldBufferPos = 0; + m_nLastRTPPacketTime = 0; + m_bByPassDecoding = MediaSessionMgr::defaultsGetByPassDecoding(); + + if((m_oCallback = new MPProxyPluginConsumerAudioCallback(this))){ + const_cast(m_pcWrappedConsumer)->setCallback(*m_oCallback); + } +} + +MPProxyPluginConsumerAudio::~MPProxyPluginConsumerAudio() +{ + m_pcWrappedConsumer = NULL; + TSK_FREE(m_pHeldBufferPtr); + + TSK_DEBUG_INFO("MPProxyPluginConsumerAudio object destroyed"); +} + +int MPProxyPluginConsumerAudio::prepareCallback(int ptime, int rate, int channels) +{ + m_nPtime = ptime; + m_nRate = rate; + m_nChannels = channels; + return MPProxyPlugin::prepare(); +} + +int MPProxyPluginConsumerAudio::startCallback() +{ + // call parent + return MPProxyPlugin::start(); +} + +int MPProxyPluginConsumerAudio::pauseCallback() +{ + // call parent + return MPProxyPlugin::pause(); +} + +int MPProxyPluginConsumerAudio::stopCallback() +{ + // call parent + return MPProxyPlugin::stop(); +} + +int MPProxyPluginConsumerAudio::consumeCallback(const void* buffer_ptr, tsk_size_t buffer_size, const tsk_object_t* proto_hdr) +{ + if(m_oProducerOpposite && m_oProducerOpposite->isValid()){ + return m_oProducerOpposite->push(buffer_ptr, buffer_size); + } + return 0; +} + +unsigned MPProxyPluginConsumerAudio::pullAndHold() +{ +#if 0 + if(!isPrepared()){ + return 0; + } + + if(!m_pHeldBufferPtr){ + m_nHeldBufferSize = (m_nRate * (MP_AUDIO_BITS_PER_SAMPLE_DEFAULT >> 3) * m_nChannels * m_nPtime)/1000; + assert((m_pHeldBufferPtr = tsk_calloc(m_nHeldBufferSize, sizeof(uint8_t)))); + } + + bool bReset = false; + if(m_nLastPullTime){ + m_nLatency += (MPTime::GetNow() - m_nLastPullTime) - m_nPtime; + m_nLatency = TSK_CLAMP(0, m_nLatency, MP_AUDIO_MAX_LATENCY); + + // TSK_DEBUG_INFO("m_nLatency=%lld", m_nLatency); + if(m_nLatency >= MP_AUDIO_MAX_LATENCY){ + m_nLatency = 0; + bReset = true; + } + } + + m_nHeldBufferPos = Pull(m_pHeldBufferPtr, m_nHeldBufferSize); + if(m_nHeldBufferPos){ + m_nVolumeComputeCount+=m_nPtime; + if(m_nVolumeComputeCount >= 1000/* FIXME */){ + m_nVolumeComputeCount = 0; + m_nVolume = 0; + } + int16_t* pHeldBufferPtr = (int16_t*)m_pHeldBufferPtr; + double nValue = 0; + for(uint32_t i = 0; i< m_nHeldBufferSize>>1; ++i){ + nValue += (pHeldBufferPtr[i] > 0) ? 20.0 * log10((double)TSK_ABS(pHeldBufferPtr[i]) / 32768.0) : 72.f; + } + nValue /= m_nHeldBufferSize>>1; + m_nVolume = (m_nVolume + nValue)/(m_nVolumeComputeCount == 0 ? 1 : 2); + //TSK_DEBUG_INFO("m_nVolume=%f", m_nVolume); + } + else{ + m_nVolume /= 2; + //TSK_DEBUG_INFO("No Sound"); + } + + m_nLastPullTime = MPTime::GetNow(); + + if(bReset){ + TSK_DEBUG_INFO("======BOUUUUH======"); + } + + if(m_nHeldBufferPos > 0){ + m_nLastRTPPacketTime = MPTime::GetNow(); + } + + return m_nHeldBufferPos; +#else + return 0; +#endif +} + +unsigned MPProxyPluginConsumerAudio::copyFromHeldBuffer(void* output, unsigned size) +{ + if(!output || !size){ + TSK_DEBUG_ERROR("Invalid parameter"); + return 0; + } + + unsigned nRetSize = 0; + + if(m_pHeldBufferPtr){ + nRetSize = TSK_MIN(m_nHeldBufferPos, size); + if(nRetSize){ + memcpy(output, m_pHeldBufferPtr, nRetSize); + } + } + + if(nRetSize < size){ + // complete with silence + memset(((uint8_t*)output) + nRetSize, 0, (size - nRetSize)); + } + + return nRetSize; +} + + } // namespace \ No newline at end of file diff --git a/mp_proxyplugin_consumer_audio.h b/mp_proxyplugin_consumer_audio.h index 55ea318..d33f25e 100644 --- a/mp_proxyplugin_consumer_audio.h +++ b/mp_proxyplugin_consumer_audio.h @@ -1,123 +1,123 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_PROXYPLUGIN_CONSUMER_AUDIO_H_) -#define _MEDIAPROXY_PROXYPLUGIN_CONSUMER_AUDIO_H_ - -#include "mp_config.h" -#include "mp_proxyplugin.h" -#include "mp_proxyplugin_producer_audio.h" - -#include "ProxyConsumer.h" - -namespace webrtc2sip { - -class MPProxyPluginConsumerAudioCallback; - -// -// MPProxyPluginConsumerAudio -// -class MPProxyPluginConsumerAudio : public MPProxyPlugin -{ - friend class MPProxyPluginConsumerAudioCallback; -public: - MPProxyPluginConsumerAudio(uint64_t nId, const ProxyAudioConsumer* pcConsumer); - virtual ~MPProxyPluginConsumerAudio(); - - MP_INLINE void setProducerOpposite(MPObjectWrapper oProducer){ - m_oProducerOpposite = oProducer; - } - MP_INLINE unsigned pull(void* output, unsigned size){ - return m_pcWrappedConsumer ? const_cast(m_pcWrappedConsumer)->pull(output, size) : 0; - } - unsigned pullAndHold(); - unsigned copyFromHeldBuffer(void* output, unsigned size); - MP_INLINE bool reset(){ - return m_pcWrappedConsumer ? const_cast(m_pcWrappedConsumer)->reset() : false; - } - MP_INLINE int getPtime() { return m_nPtime; } - MP_INLINE int getRate() { return m_nRate; } - MP_INLINE int getChannels() { return m_nChannels; } - MP_INLINE double getVolume() { return m_nVolume; } - MP_INLINE uint64_t getLastRTPPacketTime() { return m_nLastRTPPacketTime; } - - MP_INLINE void setByPassDecoding(bool bByPass){ m_bByPassDecoding = bByPass; } - MP_INLINE bool isByPassDecoding(){ return m_bByPassDecoding; } - -private: - int prepareCallback(int ptime, int rate, int channels); - int startCallback(); - int pauseCallback(); - int stopCallback(); - int consumeCallback(const void* buffer_ptr, tsk_size_t buffer_size, const tsk_object_t* proto_hdr); - -private: - MPObjectWrapper m_oCallback; - // "Left" producer if consumer is on the "right" side and "Right" otherwise - MPObjectWrapper m_oProducerOpposite; - const ProxyAudioConsumer* m_pcWrappedConsumer; - int m_nPtime; - int m_nRate; - int m_nChannels; - void* m_pHeldBufferPtr; - double m_nVolume; - uint32_t m_nVolumeComputeCount; - uint32_t m_nHeldBufferSize; - uint32_t m_nHeldBufferPos; - int64_t m_nLatency; - uint64_t m_nLastPullTime; - uint64_t m_nLastRTPPacketTime; - bool m_bByPassDecoding; -}; - -// -// MPProxyPluginConsumerAudioCallback -// -class MPProxyPluginConsumerAudioCallback : public ProxyAudioConsumerCallback, public MPObject { -public: - MPProxyPluginConsumerAudioCallback(const MPProxyPluginConsumerAudio* pcConsumer) - : ProxyAudioConsumerCallback(), m_pcConsumer(pcConsumer){ - } - virtual ~MPProxyPluginConsumerAudioCallback(){ - } - MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginConsumerAudioCallback"; } -public: /* Overrides */ - virtual int prepare(int ptime, int rate, int channels) { - return const_cast(m_pcConsumer)->prepareCallback(ptime, rate, channels); - } - virtual int start() { - return const_cast(m_pcConsumer)->startCallback(); - } - virtual int pause() { - return const_cast(m_pcConsumer)->pauseCallback(); - } - virtual int stop() { - return const_cast(m_pcConsumer)->stopCallback(); - } - virtual bool putInJitterBuffer(){ - return false; - } - virtual int consume(const void* buffer_ptr, tsk_size_t buffer_size, const tsk_object_t* proto_hdr) { - return const_cast(m_pcConsumer)->consumeCallback(buffer_ptr, buffer_size, proto_hdr); - } -private: - const MPProxyPluginConsumerAudio* m_pcConsumer; -}; - -} // namespace -#endif /* _MEDIAPROXY_PROXYPLUGIN_CONSUMER_AUDIO_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_PROXYPLUGIN_CONSUMER_AUDIO_H_) +#define _MEDIAPROXY_PROXYPLUGIN_CONSUMER_AUDIO_H_ + +#include "mp_config.h" +#include "mp_proxyplugin.h" +#include "mp_proxyplugin_producer_audio.h" + +#include "ProxyConsumer.h" + +namespace webrtc2sip { + +class MPProxyPluginConsumerAudioCallback; + +// +// MPProxyPluginConsumerAudio +// +class MPProxyPluginConsumerAudio : public MPProxyPlugin +{ + friend class MPProxyPluginConsumerAudioCallback; +public: + MPProxyPluginConsumerAudio(uint64_t nId, const ProxyAudioConsumer* pcConsumer); + virtual ~MPProxyPluginConsumerAudio(); + + MP_INLINE void setProducerOpposite(MPObjectWrapper oProducer){ + m_oProducerOpposite = oProducer; + } + MP_INLINE unsigned pull(void* output, unsigned size){ + return m_pcWrappedConsumer ? const_cast(m_pcWrappedConsumer)->pull(output, size) : 0; + } + unsigned pullAndHold(); + unsigned copyFromHeldBuffer(void* output, unsigned size); + MP_INLINE bool reset(){ + return m_pcWrappedConsumer ? const_cast(m_pcWrappedConsumer)->reset() : false; + } + MP_INLINE int getPtime() { return m_nPtime; } + MP_INLINE int getRate() { return m_nRate; } + MP_INLINE int getChannels() { return m_nChannels; } + MP_INLINE double getVolume() { return m_nVolume; } + MP_INLINE uint64_t getLastRTPPacketTime() { return m_nLastRTPPacketTime; } + + MP_INLINE void setByPassDecoding(bool bByPass){ m_bByPassDecoding = bByPass; } + MP_INLINE bool isByPassDecoding(){ return m_bByPassDecoding; } + +private: + int prepareCallback(int ptime, int rate, int channels); + int startCallback(); + int pauseCallback(); + int stopCallback(); + int consumeCallback(const void* buffer_ptr, tsk_size_t buffer_size, const tsk_object_t* proto_hdr); + +private: + MPObjectWrapper m_oCallback; + // "Left" producer if consumer is on the "right" side and "Right" otherwise + MPObjectWrapper m_oProducerOpposite; + const ProxyAudioConsumer* m_pcWrappedConsumer; + int m_nPtime; + int m_nRate; + int m_nChannels; + void* m_pHeldBufferPtr; + double m_nVolume; + uint32_t m_nVolumeComputeCount; + uint32_t m_nHeldBufferSize; + uint32_t m_nHeldBufferPos; + int64_t m_nLatency; + uint64_t m_nLastPullTime; + uint64_t m_nLastRTPPacketTime; + bool m_bByPassDecoding; +}; + +// +// MPProxyPluginConsumerAudioCallback +// +class MPProxyPluginConsumerAudioCallback : public ProxyAudioConsumerCallback, public MPObject { +public: + MPProxyPluginConsumerAudioCallback(const MPProxyPluginConsumerAudio* pcConsumer) + : ProxyAudioConsumerCallback(), m_pcConsumer(pcConsumer){ + } + virtual ~MPProxyPluginConsumerAudioCallback(){ + } + MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginConsumerAudioCallback"; } +public: /* Overrides */ + virtual int prepare(int ptime, int rate, int channels) { + return const_cast(m_pcConsumer)->prepareCallback(ptime, rate, channels); + } + virtual int start() { + return const_cast(m_pcConsumer)->startCallback(); + } + virtual int pause() { + return const_cast(m_pcConsumer)->pauseCallback(); + } + virtual int stop() { + return const_cast(m_pcConsumer)->stopCallback(); + } + virtual bool putInJitterBuffer(){ + return false; + } + virtual int consume(const void* buffer_ptr, tsk_size_t buffer_size, const tsk_object_t* proto_hdr) { + return const_cast(m_pcConsumer)->consumeCallback(buffer_ptr, buffer_size, proto_hdr); + } +private: + const MPProxyPluginConsumerAudio* m_pcConsumer; +}; + +} // namespace +#endif /* _MEDIAPROXY_PROXYPLUGIN_CONSUMER_AUDIO_H_ */ diff --git a/mp_proxyplugin_consumer_video.cc b/mp_proxyplugin_consumer_video.cc index 7dd5b88..1e91553 100644 --- a/mp_proxyplugin_consumer_video.cc +++ b/mp_proxyplugin_consumer_video.cc @@ -1,94 +1,94 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_proxyplugin_consumer_video.h" - -#include "MediaSessionMgr.h" - -#include - -namespace webrtc2sip { - -MPProxyPluginConsumerVideo::MPProxyPluginConsumerVideo(uint64_t nId, const ProxyVideoConsumer* pcConsumer) -: MPProxyPlugin(MPMediaType_Video, nId, dynamic_cast(pcConsumer)), m_pcWrappedConsumer(pcConsumer), -m_nWidth(MP_VIDEO_WIDTH_DEFAULT), m_nHeight(MP_VIDEO_HEIGHT_DEFAULT), m_nFPS(MP_VIDEO_FPS_DEFAULT) -{ - m_nLastRTPPacketTime = 0; - m_bByPassDecoding = MediaSessionMgr::defaultsGetByPassDecoding(); - - m_oCallback = new MPProxyPluginConsumerVideoCallback(this); - const_cast(m_pcWrappedConsumer)->setCallback(*m_oCallback); - const_cast(m_pcWrappedConsumer)->setAutoResizeDisplay(true); -} - -MPProxyPluginConsumerVideo::~MPProxyPluginConsumerVideo() -{ - m_pcWrappedConsumer = NULL; - - TSK_DEBUG_INFO("MPProxyPluginConsumerVideo object destroyed"); -} - -int MPProxyPluginConsumerVideo::prepareCallback(int nWidth, int nHeight, int nFps) -{ - m_nWidth = nWidth; - m_nHeight = nHeight; - m_nFPS = nFps; - - // call parent - return MPProxyPlugin::prepare(); -} - -int MPProxyPluginConsumerVideo::startCallback() -{ - // call parent - return MPProxyPlugin::start(); -} - -int MPProxyPluginConsumerVideo::consumeCallback(const ProxyVideoFrame* frame) -{ - if(frame && m_oProducerOpposite && m_oProducerOpposite->isValid()){ - if(m_oProducerOpposite->isByPassEncoding()){ - return m_oProducerOpposite->sendRaw(frame->getBufferPtr(), - frame->getBufferSize(), - frame->getProtoHdr()); - } - else{ - return m_oProducerOpposite->push( - frame->getBufferPtr(), - frame->getBufferSize(), - frame->getFrameWidth(), - frame->getFrameHeight()); - } - } - return 0; -} - -int MPProxyPluginConsumerVideo::pauseCallback() -{ - // call parent - return MPProxyPlugin::pause(); -} - -int MPProxyPluginConsumerVideo::stopCallback() -{ - // call parent - return MPProxyPlugin::stop(); -} - - -} // namespace +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_proxyplugin_consumer_video.h" + +#include "MediaSessionMgr.h" + +#include + +namespace webrtc2sip { + +MPProxyPluginConsumerVideo::MPProxyPluginConsumerVideo(uint64_t nId, const ProxyVideoConsumer* pcConsumer) +: MPProxyPlugin(MPMediaType_Video, nId, dynamic_cast(pcConsumer)), m_pcWrappedConsumer(pcConsumer), +m_nWidth(MP_VIDEO_WIDTH_DEFAULT), m_nHeight(MP_VIDEO_HEIGHT_DEFAULT), m_nFPS(MP_VIDEO_FPS_DEFAULT) +{ + m_nLastRTPPacketTime = 0; + m_bByPassDecoding = MediaSessionMgr::defaultsGetByPassDecoding(); + + m_oCallback = new MPProxyPluginConsumerVideoCallback(this); + const_cast(m_pcWrappedConsumer)->setCallback(*m_oCallback); + const_cast(m_pcWrappedConsumer)->setAutoResizeDisplay(true); +} + +MPProxyPluginConsumerVideo::~MPProxyPluginConsumerVideo() +{ + m_pcWrappedConsumer = NULL; + + TSK_DEBUG_INFO("MPProxyPluginConsumerVideo object destroyed"); +} + +int MPProxyPluginConsumerVideo::prepareCallback(int nWidth, int nHeight, int nFps) +{ + m_nWidth = nWidth; + m_nHeight = nHeight; + m_nFPS = nFps; + + // call parent + return MPProxyPlugin::prepare(); +} + +int MPProxyPluginConsumerVideo::startCallback() +{ + // call parent + return MPProxyPlugin::start(); +} + +int MPProxyPluginConsumerVideo::consumeCallback(const ProxyVideoFrame* frame) +{ + if(frame && m_oProducerOpposite && m_oProducerOpposite->isValid()){ + if(m_oProducerOpposite->isByPassEncoding()){ + return m_oProducerOpposite->sendRaw(frame->getBufferPtr(), + frame->getBufferSize(), + frame->getProtoHdr()); + } + else{ + return m_oProducerOpposite->push( + frame->getBufferPtr(), + frame->getBufferSize(), + frame->getFrameWidth(), + frame->getFrameHeight()); + } + } + return 0; +} + +int MPProxyPluginConsumerVideo::pauseCallback() +{ + // call parent + return MPProxyPlugin::pause(); +} + +int MPProxyPluginConsumerVideo::stopCallback() +{ + // call parent + return MPProxyPlugin::stop(); +} + + +} // namespace diff --git a/mp_proxyplugin_consumer_video.h b/mp_proxyplugin_consumer_video.h index f45e5cb..bfea569 100644 --- a/mp_proxyplugin_consumer_video.h +++ b/mp_proxyplugin_consumer_video.h @@ -1,108 +1,108 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_PROXYPLUGIN_CONSUMER_VIDEO_H_) -#define _MEDIAPROXY_PROXYPLUGIN_CONSUMER_VIDEO_H_ - -#include "mp_config.h" -#include "mp_proxyplugin.h" -#include "mp_proxyplugin_producer_video.h" - -#include "ProxyConsumer.h" - -namespace webrtc2sip { - -class MPProxyPluginConsumerVideoCallback; - -class MPProxyPluginConsumerVideo : public MPProxyPlugin -{ - friend class MPProxyPluginConsumerVideoCallback; -public: - MPProxyPluginConsumerVideo(uint64_t nId, const ProxyVideoConsumer* pcConsumer); - virtual ~MPProxyPluginConsumerVideo(); - MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginConsumerVideo"; } - -public: - MP_INLINE void setProducerOpposite(MPObjectWrapper oProducer){ - m_oProducerOpposite = oProducer; - } - MP_INLINE bool setDisplaySize(int nWidth, int nHeight){ - return m_pcWrappedConsumer ? const_cast(m_pcWrappedConsumer)->setDisplaySize(nWidth, nHeight) : false; - } - MP_INLINE bool reset(){ - return m_pcWrappedConsumer ? const_cast(m_pcWrappedConsumer)->reset() : false; - } - MP_INLINE int getFps() { return m_nFPS; } - MP_INLINE int getHeight() { return m_nHeight; } - MP_INLINE int getWidth() { return m_nWidth; } - MP_INLINE uint64_t getLastRTPPacketTime() { return m_nLastRTPPacketTime; } - - MP_INLINE void setByPassDecoding(bool bByPass){ m_bByPassDecoding = bByPass; } - MP_INLINE bool isByPassDecoding(){ return m_bByPassDecoding; } - -private: - int prepareCallback(int nWidth, int nHeight, int nFps); - int startCallback(); - int consumeCallback(const ProxyVideoFrame* frame); - int pauseCallback(); - int stopCallback(); - -private: - MPObjectWrapper m_oCallback; - // "Left" producer if consumer is on the "right" side and "Right" otherwise - MPObjectWrapper m_oProducerOpposite; - const ProxyVideoConsumer* m_pcWrappedConsumer; - int m_nWidth, m_nHeight, m_nFPS; - uint64_t m_nLastRTPPacketTime; - bool m_bByPassDecoding; -}; - -// -// MPProxyPluginConsumerVideoCallback -// -class MPProxyPluginConsumerVideoCallback : public ProxyVideoConsumerCallback, public MPObject { -public: - MPProxyPluginConsumerVideoCallback(const MPProxyPluginConsumerVideo* pcConsumer) - : ProxyVideoConsumerCallback(), m_pcConsumer(pcConsumer){ - } - virtual ~MPProxyPluginConsumerVideoCallback(){ - } - MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginConsumerVideoCallback"; } -public: /* Overrides */ - virtual int prepare(int width, int height, int fps) { - return const_cast(m_pcConsumer)->prepareCallback(width, height, fps); - } - virtual int start() { - return const_cast(m_pcConsumer)->startCallback(); - } - virtual int consume(const ProxyVideoFrame* frame) { - return const_cast(m_pcConsumer)->consumeCallback(frame); - } - virtual int pause() { - return const_cast(m_pcConsumer)->pauseCallback(); - } - virtual int stop() { - return const_cast(m_pcConsumer)->stopCallback(); - } -private: - const MPProxyPluginConsumerVideo* m_pcConsumer; -}; - - -} // namespace -#endif /* _MEDIAPROXY_PROXYPLUGIN_CONSUMER_VIDEO_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_PROXYPLUGIN_CONSUMER_VIDEO_H_) +#define _MEDIAPROXY_PROXYPLUGIN_CONSUMER_VIDEO_H_ + +#include "mp_config.h" +#include "mp_proxyplugin.h" +#include "mp_proxyplugin_producer_video.h" + +#include "ProxyConsumer.h" + +namespace webrtc2sip { + +class MPProxyPluginConsumerVideoCallback; + +class MPProxyPluginConsumerVideo : public MPProxyPlugin +{ + friend class MPProxyPluginConsumerVideoCallback; +public: + MPProxyPluginConsumerVideo(uint64_t nId, const ProxyVideoConsumer* pcConsumer); + virtual ~MPProxyPluginConsumerVideo(); + MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginConsumerVideo"; } + +public: + MP_INLINE void setProducerOpposite(MPObjectWrapper oProducer){ + m_oProducerOpposite = oProducer; + } + MP_INLINE bool setDisplaySize(int nWidth, int nHeight){ + return m_pcWrappedConsumer ? const_cast(m_pcWrappedConsumer)->setDisplaySize(nWidth, nHeight) : false; + } + MP_INLINE bool reset(){ + return m_pcWrappedConsumer ? const_cast(m_pcWrappedConsumer)->reset() : false; + } + MP_INLINE int getFps() { return m_nFPS; } + MP_INLINE int getHeight() { return m_nHeight; } + MP_INLINE int getWidth() { return m_nWidth; } + MP_INLINE uint64_t getLastRTPPacketTime() { return m_nLastRTPPacketTime; } + + MP_INLINE void setByPassDecoding(bool bByPass){ m_bByPassDecoding = bByPass; } + MP_INLINE bool isByPassDecoding(){ return m_bByPassDecoding; } + +private: + int prepareCallback(int nWidth, int nHeight, int nFps); + int startCallback(); + int consumeCallback(const ProxyVideoFrame* frame); + int pauseCallback(); + int stopCallback(); + +private: + MPObjectWrapper m_oCallback; + // "Left" producer if consumer is on the "right" side and "Right" otherwise + MPObjectWrapper m_oProducerOpposite; + const ProxyVideoConsumer* m_pcWrappedConsumer; + int m_nWidth, m_nHeight, m_nFPS; + uint64_t m_nLastRTPPacketTime; + bool m_bByPassDecoding; +}; + +// +// MPProxyPluginConsumerVideoCallback +// +class MPProxyPluginConsumerVideoCallback : public ProxyVideoConsumerCallback, public MPObject { +public: + MPProxyPluginConsumerVideoCallback(const MPProxyPluginConsumerVideo* pcConsumer) + : ProxyVideoConsumerCallback(), m_pcConsumer(pcConsumer){ + } + virtual ~MPProxyPluginConsumerVideoCallback(){ + } + MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginConsumerVideoCallback"; } +public: /* Overrides */ + virtual int prepare(int width, int height, int fps) { + return const_cast(m_pcConsumer)->prepareCallback(width, height, fps); + } + virtual int start() { + return const_cast(m_pcConsumer)->startCallback(); + } + virtual int consume(const ProxyVideoFrame* frame) { + return const_cast(m_pcConsumer)->consumeCallback(frame); + } + virtual int pause() { + return const_cast(m_pcConsumer)->pauseCallback(); + } + virtual int stop() { + return const_cast(m_pcConsumer)->stopCallback(); + } +private: + const MPProxyPluginConsumerVideo* m_pcConsumer; +}; + + +} // namespace +#endif /* _MEDIAPROXY_PROXYPLUGIN_CONSUMER_VIDEO_H_ */ diff --git a/mp_proxyplugin_mgr.h b/mp_proxyplugin_mgr.h index af45ef1..b2af1e0 100644 --- a/mp_proxyplugin_mgr.h +++ b/mp_proxyplugin_mgr.h @@ -1,96 +1,96 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_PROXYPLUGIN_MGR_H_) -#define _MEDIAPROXY_PROXYPLUGIN_MGR_H_ - -#include "mp_config.h" -#include "mp_proxyplugin.h" - -#include "tsk_mutex.h" - -#include - -namespace webrtc2sip { - -class MPProxyPluginMgrCallback; -typedef std::map > MPMapOfPlugins; - -// -// MPProxyPluginMgr -// -class MPProxyPluginMgr -{ -private: - static ProxyPluginMgr* g_pPluginMgr; - static MPProxyPluginMgrCallback* g_pPluginMgrCallback; - static MPMapOfPlugins* g_pPlugins; - static tsk_mutex_handle_t* g_phMutex; - static bool g_bInitialized; - -public: - static void initialize(); - static void deInitialize(); - - static inline MPObjectWrapper findPlugin(uint64_t nId){ - MPMapOfPlugins::iterator it = MPProxyPluginMgr::g_pPlugins->find(nId); - MPObjectWrapper pPlugin = NULL; - if(it != MPProxyPluginMgr::g_pPlugins->end()){ - pPlugin = it->second; - } - return pPlugin; - } - - static inline void erasePlugin(uint64_t nId){ - MPMapOfPlugins::iterator it; - if((it = MPProxyPluginMgr::g_pPlugins->find(nId)) != MPProxyPluginMgr::g_pPlugins->end()){ - MPObjectWrapper pPlugin = it->second; - MPProxyPluginMgr::g_pPlugins->erase(it); - pPlugin->invalidate(); - } - } - - static inline MPMapOfPlugins* getPlugins(){ - return MPProxyPluginMgr::g_pPlugins; - } - - static inline tsk_mutex_handle_t* getMutex(){ - return MPProxyPluginMgr::g_phMutex; - } - - static inline ProxyPluginMgr* getPluginMgr(){ - return const_cast (MPProxyPluginMgr::g_pPluginMgr); - } -}; - -// -// MPProxyPluginMgrCallback -// -class MPProxyPluginMgrCallback : public ProxyPluginMgrCallback -{ -public: - MPProxyPluginMgrCallback(); - virtual ~MPProxyPluginMgrCallback(); - -public: /* override */ - virtual int OnPluginCreated(uint64_t id, enum twrap_proxy_plugin_type_e type); - virtual int OnPluginDestroyed(uint64_t id, enum twrap_proxy_plugin_type_e type); -}; - -} // namespace -#endif /* _MEDIAPROXY_PROXYPLUGIN_MGR_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_PROXYPLUGIN_MGR_H_) +#define _MEDIAPROXY_PROXYPLUGIN_MGR_H_ + +#include "mp_config.h" +#include "mp_proxyplugin.h" + +#include "tsk_mutex.h" + +#include + +namespace webrtc2sip { + +class MPProxyPluginMgrCallback; +typedef std::map > MPMapOfPlugins; + +// +// MPProxyPluginMgr +// +class MPProxyPluginMgr +{ +private: + static ProxyPluginMgr* g_pPluginMgr; + static MPProxyPluginMgrCallback* g_pPluginMgrCallback; + static MPMapOfPlugins* g_pPlugins; + static tsk_mutex_handle_t* g_phMutex; + static bool g_bInitialized; + +public: + static void initialize(); + static void deInitialize(); + + static inline MPObjectWrapper findPlugin(uint64_t nId){ + MPMapOfPlugins::iterator it = MPProxyPluginMgr::g_pPlugins->find(nId); + MPObjectWrapper pPlugin = NULL; + if(it != MPProxyPluginMgr::g_pPlugins->end()){ + pPlugin = it->second; + } + return pPlugin; + } + + static inline void erasePlugin(uint64_t nId){ + MPMapOfPlugins::iterator it; + if((it = MPProxyPluginMgr::g_pPlugins->find(nId)) != MPProxyPluginMgr::g_pPlugins->end()){ + MPObjectWrapper pPlugin = it->second; + MPProxyPluginMgr::g_pPlugins->erase(it); + pPlugin->invalidate(); + } + } + + static inline MPMapOfPlugins* getPlugins(){ + return MPProxyPluginMgr::g_pPlugins; + } + + static inline tsk_mutex_handle_t* getMutex(){ + return MPProxyPluginMgr::g_phMutex; + } + + static inline ProxyPluginMgr* getPluginMgr(){ + return const_cast (MPProxyPluginMgr::g_pPluginMgr); + } +}; + +// +// MPProxyPluginMgrCallback +// +class MPProxyPluginMgrCallback : public ProxyPluginMgrCallback +{ +public: + MPProxyPluginMgrCallback(); + virtual ~MPProxyPluginMgrCallback(); + +public: /* override */ + virtual int OnPluginCreated(uint64_t id, enum twrap_proxy_plugin_type_e type); + virtual int OnPluginDestroyed(uint64_t id, enum twrap_proxy_plugin_type_e type); +}; + +} // namespace +#endif /* _MEDIAPROXY_PROXYPLUGIN_MGR_H_ */ diff --git a/mp_proxyplugin_producer_audio.cc b/mp_proxyplugin_producer_audio.cc index d227b2b..f38ed6f 100644 --- a/mp_proxyplugin_producer_audio.cc +++ b/mp_proxyplugin_producer_audio.cc @@ -1,79 +1,79 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_proxyplugin_producer_audio.h" - -#include "MediaSessionMgr.h" - -namespace webrtc2sip { - -MPProxyPluginProducerAudio::MPProxyPluginProducerAudio(uint64_t nId, const ProxyAudioProducer* pcProducer) -: MPProxyPlugin(MPMediaType_Audio, nId, dynamic_cast(pcProducer)), -m_nPtime(MP_AUDIO_PTIME_DEFAULT), -m_nRate(MP_AUDIO_RATE_DEFAULT), -m_nChannels(MP_AUDIO_CHANNELS_DEFAULT) -{ - m_bByPassEncoding = MediaSessionMgr::defaultsGetByPassEncoding(); - m_pcWrappedProducer = pcProducer; - m_oCallback = new MPProxyPluginProducerAudioCallback(this); - const_cast(m_pcWrappedProducer)->setCallback(*m_oCallback); -} - -MPProxyPluginProducerAudio::~MPProxyPluginProducerAudio() -{ - m_pcWrappedProducer = NULL; - - TSK_DEBUG_INFO("MPProxyPluginProducerAudio object destroyed"); -} - -int MPProxyPluginProducerAudio::prepareCallback(int ptime, int rate, int channels) -{ - m_nPtime = ptime; - m_nRate = rate; - m_nChannels = channels; - // call parent - return MPProxyPlugin::prepare(); -} - -int MPProxyPluginProducerAudio::startCallback() -{ - - // call parent - return MPProxyPlugin::start(); -} - -int MPProxyPluginProducerAudio::pauseCallback() -{ - // call parent - return MPProxyPlugin::pause(); -} - -int MPProxyPluginProducerAudio::stopCallback() -{ - int ret; - - // call parent - if(ret = MPProxyPlugin::stop()){ - TSK_DEBUG_ERROR("Failed to stop producer"); - return ret; - } - - return ret; -} - +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_proxyplugin_producer_audio.h" + +#include "MediaSessionMgr.h" + +namespace webrtc2sip { + +MPProxyPluginProducerAudio::MPProxyPluginProducerAudio(uint64_t nId, const ProxyAudioProducer* pcProducer) +: MPProxyPlugin(MPMediaType_Audio, nId, dynamic_cast(pcProducer)), +m_nPtime(MP_AUDIO_PTIME_DEFAULT), +m_nRate(MP_AUDIO_RATE_DEFAULT), +m_nChannels(MP_AUDIO_CHANNELS_DEFAULT) +{ + m_bByPassEncoding = MediaSessionMgr::defaultsGetByPassEncoding(); + m_pcWrappedProducer = pcProducer; + m_oCallback = new MPProxyPluginProducerAudioCallback(this); + const_cast(m_pcWrappedProducer)->setCallback(*m_oCallback); +} + +MPProxyPluginProducerAudio::~MPProxyPluginProducerAudio() +{ + m_pcWrappedProducer = NULL; + + TSK_DEBUG_INFO("MPProxyPluginProducerAudio object destroyed"); +} + +int MPProxyPluginProducerAudio::prepareCallback(int ptime, int rate, int channels) +{ + m_nPtime = ptime; + m_nRate = rate; + m_nChannels = channels; + // call parent + return MPProxyPlugin::prepare(); +} + +int MPProxyPluginProducerAudio::startCallback() +{ + + // call parent + return MPProxyPlugin::start(); +} + +int MPProxyPluginProducerAudio::pauseCallback() +{ + // call parent + return MPProxyPlugin::pause(); +} + +int MPProxyPluginProducerAudio::stopCallback() +{ + int ret; + + // call parent + if(ret = MPProxyPlugin::stop()){ + TSK_DEBUG_ERROR("Failed to stop producer"); + return ret; + } + + return ret; +} + } // namespace \ No newline at end of file diff --git a/mp_proxyplugin_producer_audio.h b/mp_proxyplugin_producer_audio.h index 9c6b669..f694bce 100644 --- a/mp_proxyplugin_producer_audio.h +++ b/mp_proxyplugin_producer_audio.h @@ -1,95 +1,95 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_PROXYPLUGIN_PRODUCER_AUDIO_H_) -#define _MEDIAPROXY_PROXYPLUGIN_PRODUCER_AUDIO_H_ - -#include "mp_config.h" -#include "mp_proxyplugin.h" - -#include "ProxyProducer.h" - -namespace webrtc2sip { - -class MPProxyPluginProducerAudioCallback; - -// -// MPProxyPluginProducerAudio -// -class MPProxyPluginProducerAudio : public MPProxyPlugin -{ - friend class MPProxyPluginProducerAudioCallback; -public: - MPProxyPluginProducerAudio(uint64_t nId, const ProxyAudioProducer* pcProducer); - virtual ~MPProxyPluginProducerAudio(); - MP_INLINE int push(const void* buffer, unsigned size){ return (m_pcWrappedProducer ? const_cast(m_pcWrappedProducer)->push(buffer, size) : -1); } - MP_INLINE int getPtime() { return m_nPtime; } - MP_INLINE int getRate() { return m_nRate; } - MP_INLINE int getChannels() { return m_nChannels; } - - MP_INLINE void setByPassEncoding(bool bByPass){ m_bByPassEncoding = bByPass; } - MP_INLINE bool isByPassEncoding(){ return m_bByPassEncoding; } - -private: - int prepareCallback(int ptime, int rate, int channels); - int startCallback(); - int pauseCallback(); - int stopCallback(); - -private: - MPObjectWrapper m_oCallback; - const ProxyAudioProducer* m_pcWrappedProducer; - int m_nPtime; - int m_nRate; - int m_nChannels; - bool m_bByPassEncoding; -}; - - -// -// MPProxyPluginProducerAudioCallback -// -class MPProxyPluginProducerAudioCallback : public ProxyAudioProducerCallback, public MPObject { -public: - MPProxyPluginProducerAudioCallback(const MPProxyPluginProducerAudio* pcMPProducer) - : ProxyAudioProducerCallback(), m_pcMPProducer(pcMPProducer){ - } - virtual ~MPProxyPluginProducerAudioCallback(){ - } - MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginProducerAudioCallback"; } - -public: /* Overrides */ - virtual int prepare(int ptime, int rate, int channels) { - return const_cast(m_pcMPProducer)->prepareCallback(ptime, rate, channels); - } - virtual int start() { - return const_cast(m_pcMPProducer)->startCallback(); - } - virtual int pause() { - return const_cast(m_pcMPProducer)->pauseCallback(); - } - virtual int stop() { - return const_cast(m_pcMPProducer)->stopCallback(); - } -private: - const MPProxyPluginProducerAudio* m_pcMPProducer; -}; - - -} // namespace -#endif /* _MEDIAPROXY_PROXYPLUGIN_PRODUCER_AUDIO_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_PROXYPLUGIN_PRODUCER_AUDIO_H_) +#define _MEDIAPROXY_PROXYPLUGIN_PRODUCER_AUDIO_H_ + +#include "mp_config.h" +#include "mp_proxyplugin.h" + +#include "ProxyProducer.h" + +namespace webrtc2sip { + +class MPProxyPluginProducerAudioCallback; + +// +// MPProxyPluginProducerAudio +// +class MPProxyPluginProducerAudio : public MPProxyPlugin +{ + friend class MPProxyPluginProducerAudioCallback; +public: + MPProxyPluginProducerAudio(uint64_t nId, const ProxyAudioProducer* pcProducer); + virtual ~MPProxyPluginProducerAudio(); + MP_INLINE int push(const void* buffer, unsigned size){ return (m_pcWrappedProducer ? const_cast(m_pcWrappedProducer)->push(buffer, size) : -1); } + MP_INLINE int getPtime() { return m_nPtime; } + MP_INLINE int getRate() { return m_nRate; } + MP_INLINE int getChannels() { return m_nChannels; } + + MP_INLINE void setByPassEncoding(bool bByPass){ m_bByPassEncoding = bByPass; } + MP_INLINE bool isByPassEncoding(){ return m_bByPassEncoding; } + +private: + int prepareCallback(int ptime, int rate, int channels); + int startCallback(); + int pauseCallback(); + int stopCallback(); + +private: + MPObjectWrapper m_oCallback; + const ProxyAudioProducer* m_pcWrappedProducer; + int m_nPtime; + int m_nRate; + int m_nChannels; + bool m_bByPassEncoding; +}; + + +// +// MPProxyPluginProducerAudioCallback +// +class MPProxyPluginProducerAudioCallback : public ProxyAudioProducerCallback, public MPObject { +public: + MPProxyPluginProducerAudioCallback(const MPProxyPluginProducerAudio* pcMPProducer) + : ProxyAudioProducerCallback(), m_pcMPProducer(pcMPProducer){ + } + virtual ~MPProxyPluginProducerAudioCallback(){ + } + MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginProducerAudioCallback"; } + +public: /* Overrides */ + virtual int prepare(int ptime, int rate, int channels) { + return const_cast(m_pcMPProducer)->prepareCallback(ptime, rate, channels); + } + virtual int start() { + return const_cast(m_pcMPProducer)->startCallback(); + } + virtual int pause() { + return const_cast(m_pcMPProducer)->pauseCallback(); + } + virtual int stop() { + return const_cast(m_pcMPProducer)->stopCallback(); + } +private: + const MPProxyPluginProducerAudio* m_pcMPProducer; +}; + + +} // namespace +#endif /* _MEDIAPROXY_PROXYPLUGIN_PRODUCER_AUDIO_H_ */ diff --git a/mp_proxyplugin_producer_video.cc b/mp_proxyplugin_producer_video.cc index 5d49136..65cabbb 100644 --- a/mp_proxyplugin_producer_video.cc +++ b/mp_proxyplugin_producer_video.cc @@ -1,101 +1,101 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_proxyplugin_producer_video.h" - -#include "MediaSessionMgr.h" - -namespace webrtc2sip { - - -MPProxyPluginProducerVideo::MPProxyPluginProducerVideo(uint64_t nId, const ProxyVideoProducer* pcProducer) -: MPProxyPlugin(MPMediaType_Video, nId, dynamic_cast(pcProducer)), -m_nWidth(MP_VIDEO_WIDTH_DEFAULT), m_nHeight(MP_VIDEO_HEIGHT_DEFAULT), m_nFPS(MP_VIDEO_FPS_DEFAULT) -{ - m_bByPassEncoding = MediaSessionMgr::defaultsGetByPassEncoding(); - m_pcWrappedProducer = pcProducer; - m_oCallback = new MPProxyPluginProducerVideoCallback(this); - const_cast(m_pcWrappedProducer)->setCallback(*m_oCallback); -} - -MPProxyPluginProducerVideo::~MPProxyPluginProducerVideo() -{ - m_pcWrappedProducer = NULL; - - TSK_DEBUG_INFO("MPProxyPluginProducerVideo object destroyed"); -} - -int MPProxyPluginProducerVideo::prepareCallback(int nWidth, int nHeight, int nFps) -{ - m_nWidth = nWidth; - m_nHeight = nHeight; - m_nFPS = nFps; - - // call parent - return MPProxyPlugin::prepare(); -} - -int MPProxyPluginProducerVideo::startCallback() -{ - - // call parent - return MPProxyPlugin::start(); -} - -int MPProxyPluginProducerVideo::pauseCallback() -{ - - // call parent - return MPProxyPlugin::pause(); -} - -int MPProxyPluginProducerVideo::stopCallback() -{ - int ret; - - // call parent - if(ret = MPProxyPlugin::stop()){ - TSK_DEBUG_ERROR("Failed to stop producer"); - return ret; - } - - - return ret; -} - -int MPProxyPluginProducerVideo::push(const void* pcBuffer, unsigned nBufferSize, unsigned nFrameWidth, unsigned nFrameHeight) -{ - int ret = 0; - - if(m_pcWrappedProducer && isValid()){ - if(m_nWidth != nFrameWidth || m_nHeight != nFrameHeight){ - if(!const_cast(m_pcWrappedProducer)->setActualCameraOutputSize(nFrameWidth, nFrameHeight)){ - TSK_DEBUG_ERROR("Failed to change the camera output size (%u, %u)", nFrameWidth, nFrameHeight); - return -1; - } - m_nWidth = nFrameWidth; - m_nHeight = nFrameHeight; - } - ret = const_cast(m_pcWrappedProducer)->push(pcBuffer, nBufferSize); - } - - return ret; -} - - +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_proxyplugin_producer_video.h" + +#include "MediaSessionMgr.h" + +namespace webrtc2sip { + + +MPProxyPluginProducerVideo::MPProxyPluginProducerVideo(uint64_t nId, const ProxyVideoProducer* pcProducer) +: MPProxyPlugin(MPMediaType_Video, nId, dynamic_cast(pcProducer)), +m_nWidth(MP_VIDEO_WIDTH_DEFAULT), m_nHeight(MP_VIDEO_HEIGHT_DEFAULT), m_nFPS(MP_VIDEO_FPS_DEFAULT) +{ + m_bByPassEncoding = MediaSessionMgr::defaultsGetByPassEncoding(); + m_pcWrappedProducer = pcProducer; + m_oCallback = new MPProxyPluginProducerVideoCallback(this); + const_cast(m_pcWrappedProducer)->setCallback(*m_oCallback); +} + +MPProxyPluginProducerVideo::~MPProxyPluginProducerVideo() +{ + m_pcWrappedProducer = NULL; + + TSK_DEBUG_INFO("MPProxyPluginProducerVideo object destroyed"); +} + +int MPProxyPluginProducerVideo::prepareCallback(int nWidth, int nHeight, int nFps) +{ + m_nWidth = nWidth; + m_nHeight = nHeight; + m_nFPS = nFps; + + // call parent + return MPProxyPlugin::prepare(); +} + +int MPProxyPluginProducerVideo::startCallback() +{ + + // call parent + return MPProxyPlugin::start(); +} + +int MPProxyPluginProducerVideo::pauseCallback() +{ + + // call parent + return MPProxyPlugin::pause(); +} + +int MPProxyPluginProducerVideo::stopCallback() +{ + int ret; + + // call parent + if(ret = MPProxyPlugin::stop()){ + TSK_DEBUG_ERROR("Failed to stop producer"); + return ret; + } + + + return ret; +} + +int MPProxyPluginProducerVideo::push(const void* pcBuffer, unsigned nBufferSize, unsigned nFrameWidth, unsigned nFrameHeight) +{ + int ret = 0; + + if(m_pcWrappedProducer && isValid()){ + if(m_nWidth != nFrameWidth || m_nHeight != nFrameHeight){ + if(!const_cast(m_pcWrappedProducer)->setActualCameraOutputSize(nFrameWidth, nFrameHeight)){ + TSK_DEBUG_ERROR("Failed to change the camera output size (%u, %u)", nFrameWidth, nFrameHeight); + return -1; + } + m_nWidth = nFrameWidth; + m_nHeight = nFrameHeight; + } + ret = const_cast(m_pcWrappedProducer)->push(pcBuffer, nBufferSize); + } + + return ret; +} + + } // namespace \ No newline at end of file diff --git a/mp_proxyplugin_producer_video.h b/mp_proxyplugin_producer_video.h index 031d057..c09c669 100644 --- a/mp_proxyplugin_producer_video.h +++ b/mp_proxyplugin_producer_video.h @@ -1,107 +1,107 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_PROXYPLUGIN_PRODUCER_VIDEO_H_) -#define _MEDIAPROXY_PROXYPLUGIN_PRODUCER_VIDEO_H_ - -#include "mp_config.h" -#include "mp_proxyplugin.h" - -#include "ProxyProducer.h" - -namespace webrtc2sip { - - -class MPProxyPluginProducerVideoCallback; - -// -// MPProxyPluginProducerVideo -// -class MPProxyPluginProducerVideo : public MPProxyPlugin -{ - friend class MPProxyPluginProducerVideoCallback; -public: - MPProxyPluginProducerVideo(uint64_t nId, const ProxyVideoProducer* pcProducer); - virtual ~MPProxyPluginProducerVideo(); - - // Encode then send - int push(const void* pcBuffer, unsigned nBufferSize, unsigned nFrameWidth, unsigned nFrameHeight); - // Send "AS IS" - int sendRaw(const void* pcBuffer, unsigned nSize, unsigned nDuration, bool bMarker){ - return m_pcWrappedProducer ? const_cast(m_pcWrappedProducer)->sendRaw(pcBuffer, nSize, nDuration, bMarker) : 0; - } - int sendRaw(const void* pcBuffer, unsigned nSize, const void* pcProtoHdr){ - return m_pcWrappedProducer ? const_cast(m_pcWrappedProducer)->sendRaw(pcBuffer, nSize, pcProtoHdr) : 0; - } - bool setActualCameraOutputSize(unsigned nWidth, unsigned nHeight){ - return m_pcWrappedProducer ? const_cast(m_pcWrappedProducer)->setActualCameraOutputSize(nWidth, nHeight) : 0; - } - - MP_INLINE int getFps() { return m_nFPS; } - MP_INLINE int getHeight() { return m_nHeight; } - MP_INLINE int getWidth() { return m_nWidth; } - - MP_INLINE void setByPassEncoding(bool bByPass){ m_bByPassEncoding = bByPass; } - MP_INLINE bool isByPassEncoding(){ return m_bByPassEncoding; } - -private: - int prepareCallback(int nWidth, int nHeight, int nFps); - int startCallback(); - int pauseCallback(); - int stopCallback(); - -private: - MPObjectWrapper m_oCallback; - const ProxyVideoProducer* m_pcWrappedProducer; - int m_nWidth, m_nHeight, m_nFPS; - bool m_bByPassEncoding; -}; - - -// -// MPProxyPluginProducerVideoCallback -// -class MPProxyPluginProducerVideoCallback : public ProxyVideoProducerCallback, public MPObject { -public: - MPProxyPluginProducerVideoCallback(const MPProxyPluginProducerVideo* pcMPProducer) - : ProxyVideoProducerCallback(), m_pcMPProducer(pcMPProducer){ - } - virtual ~MPProxyPluginProducerVideoCallback(){ - } - MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginProducerVideoCallback"; } - -public: /* Overrides */ - virtual int prepare(int width, int height, int fps) { - return const_cast(m_pcMPProducer)->prepareCallback(width, height, fps); - } - virtual int start() { - return const_cast(m_pcMPProducer)->startCallback(); - } - virtual int pause() { - return const_cast(m_pcMPProducer)->pauseCallback(); - } - virtual int stop() { - return const_cast(m_pcMPProducer)->stopCallback(); - } -private: - const MPProxyPluginProducerVideo* m_pcMPProducer; -}; - - -} // namespace -#endif /* _MEDIAPROXY_PROXYPLUGIN_PRODUCER_VIDEO_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_PROXYPLUGIN_PRODUCER_VIDEO_H_) +#define _MEDIAPROXY_PROXYPLUGIN_PRODUCER_VIDEO_H_ + +#include "mp_config.h" +#include "mp_proxyplugin.h" + +#include "ProxyProducer.h" + +namespace webrtc2sip { + + +class MPProxyPluginProducerVideoCallback; + +// +// MPProxyPluginProducerVideo +// +class MPProxyPluginProducerVideo : public MPProxyPlugin +{ + friend class MPProxyPluginProducerVideoCallback; +public: + MPProxyPluginProducerVideo(uint64_t nId, const ProxyVideoProducer* pcProducer); + virtual ~MPProxyPluginProducerVideo(); + + // Encode then send + int push(const void* pcBuffer, unsigned nBufferSize, unsigned nFrameWidth, unsigned nFrameHeight); + // Send "AS IS" + int sendRaw(const void* pcBuffer, unsigned nSize, unsigned nDuration, bool bMarker){ + return m_pcWrappedProducer ? const_cast(m_pcWrappedProducer)->sendRaw(pcBuffer, nSize, nDuration, bMarker) : 0; + } + int sendRaw(const void* pcBuffer, unsigned nSize, const void* pcProtoHdr){ + return m_pcWrappedProducer ? const_cast(m_pcWrappedProducer)->sendRaw(pcBuffer, nSize, pcProtoHdr) : 0; + } + bool setActualCameraOutputSize(unsigned nWidth, unsigned nHeight){ + return m_pcWrappedProducer ? const_cast(m_pcWrappedProducer)->setActualCameraOutputSize(nWidth, nHeight) : 0; + } + + MP_INLINE int getFps() { return m_nFPS; } + MP_INLINE int getHeight() { return m_nHeight; } + MP_INLINE int getWidth() { return m_nWidth; } + + MP_INLINE void setByPassEncoding(bool bByPass){ m_bByPassEncoding = bByPass; } + MP_INLINE bool isByPassEncoding(){ return m_bByPassEncoding; } + +private: + int prepareCallback(int nWidth, int nHeight, int nFps); + int startCallback(); + int pauseCallback(); + int stopCallback(); + +private: + MPObjectWrapper m_oCallback; + const ProxyVideoProducer* m_pcWrappedProducer; + int m_nWidth, m_nHeight, m_nFPS; + bool m_bByPassEncoding; +}; + + +// +// MPProxyPluginProducerVideoCallback +// +class MPProxyPluginProducerVideoCallback : public ProxyVideoProducerCallback, public MPObject { +public: + MPProxyPluginProducerVideoCallback(const MPProxyPluginProducerVideo* pcMPProducer) + : ProxyVideoProducerCallback(), m_pcMPProducer(pcMPProducer){ + } + virtual ~MPProxyPluginProducerVideoCallback(){ + } + MP_INLINE virtual const char* getObjectId() { return "MPProxyPluginProducerVideoCallback"; } + +public: /* Overrides */ + virtual int prepare(int width, int height, int fps) { + return const_cast(m_pcMPProducer)->prepareCallback(width, height, fps); + } + virtual int start() { + return const_cast(m_pcMPProducer)->startCallback(); + } + virtual int pause() { + return const_cast(m_pcMPProducer)->pauseCallback(); + } + virtual int stop() { + return const_cast(m_pcMPProducer)->stopCallback(); + } +private: + const MPProxyPluginProducerVideo* m_pcMPProducer; +}; + + +} // namespace +#endif /* _MEDIAPROXY_PROXYPLUGIN_PRODUCER_VIDEO_H_ */ diff --git a/mp_session.cc b/mp_session.cc index b55e59d..2430175 100644 --- a/mp_session.cc +++ b/mp_session.cc @@ -1,44 +1,44 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_session.h" - -#include - -namespace webrtc2sip { - -MPSipSession::MPSipSession(SipSession** ppSipSessionToWrap) -: m_eState(MPSessionState_None) -{ - assert(ppSipSessionToWrap && *ppSipSessionToWrap); - - m_pWrappedSession = *ppSipSessionToWrap; - *ppSipSessionToWrap = NULL; -} - -MPSipSession::~MPSipSession() -{ - if(m_pWrappedSession){ - delete m_pWrappedSession, m_pWrappedSession = NULL; - } - - TSK_DEBUG_INFO("MPSipSession object destroyed"); -} - - -} // namespace +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_session.h" + +#include + +namespace webrtc2sip { + +MPSipSession::MPSipSession(SipSession** ppSipSessionToWrap) +: m_eState(MPSessionState_None) +{ + assert(ppSipSessionToWrap && *ppSipSessionToWrap); + + m_pWrappedSession = *ppSipSessionToWrap; + *ppSipSessionToWrap = NULL; +} + +MPSipSession::~MPSipSession() +{ + if(m_pWrappedSession){ + delete m_pWrappedSession, m_pWrappedSession = NULL; + } + + TSK_DEBUG_INFO("MPSipSession object destroyed"); +} + + +} // namespace diff --git a/mp_session.h b/mp_session.h index 548acaa..a7bac5b 100644 --- a/mp_session.h +++ b/mp_session.h @@ -1,45 +1,45 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_SIPSESSION_H_) -#define _MEDIAPROXY_SIPSESSION_H_ - -#include "mp_config.h" -#include "mp_object.h" - -#include "SipSession.h" - -namespace webrtc2sip { - -class MPSipSession : public MPObject -{ -public: - MPSipSession(SipSession** ppSipSessionToWrap); - virtual ~MPSipSession(); - MP_INLINE virtual const char* getObjectId() { return "MPSipSession"; } - MP_INLINE virtual const SipSession* getWrappedSession(){ return m_pWrappedSession; } - MP_INLINE virtual void setState(MPSessionState_t eState) { m_eState = eState; } - MP_INLINE virtual MPSessionState_t getState(){ return m_eState; } -private: - SipSession* m_pWrappedSession; - MPSessionState_t m_eState; -}; - -} // namespace - -#endif /* _MEDIAPROXY_SIPSESSION_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_SIPSESSION_H_) +#define _MEDIAPROXY_SIPSESSION_H_ + +#include "mp_config.h" +#include "mp_object.h" + +#include "SipSession.h" + +namespace webrtc2sip { + +class MPSipSession : public MPObject +{ +public: + MPSipSession(SipSession** ppSipSessionToWrap); + virtual ~MPSipSession(); + MP_INLINE virtual const char* getObjectId() { return "MPSipSession"; } + MP_INLINE virtual const SipSession* getWrappedSession(){ return m_pWrappedSession; } + MP_INLINE virtual void setState(MPSessionState_t eState) { m_eState = eState; } + MP_INLINE virtual MPSessionState_t getState(){ return m_eState; } +private: + SipSession* m_pWrappedSession; + MPSessionState_t m_eState; +}; + +} // namespace + +#endif /* _MEDIAPROXY_SIPSESSION_H_ */ diff --git a/mp_session_av.cc b/mp_session_av.cc index 877571f..8dcd6bb 100644 --- a/mp_session_av.cc +++ b/mp_session_av.cc @@ -1,81 +1,81 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_session_av.h" - -#include "MediaSessionMgr.h" - -#include - -namespace webrtc2sip { - -MPSipSessionAV::MPSipSessionAV(CallSession** ppCallSessionToWrap, MPMediaType_t eMediaType) -: MPSipSession((SipSession **)ppCallSessionToWrap) -, m_eMediaType(eMediaType) -{ -} - -MPSipSessionAV::~MPSipSessionAV() -{ - if(m_oRtcpCallback){ - const_cast(getWrappedCallSession())->setRtcpCallback(NULL, twrap_media_video); - } - - TSK_DEBUG_INFO("MPSipSessionAV object destroyed"); -} - -void MPSipSessionAV::setState(MPSessionState_t eState) -{ - // call base - MPSipSession::setState(eState); - - switch(eState){ - case MPSessionState_None: - case MPSessionState_Connecting: - default: - { - break; - } - case MPSessionState_Connected: - { - // now that the media session manage is up we can set the RTCP callback - if(!m_oRtcpCallback && MediaSessionMgr::defaultsGetByPassEncoding() && MediaSessionMgr::defaultsGetByPassDecoding()){ - TSK_DEBUG_INFO("Media encoding/decoding is bypassed -> install RTCP callbacks for forwarding"); - m_oRtcpCallback = new MPSipSessionAVRtcpCallback(this); - const_cast(getWrappedCallSession())->setRtcpCallback(*m_oRtcpCallback, MPMediaType_GetNative(m_eMediaType)); - } - break; - } - case MPSessionState_Terminated: - { - setSessionOpposite(NULL); // unRef() - break; - } - } -} - -int MPSipSessionAV::onRtcpEventCallback(const RtcpCallbackData* pcEvent)const -{ - if(pcEvent && m_oSessionOpposite){ - return const_cast(m_oSessionOpposite->getWrappedCallSession())->sendRtcpEvent(pcEvent->getType(), MPMediaType_GetNative(m_eMediaType), pcEvent->getSSRC()); - } - return 0; -} - - -} // namespace +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_session_av.h" + +#include "MediaSessionMgr.h" + +#include + +namespace webrtc2sip { + +MPSipSessionAV::MPSipSessionAV(CallSession** ppCallSessionToWrap, MPMediaType_t eMediaType) +: MPSipSession((SipSession **)ppCallSessionToWrap) +, m_eMediaType(eMediaType) +{ +} + +MPSipSessionAV::~MPSipSessionAV() +{ + if(m_oRtcpCallback){ + const_cast(getWrappedCallSession())->setRtcpCallback(NULL, twrap_media_video); + } + + TSK_DEBUG_INFO("MPSipSessionAV object destroyed"); +} + +void MPSipSessionAV::setState(MPSessionState_t eState) +{ + // call base + MPSipSession::setState(eState); + + switch(eState){ + case MPSessionState_None: + case MPSessionState_Connecting: + default: + { + break; + } + case MPSessionState_Connected: + { + // now that the media session manage is up we can set the RTCP callback + if(!m_oRtcpCallback && MediaSessionMgr::defaultsGetByPassEncoding() && MediaSessionMgr::defaultsGetByPassDecoding()){ + TSK_DEBUG_INFO("Media encoding/decoding is bypassed -> install RTCP callbacks for forwarding"); + m_oRtcpCallback = new MPSipSessionAVRtcpCallback(this); + const_cast(getWrappedCallSession())->setRtcpCallback(*m_oRtcpCallback, MPMediaType_GetNative(m_eMediaType)); + } + break; + } + case MPSessionState_Terminated: + { + setSessionOpposite(NULL); // unRef() + break; + } + } +} + +int MPSipSessionAV::onRtcpEventCallback(const RtcpCallbackData* pcEvent)const +{ + if(pcEvent && m_oSessionOpposite){ + return const_cast(m_oSessionOpposite->getWrappedCallSession())->sendRtcpEvent(pcEvent->getType(), MPMediaType_GetNative(m_eMediaType), pcEvent->getSSRC()); + } + return 0; +} + + +} // namespace diff --git a/mp_session_av.h b/mp_session_av.h index 6ea8779..5b56bdb 100644 --- a/mp_session_av.h +++ b/mp_session_av.h @@ -1,77 +1,77 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_SIPSESSIONAV_H_) -#define _MEDIAPROXY_SIPSESSIONAV_H_ - -#include "mp_config.h" -#include "mp_object.h" -#include "mp_session.h" - -namespace webrtc2sip { - - -class MPSipSessionAVRtcpCallback; - -// -// MPSipSessionAV -// -class MPSipSessionAV : public MPSipSession -{ -public: - MPSipSessionAV(CallSession** ppCallSessionToWrap, MPMediaType_t eMediaType); - virtual ~MPSipSessionAV(); - MP_INLINE virtual const char* getObjectId() { return "MPSipSessionAV"; } - - -public: - MP_INLINE virtual const CallSession* getWrappedCallSession(){ return dynamic_cast(getWrappedSession()); } - MP_INLINE virtual const InviteSession* getWrappedInviteSession(){ return dynamic_cast(getWrappedSession()); } - MP_INLINE virtual void setSessionOpposite(MPObjectWrapper oSessionOpposite){ m_oSessionOpposite = oSessionOpposite; } - virtual void setState(MPSessionState_t eState); // @Override - virtual int onRtcpEventCallback(const RtcpCallbackData* pcEvent)const; - -private: - MPObjectWrapper m_oRtcpCallback; - MPObjectWrapper m_oSessionOpposite; - MPMediaType_t m_eMediaType; -}; - - -// -// MPSipSessionAVRtcpCallback -// -class MPSipSessionAVRtcpCallback : public RtcpCallback, public MPObject { -public: - MPSipSessionAVRtcpCallback(const MPSipSessionAV* pcSessionAV) - : RtcpCallback(), m_pcSessionAV(pcSessionAV){ - } - virtual ~MPSipSessionAVRtcpCallback(){ - } - MP_INLINE virtual const char* getObjectId() { return "MPSipSessionAVRtcpCallback"; } -public: /* Overrides */ - virtual int onevent(const RtcpCallbackData* e){ - return m_pcSessionAV->onRtcpEventCallback(e); - } -private: - const MPSipSessionAV* m_pcSessionAV; -}; - -} // namespace - -#endif /* _MEDIAPROXY_SIPSESSIONAV_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_SIPSESSIONAV_H_) +#define _MEDIAPROXY_SIPSESSIONAV_H_ + +#include "mp_config.h" +#include "mp_object.h" +#include "mp_session.h" + +namespace webrtc2sip { + + +class MPSipSessionAVRtcpCallback; + +// +// MPSipSessionAV +// +class MPSipSessionAV : public MPSipSession +{ +public: + MPSipSessionAV(CallSession** ppCallSessionToWrap, MPMediaType_t eMediaType); + virtual ~MPSipSessionAV(); + MP_INLINE virtual const char* getObjectId() { return "MPSipSessionAV"; } + + +public: + MP_INLINE virtual const CallSession* getWrappedCallSession(){ return dynamic_cast(getWrappedSession()); } + MP_INLINE virtual const InviteSession* getWrappedInviteSession(){ return dynamic_cast(getWrappedSession()); } + MP_INLINE virtual void setSessionOpposite(MPObjectWrapper oSessionOpposite){ m_oSessionOpposite = oSessionOpposite; } + virtual void setState(MPSessionState_t eState); // @Override + virtual int onRtcpEventCallback(const RtcpCallbackData* pcEvent)const; + +private: + MPObjectWrapper m_oRtcpCallback; + MPObjectWrapper m_oSessionOpposite; + MPMediaType_t m_eMediaType; +}; + + +// +// MPSipSessionAVRtcpCallback +// +class MPSipSessionAVRtcpCallback : public RtcpCallback, public MPObject { +public: + MPSipSessionAVRtcpCallback(const MPSipSessionAV* pcSessionAV) + : RtcpCallback(), m_pcSessionAV(pcSessionAV){ + } + virtual ~MPSipSessionAVRtcpCallback(){ + } + MP_INLINE virtual const char* getObjectId() { return "MPSipSessionAVRtcpCallback"; } +public: /* Overrides */ + virtual int onevent(const RtcpCallbackData* e){ + return m_pcSessionAV->onRtcpEventCallback(e); + } +private: + const MPSipSessionAV* m_pcSessionAV; +}; + +} // namespace + +#endif /* _MEDIAPROXY_SIPSESSIONAV_H_ */ diff --git a/mp_wrap.cc b/mp_wrap.cc index a427400..feaca71 100644 --- a/mp_wrap.cc +++ b/mp_wrap.cc @@ -1,457 +1,457 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#include "mp_wrap.h" -#include "mp_engine.h" -#include "mp_proxyplugin.h" -#include "mp_proxyplugin_mgr.h" -#include "mp_proxyplugin_consumer_audio.h" -#include "mp_proxyplugin_consumer_video.h" -#include "mp_proxyplugin_producer_audio.h" -#include "mp_proxyplugin_producer_video.h" - -#include "SipSession.h" -#include "SipEvent.h" -#include "ProxyPluginMgr.h" -#include "MediaSessionMgr.h" -#include "SipMessage.h" - -#include - -namespace webrtc2sip { - - -// -// MPSipCallback -// -MPSipCallback::MPSipCallback(MPObjectWrapper oEngine) - :SipCallback() -{ - m_oEngine = oEngine; -} - -MPSipCallback::~MPSipCallback() -{ - -} - -void MPSipCallback::attachMediaProxyPlugins(MPObjectWrapper oPeer) -{ - const ProxyPlugin* pcProxyPlugin; - MPObjectWrapper oMPProxyPlugin; - MPObjectWrapper oMPProxyPluginProducerAudioRight, oMPProxyPluginProducerAudioLeft; - MPObjectWrapper oMPProxyPluginConsumerAudioRight, oMPProxyPluginConsumerAudioLeft; - MPObjectWrapper oMPProxyPluginProducerVideoRight, oMPProxyPluginProducerVideoLeft; - MPObjectWrapper oMPProxyPluginConsumerVideoRight, oMPProxyPluginConsumerVideoLeft; - const MediaSessionMgr *pcMediaSessionMgrRight, *pcMediaSessionMgrLeft; - - // make call to the right leg - pcMediaSessionMgrRight = oPeer->getCallSessionRight() ? const_cast(oPeer->getCallSessionRight()->getWrappedCallSession())->getMediaMgr() : NULL; - pcMediaSessionMgrLeft = oPeer->getCallSessionLeft() ? const_cast(oPeer->getCallSessionLeft()->getWrappedCallSession())->getMediaMgr() : NULL; - - // media session will be null if the invite is immediately rejected. do nothing as dialog terminated will be called - if(pcMediaSessionMgrRight && pcMediaSessionMgrLeft){ - // find consumers and producers - if((oPeer->getMediaType() & MPMediaType_Audio)){ - if((pcProxyPlugin = pcMediaSessionMgrLeft->findProxyPluginConsumer(twrap_media_audio)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ - oMPProxyPluginConsumerAudioLeft = *((MPObjectWrapper*)&oMPProxyPlugin); - } - else{ - TSK_DEBUG_ERROR("cannot find audio consumer for left leg"); - } - if((pcProxyPlugin = pcMediaSessionMgrLeft->findProxyPluginProducer(twrap_media_audio)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ - oMPProxyPluginProducerAudioLeft = *((MPObjectWrapper*)&oMPProxyPlugin); - } - else{ - TSK_DEBUG_ERROR("cannot find audio producer for left leg"); - } - - if((pcProxyPlugin = pcMediaSessionMgrRight->findProxyPluginConsumer(twrap_media_audio)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ - oMPProxyPluginConsumerAudioRight = *((MPObjectWrapper*)&oMPProxyPlugin); - } - else{ - TSK_DEBUG_ERROR("cannot find audio consumer for right leg"); - } - if((pcProxyPlugin = pcMediaSessionMgrRight->findProxyPluginProducer(twrap_media_audio)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ - oMPProxyPluginProducerAudioRight = *((MPObjectWrapper*)&oMPProxyPlugin); - } - else{ - TSK_DEBUG_ERROR("cannot find audio producer for right leg"); - } - - // attach consumers and producers - if(oMPProxyPluginConsumerAudioLeft && oMPProxyPluginProducerAudioRight){ // Left -> Right - oMPProxyPluginConsumerAudioLeft->setProducerOpposite(oMPProxyPluginProducerAudioRight); - } - if(oMPProxyPluginConsumerAudioRight && oMPProxyPluginProducerAudioLeft){ // Right -> Left - oMPProxyPluginConsumerAudioRight->setProducerOpposite(oMPProxyPluginProducerAudioLeft); - } - } - if((oPeer->getMediaType() & MPMediaType_Video)){ - if((pcProxyPlugin = pcMediaSessionMgrLeft->findProxyPluginConsumer(twrap_media_video)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ - oMPProxyPluginConsumerVideoLeft = *((MPObjectWrapper*)&oMPProxyPlugin); - } - else{ - TSK_DEBUG_ERROR("cannot find video consumer for left leg"); - } - if((pcProxyPlugin = pcMediaSessionMgrLeft->findProxyPluginProducer(twrap_media_video)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ - oMPProxyPluginProducerVideoLeft = *((MPObjectWrapper*)&oMPProxyPlugin); - } - else{ - TSK_DEBUG_ERROR("cannot find video producer for left leg"); - } - - if((pcProxyPlugin = pcMediaSessionMgrRight->findProxyPluginConsumer(twrap_media_video)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ - oMPProxyPluginConsumerVideoRight = *((MPObjectWrapper*)&oMPProxyPlugin); - } - else{ - TSK_DEBUG_ERROR("cannot find video consumer for right leg"); - } - if((pcProxyPlugin = pcMediaSessionMgrRight->findProxyPluginProducer(twrap_media_video)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ - oMPProxyPluginProducerVideoRight = *((MPObjectWrapper*)&oMPProxyPlugin); - } - else{ - TSK_DEBUG_ERROR("cannot find video producer for right leg"); - } - - // attach consumers and producers - if(oMPProxyPluginConsumerVideoLeft && oMPProxyPluginProducerVideoRight){ // Left -> Right - oMPProxyPluginConsumerVideoLeft->setProducerOpposite(oMPProxyPluginProducerVideoRight); - } - if(oMPProxyPluginConsumerVideoRight && oMPProxyPluginProducerVideoLeft){ // Right -> Left - oMPProxyPluginConsumerVideoRight->setProducerOpposite(oMPProxyPluginProducerVideoLeft); - } - } - } - else{ - TSK_DEBUG_ERROR("Media sessions not ready yet"); - } -} - -/* @override SipCallback::OnInviteEvent */ -int MPSipCallback::OnInviteEvent(const InviteEvent* e) -{ - switch(e->getType()) - { - case tsip_i_newcall: - { - assert(e->getSession() == NULL); - assert(e->getSipMessage() != NULL); - - CallSession *pCallSessionLeft = NULL; - if((pCallSessionLeft = e->takeCallSessionOwnership())){ - // Before accepting the call "link it with the bridge" - const MediaSessionMgr* pcMediaSessionMgrLeft = pCallSessionLeft->getMediaMgr(); - const SipMessage* pcMsgLeft = e->getSipMessage(); - assert(pcMsgLeft); - - const tsip_message_t* pcWrappedMsgLeft = const_cast(pcMsgLeft)->getWrappedSipMessage(); - static const bool g_bSessionLeft = true; - char* pDstUri = const_cast(pcMsgLeft)->getSipHeaderValue("t"); - char* pSrcUri = const_cast(pcMsgLeft)->getSipHeaderValue("f"); - bool bHaveAudio = false, bHaveVideo = false; - - MPMediaType_t eMediaType = MPMediaType_None; - if(e->getMediaType() & twrap_media_audio){ eMediaType = (MPMediaType_t)(eMediaType | MPMediaType_Audio); bHaveAudio = true; } - if(e->getMediaType() & twrap_media_video){ eMediaType = (MPMediaType_t)(eMediaType | MPMediaType_Video); bHaveVideo = true; } - - MPObjectWrapper oCallSessionLeft = new MPSipSessionAV(&pCallSessionLeft, eMediaType); - - if(pDstUri && pcMediaSessionMgrLeft && (eMediaType != MPMediaType_None)){ - // find peer associated to this session (must be null) - MPObjectWrapper oPeer = m_oEngine->getPeerBySessionId(oCallSessionLeft->getWrappedSession()->getId(), g_bSessionLeft); - assert(!oPeer); - - oPeer = new MPPeer(oCallSessionLeft); - oPeer->setSessionLeftState(MPPeerState_Connecting); - oPeer->setMediaType(eMediaType); - m_oEngine->insertPeer(oPeer); - - // make call to the right leg - CallSession* pCallSessionRight = new CallSession(const_cast(m_oEngine->m_oStack->getWrappedStack())); - MPObjectWrapper oCallSessionRight = new MPSipSessionAV(&pCallSessionRight, eMediaType); - oCallSessionRight->setSessionOpposite(oCallSessionLeft); - oCallSessionLeft->setSessionOpposite(oCallSessionRight); - const_cast(oCallSessionRight->getWrappedSession())->setFromUri(pSrcUri); - - // authentication token - const char *pcHa1, *pcIMPI; - if((pcHa1 = TSIP_HEADER_GET_PARAM_VALUE(pcWrappedMsgLeft->Contact, "ha1")) && (pcIMPI = TSIP_HEADER_GET_PARAM_VALUE(pcWrappedMsgLeft->Contact, "impi"))){ - const_cast(oCallSessionRight->getWrappedSession())->setAuth(pcHa1, pcIMPI); - } - - // use same SSRCs to make possible RTCP forwarding - if(tsk_striequals("application/sdp", TSIP_MESSAGE_CONTENT_TYPE(pcWrappedMsgLeft))){ - tsdp_message_t* sdp_ro; - if((sdp_ro = tsdp_message_parse(TSIP_MESSAGE_CONTENT_DATA(pcWrappedMsgLeft), TSIP_MESSAGE_CONTENT_DATA_LENGTH(pcWrappedMsgLeft)))){ - static const char* __ssrc_media_names[] = { "audio", "video" }; - static const twrap_media_type_t __ssrc_media_types[] = { twrap_media_audio, twrap_media_video }; - int ssrc_i; - uint32_t ssrc; - for(ssrc_i = 0; ssrc_i < sizeof(__ssrc_media_names)/sizeof(__ssrc_media_names[0]); ++ssrc_i){ - const tsdp_header_M_t* pcSdpM = tsdp_message_find_media(sdp_ro, __ssrc_media_names[ssrc_i]); - if(pcSdpM){ - const tsdp_header_A_t* pcSdpAudioA = tsdp_header_M_findA(pcSdpM, "ssrc"); - if(pcSdpAudioA){ - if(sscanf(pcSdpAudioA->value, "%u %*s", &ssrc) != EOF){ - TSK_DEBUG_INFO("Using audio SSRC = %u", ssrc); - const_cast(oCallSessionRight->getWrappedCallSession())->setMediaSSRC(__ssrc_media_types[ssrc_i], ssrc); - } - } - } - } - TSK_OBJECT_SAFE_FREE(sdp_ro); - } - } - - // filter codecs if transcoding is disabled - if(MediaSessionMgr::defaultsGetByPassEncoding()){ - int32_t nNegCodecs = const_cast(oCallSessionLeft->getWrappedCallSession())->getNegotiatedCodecs(); - TSK_DEBUG_INFO("Negotiated codecs with the left leg = %d", nNegCodecs); - const_cast(oCallSessionRight->getWrappedCallSession())->setSupportedCodecs(nNegCodecs); - } - - char* pRoute = tsk_null; - - // add destination based on the Request-Line - const char* ws_src_ip = tsk_params_get_param_value (pcWrappedMsgLeft->line.request.uri->params, "ws-src-ip"); - const int ws_src_port = tsk_params_get_param_value_as_int(pcWrappedMsgLeft->line.request.uri->params, "ws-src-port"); - if(!tsk_strnullORempty(ws_src_ip) && ws_src_port > 0){ - const char* ws_src_proto = tsk_params_get_param_value(pcWrappedMsgLeft->line.request.uri->params, "ws-src-proto"); - tsk_sprintf(&pRoute, "", ws_src_ip, ws_src_port, ws_src_proto ? ws_src_proto : "ws"); - const_cast(oCallSessionRight->getWrappedSession())->addHeader("Route", pRoute); - TSK_FREE(pRoute); - } - - // add WebSocket src connection info in the AoR - if(TNET_SOCKET_TYPE_IS_WS(pcWrappedMsgLeft->src_net_type) || TNET_SOCKET_TYPE_IS_WS(pcWrappedMsgLeft->src_net_type)){ - tnet_ip_t src_ip; - tnet_port_t src_port; - if(tnet_get_ip_n_port(pcWrappedMsgLeft->local_fd, tsk_false/*remote*/, &src_ip, &src_port) == 0){ - const char* src_proto = TNET_SOCKET_TYPE_IS_WS(pcWrappedMsgLeft->src_net_type) ? "ws" : "wss"; - const_cast(oCallSessionRight->getWrappedSession())->setWebSocketSrc(src_ip, src_port, src_proto); - tsk_sprintf(&pRoute, "", src_ip, src_port, src_proto); - const_cast(oCallSessionLeft->getWrappedSession())->addHeader("Route", pRoute); - TSK_FREE(pRoute); - } - } - - - // add Routes - int nRouteIndex = 0; - while((pRoute = const_cast(pcMsgLeft)->getSipHeaderValue("route", nRouteIndex++))){ - const_cast(oCallSessionRight->getWrappedSession())->addHeader("Route", pRoute); - TSK_FREE(pRoute); - } - - oPeer->setCallSessionRight(oCallSessionRight); - oPeer->setSessionRightState(MPPeerState_Connecting); - const_cast(oPeer->getCallSessionRight()->getWrappedCallSession())->call(pDstUri, - (bHaveAudio && bHaveVideo) ? twrap_media_audio_video - : (bHaveAudio ? twrap_media_audio : twrap_media_video) - ); - - - if(pCallSessionRight){ - delete pCallSessionRight, pCallSessionRight = NULL; - } - } - else{ - ActionConfig* config = new ActionConfig(); - config->setResponseLine(500, "Server error 501"); - const_cast(oCallSessionLeft->getWrappedInviteSession())->reject(config); - if(config) delete config, config = tsk_null; - } - - if(pCallSessionLeft){ - delete pCallSessionLeft, pCallSessionLeft = NULL; - } - - TSK_FREE(pDstUri); - TSK_FREE(pSrcUri); - } - break; - } - } - return 0; -} - -/* @override SipCallback::OnDialogEvent */ -int MPSipCallback::OnDialogEvent(const DialogEvent* e) -{ - const SipSession *pcSession = e->getBaseSession(); - if(!pcSession){ - return 0; - } - const short code = e->getCode(); - const unsigned nId = pcSession->getId(); - - switch(code) - { - case tsip_event_code_dialog_terminated: - case tsip_event_code_dialog_terminating: - { - MPObjectWrapper oPeer = m_oEngine->getPeerBySessionId(nId, true); - bool bIsleft = !!oPeer; - - if(!oPeer){ - oPeer = m_oEngine->getPeerBySessionId(nId, false); - } - - if(oPeer){ - // Get SIP response code - short nSipCode = 0; - const char* pcPhrase = NULL; - const SipMessage* pcMsg = e->getSipMessage(); - - if(pcMsg && const_cast(pcMsg)->isResponse()){ - nSipCode = const_cast(pcMsg)->getResponseCode(); - pcPhrase = const_cast(pcMsg)->getResponsePhrase(); - } - - if(bIsleft){ - oPeer->setSessionLeftState(MPPeerState_Terminated); - oPeer->setLastSipResponseLeft(nSipCode); - } - else{ - oPeer->setSessionRightState(MPPeerState_Terminated); - oPeer->setLastSipResponseRight(nSipCode); - } - - ActionConfig* config = new ActionConfig(); - if(config && nSipCode > 0){ - config->setResponseLine(nSipCode, pcPhrase); - } - - if(oPeer->isSessionLeftActive() && oPeer->getCallSessionLeft()){ - const_cast(oPeer->getCallSessionLeft()->getWrappedInviteSession())->hangup(config); - } - if(oPeer->isSessionRightActive() && oPeer->getCallSessionRight()){ - const_cast(oPeer->getCallSessionRight()->getWrappedInviteSession())->hangup(config); - } - if(!oPeer->isSessionLeftActive() && !oPeer->isSessionRightActive()){ - m_oEngine->removePeer(oPeer->getId()); - } - - if(config){ - delete config, config = NULL; - } - } - break; - } - case tsip_event_code_dialog_connected: - { - MPObjectWrapper oPeer = m_oEngine->getPeerBySessionId(nId, true); - bool bIsleft = !!oPeer; - - if(!oPeer){ - oPeer = m_oEngine->getPeerBySessionId(nId, false); - } - - if(oPeer){ - if(bIsleft){ - oPeer->setSessionLeftState(MPPeerState_Connected); - } - else{ - oPeer->setSessionRightState(MPPeerState_Connected); - // right accepted the call -> accept left - if(!oPeer->isSessionLeftConnected() && oPeer->getCallSessionLeft()){ - const_cast(oPeer->getCallSessionLeft()->getWrappedInviteSession())->accept(); - } - } - - // attach media proxy plugins - if(oPeer->isSessionLeftConnected() && oPeer->isSessionRightConnected()){ - attachMediaProxyPlugins(oPeer); - } - } - break; - } - } - - - - return 0; -} - -/* @override SipCallback::OnRegistrationEvent */ -int MPSipCallback::OnRegistrationEvent(const RegistrationEvent* e) -{ - switch(e->getType()) - { - case tsip_i_newreg: - { - assert(e->getSession() == NULL); - - RegistrationSession *pRegSession; - if((pRegSession = e->takeSessionOwnership())){ - pRegSession->accept(); - delete pRegSession, pRegSession = NULL; - } - - break; - } - } - - return 0; -} - -MPObjectWrapper MPSipCallback::New(MPObjectWrapper oEngine) -{ - MPObjectWrapper oCallback = new MPSipCallback(oEngine); - return oCallback; -} - - - -// -// MPSipStack -// - -MPSipStack::MPSipStack(MPObjectWrapper oCallback, const char* pRealmUri, const char* pPrivateId, const char* pPublicId) -{ - m_pStack = new SipStack(*oCallback, pRealmUri, pPrivateId, pPublicId); -} - -MPSipStack::~MPSipStack() -{ - if(m_pStack){ - delete m_pStack, m_pStack = NULL; - } -} - -bool MPSipStack::isValid() -{ - return (m_pStack && m_pStack->isValid()); -} - -const SipStack* MPSipStack::getWrappedStack() -{ - return m_pStack; -} - -MPObjectWrapper MPSipStack::New(MPObjectWrapper oCallback, const char* pRealmUri, const char* pPrivateId, const char* pPublicId) -{ - MPObjectWrapper oStack = new MPSipStack(oCallback, pRealmUri, pPrivateId, pPublicId); - if(!oStack->isValid()){ - MPObjectSafeRelease(oStack); - } - return oStack; -} - +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#include "mp_wrap.h" +#include "mp_engine.h" +#include "mp_proxyplugin.h" +#include "mp_proxyplugin_mgr.h" +#include "mp_proxyplugin_consumer_audio.h" +#include "mp_proxyplugin_consumer_video.h" +#include "mp_proxyplugin_producer_audio.h" +#include "mp_proxyplugin_producer_video.h" + +#include "SipSession.h" +#include "SipEvent.h" +#include "ProxyPluginMgr.h" +#include "MediaSessionMgr.h" +#include "SipMessage.h" + +#include + +namespace webrtc2sip { + + +// +// MPSipCallback +// +MPSipCallback::MPSipCallback(MPObjectWrapper oEngine) + :SipCallback() +{ + m_oEngine = oEngine; +} + +MPSipCallback::~MPSipCallback() +{ + +} + +void MPSipCallback::attachMediaProxyPlugins(MPObjectWrapper oPeer) +{ + const ProxyPlugin* pcProxyPlugin; + MPObjectWrapper oMPProxyPlugin; + MPObjectWrapper oMPProxyPluginProducerAudioRight, oMPProxyPluginProducerAudioLeft; + MPObjectWrapper oMPProxyPluginConsumerAudioRight, oMPProxyPluginConsumerAudioLeft; + MPObjectWrapper oMPProxyPluginProducerVideoRight, oMPProxyPluginProducerVideoLeft; + MPObjectWrapper oMPProxyPluginConsumerVideoRight, oMPProxyPluginConsumerVideoLeft; + const MediaSessionMgr *pcMediaSessionMgrRight, *pcMediaSessionMgrLeft; + + // make call to the right leg + pcMediaSessionMgrRight = oPeer->getCallSessionRight() ? const_cast(oPeer->getCallSessionRight()->getWrappedCallSession())->getMediaMgr() : NULL; + pcMediaSessionMgrLeft = oPeer->getCallSessionLeft() ? const_cast(oPeer->getCallSessionLeft()->getWrappedCallSession())->getMediaMgr() : NULL; + + // media session will be null if the invite is immediately rejected. do nothing as dialog terminated will be called + if(pcMediaSessionMgrRight && pcMediaSessionMgrLeft){ + // find consumers and producers + if((oPeer->getMediaType() & MPMediaType_Audio)){ + if((pcProxyPlugin = pcMediaSessionMgrLeft->findProxyPluginConsumer(twrap_media_audio)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ + oMPProxyPluginConsumerAudioLeft = *((MPObjectWrapper*)&oMPProxyPlugin); + } + else{ + TSK_DEBUG_ERROR("cannot find audio consumer for left leg"); + } + if((pcProxyPlugin = pcMediaSessionMgrLeft->findProxyPluginProducer(twrap_media_audio)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ + oMPProxyPluginProducerAudioLeft = *((MPObjectWrapper*)&oMPProxyPlugin); + } + else{ + TSK_DEBUG_ERROR("cannot find audio producer for left leg"); + } + + if((pcProxyPlugin = pcMediaSessionMgrRight->findProxyPluginConsumer(twrap_media_audio)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ + oMPProxyPluginConsumerAudioRight = *((MPObjectWrapper*)&oMPProxyPlugin); + } + else{ + TSK_DEBUG_ERROR("cannot find audio consumer for right leg"); + } + if((pcProxyPlugin = pcMediaSessionMgrRight->findProxyPluginProducer(twrap_media_audio)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ + oMPProxyPluginProducerAudioRight = *((MPObjectWrapper*)&oMPProxyPlugin); + } + else{ + TSK_DEBUG_ERROR("cannot find audio producer for right leg"); + } + + // attach consumers and producers + if(oMPProxyPluginConsumerAudioLeft && oMPProxyPluginProducerAudioRight){ // Left -> Right + oMPProxyPluginConsumerAudioLeft->setProducerOpposite(oMPProxyPluginProducerAudioRight); + } + if(oMPProxyPluginConsumerAudioRight && oMPProxyPluginProducerAudioLeft){ // Right -> Left + oMPProxyPluginConsumerAudioRight->setProducerOpposite(oMPProxyPluginProducerAudioLeft); + } + } + if((oPeer->getMediaType() & MPMediaType_Video)){ + if((pcProxyPlugin = pcMediaSessionMgrLeft->findProxyPluginConsumer(twrap_media_video)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ + oMPProxyPluginConsumerVideoLeft = *((MPObjectWrapper*)&oMPProxyPlugin); + } + else{ + TSK_DEBUG_ERROR("cannot find video consumer for left leg"); + } + if((pcProxyPlugin = pcMediaSessionMgrLeft->findProxyPluginProducer(twrap_media_video)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ + oMPProxyPluginProducerVideoLeft = *((MPObjectWrapper*)&oMPProxyPlugin); + } + else{ + TSK_DEBUG_ERROR("cannot find video producer for left leg"); + } + + if((pcProxyPlugin = pcMediaSessionMgrRight->findProxyPluginConsumer(twrap_media_video)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ + oMPProxyPluginConsumerVideoRight = *((MPObjectWrapper*)&oMPProxyPlugin); + } + else{ + TSK_DEBUG_ERROR("cannot find video consumer for right leg"); + } + if((pcProxyPlugin = pcMediaSessionMgrRight->findProxyPluginProducer(twrap_media_video)) && (oMPProxyPlugin = MPProxyPluginMgr::findPlugin(pcProxyPlugin->getId()))){ + oMPProxyPluginProducerVideoRight = *((MPObjectWrapper*)&oMPProxyPlugin); + } + else{ + TSK_DEBUG_ERROR("cannot find video producer for right leg"); + } + + // attach consumers and producers + if(oMPProxyPluginConsumerVideoLeft && oMPProxyPluginProducerVideoRight){ // Left -> Right + oMPProxyPluginConsumerVideoLeft->setProducerOpposite(oMPProxyPluginProducerVideoRight); + } + if(oMPProxyPluginConsumerVideoRight && oMPProxyPluginProducerVideoLeft){ // Right -> Left + oMPProxyPluginConsumerVideoRight->setProducerOpposite(oMPProxyPluginProducerVideoLeft); + } + } + } + else{ + TSK_DEBUG_ERROR("Media sessions not ready yet"); + } +} + +/* @override SipCallback::OnInviteEvent */ +int MPSipCallback::OnInviteEvent(const InviteEvent* e) +{ + switch(e->getType()) + { + case tsip_i_newcall: + { + assert(e->getSession() == NULL); + assert(e->getSipMessage() != NULL); + + CallSession *pCallSessionLeft = NULL; + if((pCallSessionLeft = e->takeCallSessionOwnership())){ + // Before accepting the call "link it with the bridge" + const MediaSessionMgr* pcMediaSessionMgrLeft = pCallSessionLeft->getMediaMgr(); + const SipMessage* pcMsgLeft = e->getSipMessage(); + assert(pcMsgLeft); + + const tsip_message_t* pcWrappedMsgLeft = const_cast(pcMsgLeft)->getWrappedSipMessage(); + static const bool g_bSessionLeft = true; + char* pDstUri = const_cast(pcMsgLeft)->getSipHeaderValue("t"); + char* pSrcUri = const_cast(pcMsgLeft)->getSipHeaderValue("f"); + bool bHaveAudio = false, bHaveVideo = false; + + MPMediaType_t eMediaType = MPMediaType_None; + if(e->getMediaType() & twrap_media_audio){ eMediaType = (MPMediaType_t)(eMediaType | MPMediaType_Audio); bHaveAudio = true; } + if(e->getMediaType() & twrap_media_video){ eMediaType = (MPMediaType_t)(eMediaType | MPMediaType_Video); bHaveVideo = true; } + + MPObjectWrapper oCallSessionLeft = new MPSipSessionAV(&pCallSessionLeft, eMediaType); + + if(pDstUri && pcMediaSessionMgrLeft && (eMediaType != MPMediaType_None)){ + // find peer associated to this session (must be null) + MPObjectWrapper oPeer = m_oEngine->getPeerBySessionId(oCallSessionLeft->getWrappedSession()->getId(), g_bSessionLeft); + assert(!oPeer); + + oPeer = new MPPeer(oCallSessionLeft); + oPeer->setSessionLeftState(MPPeerState_Connecting); + oPeer->setMediaType(eMediaType); + m_oEngine->insertPeer(oPeer); + + // make call to the right leg + CallSession* pCallSessionRight = new CallSession(const_cast(m_oEngine->m_oStack->getWrappedStack())); + MPObjectWrapper oCallSessionRight = new MPSipSessionAV(&pCallSessionRight, eMediaType); + oCallSessionRight->setSessionOpposite(oCallSessionLeft); + oCallSessionLeft->setSessionOpposite(oCallSessionRight); + const_cast(oCallSessionRight->getWrappedSession())->setFromUri(pSrcUri); + + // authentication token + const char *pcHa1, *pcIMPI; + if((pcHa1 = TSIP_HEADER_GET_PARAM_VALUE(pcWrappedMsgLeft->Contact, "ha1")) && (pcIMPI = TSIP_HEADER_GET_PARAM_VALUE(pcWrappedMsgLeft->Contact, "impi"))){ + const_cast(oCallSessionRight->getWrappedSession())->setAuth(pcHa1, pcIMPI); + } + + // use same SSRCs to make possible RTCP forwarding + if(tsk_striequals("application/sdp", TSIP_MESSAGE_CONTENT_TYPE(pcWrappedMsgLeft))){ + tsdp_message_t* sdp_ro; + if((sdp_ro = tsdp_message_parse(TSIP_MESSAGE_CONTENT_DATA(pcWrappedMsgLeft), TSIP_MESSAGE_CONTENT_DATA_LENGTH(pcWrappedMsgLeft)))){ + static const char* __ssrc_media_names[] = { "audio", "video" }; + static const twrap_media_type_t __ssrc_media_types[] = { twrap_media_audio, twrap_media_video }; + int ssrc_i; + uint32_t ssrc; + for(ssrc_i = 0; ssrc_i < sizeof(__ssrc_media_names)/sizeof(__ssrc_media_names[0]); ++ssrc_i){ + const tsdp_header_M_t* pcSdpM = tsdp_message_find_media(sdp_ro, __ssrc_media_names[ssrc_i]); + if(pcSdpM){ + const tsdp_header_A_t* pcSdpAudioA = tsdp_header_M_findA(pcSdpM, "ssrc"); + if(pcSdpAudioA){ + if(sscanf(pcSdpAudioA->value, "%u %*s", &ssrc) != EOF){ + TSK_DEBUG_INFO("Using audio SSRC = %u", ssrc); + const_cast(oCallSessionRight->getWrappedCallSession())->setMediaSSRC(__ssrc_media_types[ssrc_i], ssrc); + } + } + } + } + TSK_OBJECT_SAFE_FREE(sdp_ro); + } + } + + // filter codecs if transcoding is disabled + if(MediaSessionMgr::defaultsGetByPassEncoding()){ + int32_t nNegCodecs = const_cast(oCallSessionLeft->getWrappedCallSession())->getNegotiatedCodecs(); + TSK_DEBUG_INFO("Negotiated codecs with the left leg = %d", nNegCodecs); + const_cast(oCallSessionRight->getWrappedCallSession())->setSupportedCodecs(nNegCodecs); + } + + char* pRoute = tsk_null; + + // add destination based on the Request-Line + const char* ws_src_ip = tsk_params_get_param_value (pcWrappedMsgLeft->line.request.uri->params, "ws-src-ip"); + const int ws_src_port = tsk_params_get_param_value_as_int(pcWrappedMsgLeft->line.request.uri->params, "ws-src-port"); + if(!tsk_strnullORempty(ws_src_ip) && ws_src_port > 0){ + const char* ws_src_proto = tsk_params_get_param_value(pcWrappedMsgLeft->line.request.uri->params, "ws-src-proto"); + tsk_sprintf(&pRoute, "", ws_src_ip, ws_src_port, ws_src_proto ? ws_src_proto : "ws"); + const_cast(oCallSessionRight->getWrappedSession())->addHeader("Route", pRoute); + TSK_FREE(pRoute); + } + + // add WebSocket src connection info in the AoR + if(TNET_SOCKET_TYPE_IS_WS(pcWrappedMsgLeft->src_net_type) || TNET_SOCKET_TYPE_IS_WS(pcWrappedMsgLeft->src_net_type)){ + tnet_ip_t src_ip; + tnet_port_t src_port; + if(tnet_get_ip_n_port(pcWrappedMsgLeft->local_fd, tsk_false/*remote*/, &src_ip, &src_port) == 0){ + const char* src_proto = TNET_SOCKET_TYPE_IS_WS(pcWrappedMsgLeft->src_net_type) ? "ws" : "wss"; + const_cast(oCallSessionRight->getWrappedSession())->setWebSocketSrc(src_ip, src_port, src_proto); + tsk_sprintf(&pRoute, "", src_ip, src_port, src_proto); + const_cast(oCallSessionLeft->getWrappedSession())->addHeader("Route", pRoute); + TSK_FREE(pRoute); + } + } + + + // add Routes + int nRouteIndex = 0; + while((pRoute = const_cast(pcMsgLeft)->getSipHeaderValue("route", nRouteIndex++))){ + const_cast(oCallSessionRight->getWrappedSession())->addHeader("Route", pRoute); + TSK_FREE(pRoute); + } + + oPeer->setCallSessionRight(oCallSessionRight); + oPeer->setSessionRightState(MPPeerState_Connecting); + const_cast(oPeer->getCallSessionRight()->getWrappedCallSession())->call(pDstUri, + (bHaveAudio && bHaveVideo) ? twrap_media_audio_video + : (bHaveAudio ? twrap_media_audio : twrap_media_video) + ); + + + if(pCallSessionRight){ + delete pCallSessionRight, pCallSessionRight = NULL; + } + } + else{ + ActionConfig* config = new ActionConfig(); + config->setResponseLine(500, "Server error 501"); + const_cast(oCallSessionLeft->getWrappedInviteSession())->reject(config); + if(config) delete config, config = tsk_null; + } + + if(pCallSessionLeft){ + delete pCallSessionLeft, pCallSessionLeft = NULL; + } + + TSK_FREE(pDstUri); + TSK_FREE(pSrcUri); + } + break; + } + } + return 0; +} + +/* @override SipCallback::OnDialogEvent */ +int MPSipCallback::OnDialogEvent(const DialogEvent* e) +{ + const SipSession *pcSession = e->getBaseSession(); + if(!pcSession){ + return 0; + } + const short code = e->getCode(); + const unsigned nId = pcSession->getId(); + + switch(code) + { + case tsip_event_code_dialog_terminated: + case tsip_event_code_dialog_terminating: + { + MPObjectWrapper oPeer = m_oEngine->getPeerBySessionId(nId, true); + bool bIsleft = !!oPeer; + + if(!oPeer){ + oPeer = m_oEngine->getPeerBySessionId(nId, false); + } + + if(oPeer){ + // Get SIP response code + short nSipCode = 0; + const char* pcPhrase = NULL; + const SipMessage* pcMsg = e->getSipMessage(); + + if(pcMsg && const_cast(pcMsg)->isResponse()){ + nSipCode = const_cast(pcMsg)->getResponseCode(); + pcPhrase = const_cast(pcMsg)->getResponsePhrase(); + } + + if(bIsleft){ + oPeer->setSessionLeftState(MPPeerState_Terminated); + oPeer->setLastSipResponseLeft(nSipCode); + } + else{ + oPeer->setSessionRightState(MPPeerState_Terminated); + oPeer->setLastSipResponseRight(nSipCode); + } + + ActionConfig* config = new ActionConfig(); + if(config && nSipCode > 0){ + config->setResponseLine(nSipCode, pcPhrase); + } + + if(oPeer->isSessionLeftActive() && oPeer->getCallSessionLeft()){ + const_cast(oPeer->getCallSessionLeft()->getWrappedInviteSession())->hangup(config); + } + if(oPeer->isSessionRightActive() && oPeer->getCallSessionRight()){ + const_cast(oPeer->getCallSessionRight()->getWrappedInviteSession())->hangup(config); + } + if(!oPeer->isSessionLeftActive() && !oPeer->isSessionRightActive()){ + m_oEngine->removePeer(oPeer->getId()); + } + + if(config){ + delete config, config = NULL; + } + } + break; + } + case tsip_event_code_dialog_connected: + { + MPObjectWrapper oPeer = m_oEngine->getPeerBySessionId(nId, true); + bool bIsleft = !!oPeer; + + if(!oPeer){ + oPeer = m_oEngine->getPeerBySessionId(nId, false); + } + + if(oPeer){ + if(bIsleft){ + oPeer->setSessionLeftState(MPPeerState_Connected); + } + else{ + oPeer->setSessionRightState(MPPeerState_Connected); + // right accepted the call -> accept left + if(!oPeer->isSessionLeftConnected() && oPeer->getCallSessionLeft()){ + const_cast(oPeer->getCallSessionLeft()->getWrappedInviteSession())->accept(); + } + } + + // attach media proxy plugins + if(oPeer->isSessionLeftConnected() && oPeer->isSessionRightConnected()){ + attachMediaProxyPlugins(oPeer); + } + } + break; + } + } + + + + return 0; +} + +/* @override SipCallback::OnRegistrationEvent */ +int MPSipCallback::OnRegistrationEvent(const RegistrationEvent* e) +{ + switch(e->getType()) + { + case tsip_i_newreg: + { + assert(e->getSession() == NULL); + + RegistrationSession *pRegSession; + if((pRegSession = e->takeSessionOwnership())){ + pRegSession->accept(); + delete pRegSession, pRegSession = NULL; + } + + break; + } + } + + return 0; +} + +MPObjectWrapper MPSipCallback::New(MPObjectWrapper oEngine) +{ + MPObjectWrapper oCallback = new MPSipCallback(oEngine); + return oCallback; +} + + + +// +// MPSipStack +// + +MPSipStack::MPSipStack(MPObjectWrapper oCallback, const char* pRealmUri, const char* pPrivateId, const char* pPublicId) +{ + m_pStack = new SipStack(*oCallback, pRealmUri, pPrivateId, pPublicId); +} + +MPSipStack::~MPSipStack() +{ + if(m_pStack){ + delete m_pStack, m_pStack = NULL; + } +} + +bool MPSipStack::isValid() +{ + return (m_pStack && m_pStack->isValid()); +} + +const SipStack* MPSipStack::getWrappedStack() +{ + return m_pStack; +} + +MPObjectWrapper MPSipStack::New(MPObjectWrapper oCallback, const char* pRealmUri, const char* pPrivateId, const char* pPublicId) +{ + MPObjectWrapper oStack = new MPSipStack(oCallback, pRealmUri, pPrivateId, pPublicId); + if(!oStack->isValid()){ + MPObjectSafeRelease(oStack); + } + return oStack; +} + }// namespace \ No newline at end of file diff --git a/mp_wrap.h b/mp_wrap.h index a933dbd..4ebc081 100644 --- a/mp_wrap.h +++ b/mp_wrap.h @@ -1,79 +1,79 @@ -/* Copyright (C) 2012 Doubango Telecom -* -* This file is part of Open Source 'webrtc2sip' project -* -* -* 'webrtc2sip' is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* 'webrtc2sip' is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with 'webrtc2sip'. -*/ -#if !defined(_MEDIAPROXY_CALLBACK_H_) -#define _MEDIAPROXY_CALLBACK_H_ - -#include "mp_config.h" -#include "mp_object.h" -#include "mp_peer.h" - -#include "SipStack.h" - -class RegistrationEvent; -class InviteEvent; -class DialogEvent; - -namespace webrtc2sip { - -class MPEngine; - - -// -// MPSipCallback -// -class MPSipCallback : public MPObject, public SipCallback -{ -protected: - MPSipCallback(MPObjectWrapper oEngine); -public: - virtual ~MPSipCallback(); - virtual MP_INLINE const char* getObjectId() { return "Callback"; } - virtual void attachMediaProxyPlugins(MPObjectWrapper oPeer); - static MPObjectWrapper New(MPObjectWrapper oEngine); - - // SipCallback override - virtual int OnRegistrationEvent(const RegistrationEvent* e); - virtual int OnInviteEvent(const InviteEvent* e); - virtual int OnDialogEvent(const DialogEvent* e) ; - -private: - MPObjectWrapper m_oEngine; -}; - - -// -// Stack -// -class MPSipStack : public MPObject -{ -protected: - MPSipStack(MPObjectWrapper oCallback, const char* pRealmUri, const char* pPrivateId, const char* pPublicId); -public: - virtual ~MPSipStack(); - virtual MP_INLINE const char* getObjectId() { return "Stack"; } - const SipStack* getWrappedStack(); - bool isValid(); - static MPObjectWrapper New(MPObjectWrapper oCallback, const char* pRealmUri, const char* pPrivateId, const char* pPublicId); - -private: - SipStack* m_pStack; -}; - -} // namespace -#endif /* _MEDIAPROXY_CALLBACK_H_ */ +/* Copyright (C) 2012 Doubango Telecom +* +* This file is part of Open Source 'webrtc2sip' project +* +* +* 'webrtc2sip' is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* 'webrtc2sip' is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with 'webrtc2sip'. +*/ +#if !defined(_MEDIAPROXY_CALLBACK_H_) +#define _MEDIAPROXY_CALLBACK_H_ + +#include "mp_config.h" +#include "mp_object.h" +#include "mp_peer.h" + +#include "SipStack.h" + +class RegistrationEvent; +class InviteEvent; +class DialogEvent; + +namespace webrtc2sip { + +class MPEngine; + + +// +// MPSipCallback +// +class MPSipCallback : public MPObject, public SipCallback +{ +protected: + MPSipCallback(MPObjectWrapper oEngine); +public: + virtual ~MPSipCallback(); + virtual MP_INLINE const char* getObjectId() { return "Callback"; } + virtual void attachMediaProxyPlugins(MPObjectWrapper oPeer); + static MPObjectWrapper New(MPObjectWrapper oEngine); + + // SipCallback override + virtual int OnRegistrationEvent(const RegistrationEvent* e); + virtual int OnInviteEvent(const InviteEvent* e); + virtual int OnDialogEvent(const DialogEvent* e) ; + +private: + MPObjectWrapper m_oEngine; +}; + + +// +// Stack +// +class MPSipStack : public MPObject +{ +protected: + MPSipStack(MPObjectWrapper oCallback, const char* pRealmUri, const char* pPrivateId, const char* pPublicId); +public: + virtual ~MPSipStack(); + virtual MP_INLINE const char* getObjectId() { return "Stack"; } + const SipStack* getWrappedStack(); + bool isValid(); + static MPObjectWrapper New(MPObjectWrapper oCallback, const char* pRealmUri, const char* pPrivateId, const char* pPublicId); + +private: + SipStack* m_pStack; +}; + +} // namespace +#endif /* _MEDIAPROXY_CALLBACK_H_ */