@babblevoice/projectrtp 2.6.2 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/buildimage.yaml +17 -33
- package/Dockerfile +5 -5
- package/README.md +7 -16
- package/package.json +1 -1
- package/src/projectrtpchannel.cpp +79 -51
- package/src/projectrtpchannelmux.cpp +28 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
name: Build
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
on:
|
|
3
|
+
on:
|
|
5
4
|
workflow_dispatch:
|
|
6
5
|
push:
|
|
7
6
|
branches:
|
|
@@ -12,51 +11,29 @@ on:
|
|
|
12
11
|
branches:
|
|
13
12
|
- 'main'
|
|
14
13
|
|
|
15
|
-
#GH
|
|
16
14
|
permissions:
|
|
17
15
|
contents: read
|
|
18
16
|
|
|
19
17
|
jobs:
|
|
20
18
|
build:
|
|
21
19
|
runs-on: ubuntu-latest
|
|
20
|
+
|
|
22
21
|
steps:
|
|
23
|
-
# Get the repository's code
|
|
24
22
|
- name: Checkout
|
|
25
|
-
uses: actions/checkout@
|
|
26
|
-
# https://github.com/docker/setup-qemu-action
|
|
27
|
-
- name: Set up QEMU
|
|
28
|
-
uses: docker/setup-qemu-action@v2
|
|
29
|
-
# https://github.com/docker/setup-buildx-action
|
|
30
|
-
- name: Set up Docker Buildx
|
|
31
|
-
id: buildx
|
|
32
|
-
uses: docker/setup-buildx-action@v2
|
|
33
|
-
- name: Login to Docker Hub
|
|
34
|
-
if: github.event_name != 'pull_request'
|
|
35
|
-
uses: docker/login-action@v2
|
|
36
|
-
with:
|
|
37
|
-
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
38
|
-
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
23
|
+
uses: actions/checkout@v5
|
|
39
24
|
|
|
40
|
-
- name:
|
|
41
|
-
uses: docker/
|
|
42
|
-
with:
|
|
43
|
-
context: .
|
|
44
|
-
load: true
|
|
45
|
-
tags: docker.io/tinpotnick/projectrtp:test
|
|
25
|
+
- name: Set up QEMU
|
|
26
|
+
uses: docker/setup-qemu-action@v3
|
|
46
27
|
|
|
47
|
-
- name:
|
|
48
|
-
|
|
49
|
-
run: |
|
|
50
|
-
docker run --rm docker.io/tinpotnick/projectrtp:test /bin/sh -c 'npm run github:check'
|
|
28
|
+
- name: Set up Docker Buildx
|
|
29
|
+
uses: docker/setup-buildx-action@v3
|
|
51
30
|
|
|
52
31
|
- name: Docker meta
|
|
53
32
|
id: ourdockertags
|
|
54
|
-
uses: docker/metadata-action@
|
|
33
|
+
uses: docker/metadata-action@v5
|
|
55
34
|
with:
|
|
56
|
-
# list of Docker images to use as base name for tags
|
|
57
35
|
images: |
|
|
58
36
|
docker.io/tinpotnick/projectrtp
|
|
59
|
-
# Docker tags based on the following events/attributes
|
|
60
37
|
tags: |
|
|
61
38
|
type=schedule
|
|
62
39
|
type=ref,event=branch
|
|
@@ -65,9 +42,16 @@ jobs:
|
|
|
65
42
|
type=semver,pattern={{major}}.{{minor}}
|
|
66
43
|
type=semver,pattern={{major}}
|
|
67
44
|
type=sha
|
|
68
|
-
|
|
45
|
+
|
|
46
|
+
- name: Login to Docker Hub
|
|
47
|
+
if: github.event_name != 'pull_request'
|
|
48
|
+
uses: docker/login-action@v3
|
|
49
|
+
with:
|
|
50
|
+
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
51
|
+
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
52
|
+
|
|
69
53
|
- name: Build and push
|
|
70
|
-
uses: docker/build-push-action@
|
|
54
|
+
uses: docker/build-push-action@v6
|
|
71
55
|
with:
|
|
72
56
|
context: .
|
|
73
57
|
platforms: linux/amd64,linux/arm64
|
package/Dockerfile
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
FROM alpine:3.
|
|
2
|
+
FROM alpine:3.22 AS builder
|
|
3
3
|
|
|
4
4
|
WORKDIR /usr/src/
|
|
5
5
|
|
|
@@ -9,16 +9,16 @@ RUN apk add --no-cache \
|
|
|
9
9
|
wget https://github.com/TimothyGu/libilbc/releases/download/v3.0.4/libilbc-3.0.4.tar.gz; \
|
|
10
10
|
tar xvzf libilbc-3.0.4.tar.gz; \
|
|
11
11
|
cd libilbc-3.0.4; \
|
|
12
|
-
cmake . -DCMAKE_INSTALL_LIBDIR=/lib -DCMAKE_INSTALL_INCLUDEDIR=/usr/include; cmake --build .; cmake --install .;
|
|
13
|
-
|
|
12
|
+
cmake . -DCMAKE_INSTALL_LIBDIR=/lib -DCMAKE_INSTALL_INCLUDEDIR=/usr/include; cmake --build .; cmake --install .;
|
|
13
|
+
|
|
14
14
|
WORKDIR /usr/src/projectrtp
|
|
15
15
|
COPY . .
|
|
16
16
|
|
|
17
17
|
# a more correct to install this module into the global location
|
|
18
18
|
RUN npm install --production --build-from-source && \
|
|
19
|
-
npm install -g .
|
|
19
|
+
npm install -g .
|
|
20
20
|
|
|
21
|
-
FROM alpine:3.
|
|
21
|
+
FROM alpine:3.22 AS app
|
|
22
22
|
|
|
23
23
|
RUN apk add --no-cache \
|
|
24
24
|
spandsp tiff gnutls libsrtp libc6-compat openssl ca-certificates nodejs npm
|
package/README.md
CHANGED
|
@@ -62,22 +62,13 @@ These are designed to create real world scenarios - opening and closing multiple
|
|
|
62
62
|
|
|
63
63
|
### Local build
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Local dev build
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
|
-
docker
|
|
69
|
-
docker buildx build --platform linux/amd64,linux/arm64 -t tinpotnick/projectrtp:2.6.2 . --push
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Dev build
|
|
68
|
+
docker build --target builder -t projectrtp:dev .
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
sudo dnf install libasan libubsan
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
```sh
|
|
80
|
-
npm run build:dev
|
|
70
|
+
# to run
|
|
71
|
+
docker run -it --rm projectrtp:dev [command ie sh or npm test etc]
|
|
81
72
|
```
|
|
82
73
|
|
|
83
74
|
## Example scripts
|
|
@@ -129,7 +120,7 @@ A server would typically run application logic before then opening media ports.
|
|
|
129
120
|
|
|
130
121
|
const prtp = require( "@babblevoice/projectrtp" ).projectrtp
|
|
131
122
|
|
|
132
|
-
/* This switches this server to a central
|
|
123
|
+
/* This switches this server to a central
|
|
133
124
|
server and requires nodes to connect to us
|
|
134
125
|
to provide worker nodes */
|
|
135
126
|
await prtp.server.listen()
|
|
@@ -199,7 +190,7 @@ async function go() {
|
|
|
199
190
|
const pa = await wgets( "https://checkip.amazonaws.com" )
|
|
200
191
|
|
|
201
192
|
prtp.setaddress( pa )
|
|
202
|
-
|
|
193
|
+
|
|
203
194
|
}
|
|
204
195
|
|
|
205
196
|
listen()
|
|
@@ -209,7 +200,7 @@ listen()
|
|
|
209
200
|
## Stats
|
|
210
201
|
|
|
211
202
|
When we receive an object back from our node (or if standlone just ourself), the object contains information about the
|
|
212
|
-
state of the sevrer. It includes items such as number of channels open, MOS quality score etc.
|
|
203
|
+
state of the sevrer. It includes items such as number of channels open, MOS quality score etc.
|
|
213
204
|
|
|
214
205
|
MOS is only included for our received measurements.
|
|
215
206
|
|
package/package.json
CHANGED
|
@@ -188,13 +188,13 @@ void projectrtpchannel::remote( std::string address,
|
|
|
188
188
|
this->remoteaddress = address;
|
|
189
189
|
changed = true;
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
if( port != this->remoteport ) {
|
|
193
193
|
this->remoteport = port;
|
|
194
194
|
changed = true;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
|
|
198
198
|
if( this->dtlsfingerprint != fingerprint ) {
|
|
199
199
|
this->dtlsfingerprint = fingerprint;
|
|
200
200
|
changed = true;
|
|
@@ -233,7 +233,7 @@ void projectrtpchannel::remote( std::string address,
|
|
|
233
233
|
this->rtpdtls = newsession;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
|
|
236
|
+
|
|
237
237
|
this->receivedrtp = false;
|
|
238
238
|
this->remoteconfirmed = false;
|
|
239
239
|
this->autoadjust = true;
|
|
@@ -316,7 +316,7 @@ void projectrtpchannel::badsocketopen( const char *err ) {
|
|
|
316
316
|
this->rtpsocket.close();
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
if(
|
|
319
|
+
if( this->rtcpsocket.is_open() ) {
|
|
320
320
|
this->rtcpsocket.close();
|
|
321
321
|
}
|
|
322
322
|
|
|
@@ -470,7 +470,7 @@ bool projectrtpchannel::checkidlerecv( void ) {
|
|
|
470
470
|
this->doclose();
|
|
471
471
|
return true;
|
|
472
472
|
}
|
|
473
|
-
|
|
473
|
+
|
|
474
474
|
} else if( this->hardtickswithnortpcount > ( 50 * 60 * 60 ) ) { /* 1hr hard timeout */
|
|
475
475
|
this->closereason = "idle";
|
|
476
476
|
this->doclose();
|
|
@@ -535,12 +535,14 @@ void projectrtpchannel::handletick( const boost::system::error_code& error ) {
|
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
rtppacket *src;
|
|
538
|
-
|
|
538
|
+
while( true ) {
|
|
539
539
|
{
|
|
540
540
|
SpinLockGuard guard( this->rtpbufferlock );
|
|
541
|
-
src = this->inbuff->
|
|
541
|
+
src = this->inbuff->peek();
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
+
if( nullptr == src ) break;
|
|
545
|
+
|
|
544
546
|
dtlssession::pointer currentdtlssession;
|
|
545
547
|
{
|
|
546
548
|
SpinLockGuard guarddtls( this->rtpdtlslock );
|
|
@@ -551,10 +553,22 @@ void projectrtpchannel::handletick( const boost::system::error_code& error ) {
|
|
|
551
553
|
!currentdtlssession->rtpdtlshandshakeing ) {
|
|
552
554
|
if( !currentdtlssession->unprotect( src ) ) {
|
|
553
555
|
this->receivedpkskip++;
|
|
556
|
+
{
|
|
557
|
+
SpinLockGuard guard( this->rtpbufferlock );
|
|
558
|
+
this->inbuff->poppeeked();
|
|
559
|
+
}
|
|
554
560
|
src = nullptr;
|
|
561
|
+
break;
|
|
555
562
|
}
|
|
556
563
|
}
|
|
557
|
-
|
|
564
|
+
|
|
565
|
+
if( !this->checkfordtmf( src ) ) break;
|
|
566
|
+
|
|
567
|
+
{
|
|
568
|
+
SpinLockGuard guard( this->rtpbufferlock );
|
|
569
|
+
this->inbuff->poppeeked();
|
|
570
|
+
}
|
|
571
|
+
}
|
|
558
572
|
|
|
559
573
|
this->senddtmf();
|
|
560
574
|
|
|
@@ -592,6 +606,11 @@ void projectrtpchannel::handletick( const boost::system::error_code& error ) {
|
|
|
592
606
|
}
|
|
593
607
|
}
|
|
594
608
|
|
|
609
|
+
if( nullptr != src ) {
|
|
610
|
+
SpinLockGuard guard( this->rtpbufferlock );
|
|
611
|
+
this->inbuff->poppeeked();
|
|
612
|
+
}
|
|
613
|
+
|
|
595
614
|
this->writerecordings();
|
|
596
615
|
|
|
597
616
|
this->endticktimer();
|
|
@@ -711,7 +730,7 @@ bool projectrtpchannel::recordercompleted( const channelrecorder::pointer& rec )
|
|
|
711
730
|
}
|
|
712
731
|
|
|
713
732
|
/**
|
|
714
|
-
* Helper function for checkfordtmf -
|
|
733
|
+
* Helper function for checkfordtmf -
|
|
715
734
|
* 1. stop player if set to stop on event
|
|
716
735
|
* 2. signal back to our control server that an event has been received.
|
|
717
736
|
* 3. forward to other channels we are mixing with
|
|
@@ -821,7 +840,7 @@ void projectrtpchannel::writerecordings( void ) {
|
|
|
821
840
|
|
|
822
841
|
/* calculate power for the below tests and the finish test in ::removeoldrecorders */
|
|
823
842
|
uint16_t pav = 0;
|
|
824
|
-
if( ( !rec->isactive() && rec->startabovepower > 0 ) ||
|
|
843
|
+
if( ( !rec->isactive() && rec->startabovepower > 0 ) ||
|
|
825
844
|
( rec->isactive() && rec->finishbelowpower > 0 ) ) {
|
|
826
845
|
pav = rec->poweravg( power );
|
|
827
846
|
}
|
|
@@ -875,10 +894,10 @@ bool projectrtpchannel::dtlsnegotiate( void ) {
|
|
|
875
894
|
}
|
|
876
895
|
|
|
877
896
|
/**
|
|
878
|
-
* @brief
|
|
879
|
-
*
|
|
880
|
-
* @return true
|
|
881
|
-
* @return false
|
|
897
|
+
* @brief
|
|
898
|
+
*
|
|
899
|
+
* @return true
|
|
900
|
+
* @return false
|
|
882
901
|
*/
|
|
883
902
|
bool projectrtpchannel::handlestun( uint8_t *pk, size_t len ) {
|
|
884
903
|
|
|
@@ -904,7 +923,7 @@ bool projectrtpchannel::handlestun( uint8_t *pk, size_t len ) {
|
|
|
904
923
|
}
|
|
905
924
|
|
|
906
925
|
/**
|
|
907
|
-
* Auto correct our to send to address if required.
|
|
926
|
+
* Auto correct our to send to address if required.
|
|
908
927
|
*/
|
|
909
928
|
void projectrtpchannel::correctaddress( void ) {
|
|
910
929
|
|
|
@@ -949,7 +968,7 @@ void projectrtpchannel::readsomertp( void ) {
|
|
|
949
968
|
SpinLockGuard guard( this->rtpbufferlock );
|
|
950
969
|
buf = this->inbuff->reserve();
|
|
951
970
|
}
|
|
952
|
-
|
|
971
|
+
|
|
953
972
|
|
|
954
973
|
if( nullptr == buf ) {
|
|
955
974
|
fprintf( stderr, "Error no buffer\n" );
|
|
@@ -957,48 +976,49 @@ void projectrtpchannel::readsomertp( void ) {
|
|
|
957
976
|
return;
|
|
958
977
|
}
|
|
959
978
|
|
|
979
|
+
auto self = shared_from_this();
|
|
980
|
+
|
|
960
981
|
this->rtpsocket.async_receive_from(
|
|
961
982
|
boost::asio::buffer( buf->pk, RTPMAXLENGTH ), this->rtpsenderendpoint,
|
|
962
|
-
[
|
|
963
|
-
|
|
964
|
-
if ( ec && ec != boost::asio::error::message_size ) return;
|
|
965
|
-
this->receivedpkcount++;
|
|
983
|
+
[ self, buf ]( boost::system::error_code ec, std::size_t bytesrecvd ) {
|
|
966
984
|
|
|
967
|
-
if( !
|
|
985
|
+
if( !self->active || self->_requestclose ) return;
|
|
986
|
+
if( ec && ec != boost::asio::error::message_size ) return;
|
|
987
|
+
self->receivedpkcount++;
|
|
968
988
|
|
|
969
989
|
if ( bytesrecvd > 0 && bytesrecvd <= RTPMAXLENGTH ) {
|
|
970
990
|
buf->length = bytesrecvd;
|
|
971
991
|
|
|
972
|
-
if(
|
|
992
|
+
if( self->handlestun( buf->pk, bytesrecvd ) )
|
|
973
993
|
goto readsomemore;
|
|
974
994
|
|
|
975
995
|
dtlssession::pointer currentdtlssession;
|
|
976
996
|
{
|
|
977
|
-
SpinLockGuard guard(
|
|
978
|
-
currentdtlssession =
|
|
997
|
+
SpinLockGuard guard( self->rtpdtlslock );
|
|
998
|
+
currentdtlssession = self->rtpdtls;
|
|
979
999
|
}
|
|
980
1000
|
|
|
981
1001
|
if( nullptr != currentdtlssession &&
|
|
982
1002
|
currentdtlssession->rtpdtlshandshakeing ) {
|
|
983
1003
|
{
|
|
984
|
-
SpinLockGuard guard(
|
|
1004
|
+
SpinLockGuard guard( self->rtpdtlslock );
|
|
985
1005
|
currentdtlssession->write( buf->pk, bytesrecvd );
|
|
986
1006
|
}
|
|
987
1007
|
|
|
988
|
-
|
|
1008
|
+
self->dtlsnegotiate();
|
|
989
1009
|
goto readsomemore;
|
|
990
1010
|
}
|
|
991
1011
|
|
|
992
1012
|
/* TODO ZRTP? */
|
|
993
1013
|
if( buf->getpacketextension() ) {
|
|
994
|
-
|
|
1014
|
+
self->receivedpkskip++;
|
|
995
1015
|
goto readsomemore;
|
|
996
1016
|
}
|
|
997
1017
|
|
|
998
|
-
|
|
1018
|
+
self->correctaddress();
|
|
999
1019
|
|
|
1000
|
-
if( !
|
|
1001
|
-
|
|
1020
|
+
if( !self->recv ) {
|
|
1021
|
+
self->receivedpkskip++;
|
|
1002
1022
|
goto readsomemore;
|
|
1003
1023
|
}
|
|
1004
1024
|
|
|
@@ -1007,10 +1027,10 @@ void projectrtpchannel::readsomertp( void ) {
|
|
|
1007
1027
|
for now do not check.
|
|
1008
1028
|
this->correctssrc( buf->getssrc() );
|
|
1009
1029
|
*/
|
|
1010
|
-
|
|
1011
|
-
if(
|
|
1030
|
+
|
|
1031
|
+
if( self->confirmedrtpsenderendpoint != self->rtpsenderendpoint ) {
|
|
1012
1032
|
/* After the first packet - we only accept data from the verified source */
|
|
1013
|
-
|
|
1033
|
+
self->receivedpkskip++;
|
|
1014
1034
|
goto readsomemore;
|
|
1015
1035
|
}
|
|
1016
1036
|
|
|
@@ -1021,25 +1041,27 @@ void projectrtpchannel::readsomertp( void ) {
|
|
|
1021
1041
|
}
|
|
1022
1042
|
*/
|
|
1023
1043
|
|
|
1024
|
-
|
|
1025
|
-
|
|
1044
|
+
self->tickswithnortpcount = 0;
|
|
1045
|
+
self->hardtickswithnortpcount = 0;
|
|
1026
1046
|
|
|
1027
1047
|
/* dynamic payload types */
|
|
1028
1048
|
auto pt = buf->getpayloadtype();
|
|
1029
|
-
if( pt ==
|
|
1049
|
+
if( pt == self->ilbcpt ) {
|
|
1030
1050
|
buf->setpayloadtype( ILBCPAYLOADTYPE );
|
|
1031
|
-
} else if ( pt ==
|
|
1051
|
+
} else if ( pt == self->rfc2833pt ) {
|
|
1032
1052
|
buf->setpayloadtype( RFC2833PAYLOADTYPE );
|
|
1033
1053
|
}
|
|
1034
1054
|
|
|
1035
1055
|
{
|
|
1036
|
-
SpinLockGuard guard(
|
|
1037
|
-
|
|
1056
|
+
SpinLockGuard guard( self->rtpbufferlock );
|
|
1057
|
+
self->inbuff->push();
|
|
1038
1058
|
}
|
|
1039
1059
|
}
|
|
1040
1060
|
|
|
1041
1061
|
readsomemore:
|
|
1042
|
-
|
|
1062
|
+
if( self->active && !self->_requestclose ) {
|
|
1063
|
+
self->readsomertp();
|
|
1064
|
+
}
|
|
1043
1065
|
|
|
1044
1066
|
} );
|
|
1045
1067
|
}
|
|
@@ -1070,18 +1092,24 @@ rtppacket *projectrtpchannel::gettempoutbuf( void ) {
|
|
|
1070
1092
|
Wait for RTP data
|
|
1071
1093
|
*/
|
|
1072
1094
|
void projectrtpchannel::readsomertcp( void ) {
|
|
1095
|
+
|
|
1096
|
+
if( !this->active || this->_requestclose ) return;
|
|
1097
|
+
|
|
1098
|
+
auto self = shared_from_this();
|
|
1099
|
+
|
|
1073
1100
|
this->rtcpsocket.async_receive_from(
|
|
1074
1101
|
boost::asio::buffer( &this->rtcpdata[ 0 ], RTCPMAXLENGTH ), this->rtcpsenderendpoint,
|
|
1075
|
-
[
|
|
1102
|
+
[ self ]( boost::system::error_code ec, std::size_t bytes_recvd ) {
|
|
1076
1103
|
|
|
1104
|
+
if( !self->active || self->_requestclose ) return;
|
|
1077
1105
|
if( ec ) return;
|
|
1078
1106
|
|
|
1079
1107
|
if ( bytes_recvd > 0 && bytes_recvd <= RTCPMAXLENGTH ) {
|
|
1080
|
-
|
|
1108
|
+
self->handlertcpdata();
|
|
1081
1109
|
}
|
|
1082
1110
|
|
|
1083
|
-
if( bytes_recvd > 0 &&
|
|
1084
|
-
|
|
1111
|
+
if( bytes_recvd > 0 && self->active && !self->_requestclose ) {
|
|
1112
|
+
self->readsomertcp();
|
|
1085
1113
|
}
|
|
1086
1114
|
} );
|
|
1087
1115
|
}
|
|
@@ -1230,7 +1258,7 @@ bool projectrtpchannel::unmix( void ) {
|
|
|
1230
1258
|
|
|
1231
1259
|
/**
|
|
1232
1260
|
* @brief Actual do set the variables ot show unmixed.
|
|
1233
|
-
*
|
|
1261
|
+
*
|
|
1234
1262
|
*/
|
|
1235
1263
|
void projectrtpchannel::dounmix( void ) {
|
|
1236
1264
|
this->mixing = false;
|
|
@@ -1334,7 +1362,7 @@ void projectrtpchannel::senddtmf( void ) {
|
|
|
1334
1362
|
*tmp = htons( ( this->dtmfsendcount + 1 ) * 160 );
|
|
1335
1363
|
|
|
1336
1364
|
this->writepacket( dst );
|
|
1337
|
-
|
|
1365
|
+
|
|
1338
1366
|
} else {
|
|
1339
1367
|
/* end packet */
|
|
1340
1368
|
rtppacket *dst = this->gettempoutbuf();
|
|
@@ -1452,7 +1480,7 @@ static projectrtpchannel::pointer getrtpchannelfromargv( napi_env env, napi_call
|
|
|
1452
1480
|
static napi_value channelclose( napi_env env, napi_callback_info info ) {
|
|
1453
1481
|
|
|
1454
1482
|
projectrtpchannel::pointer chan = getrtpchannelfromthis( env, info );
|
|
1455
|
-
if( nullptr == chan ) createnapibool( env, false );
|
|
1483
|
+
if( nullptr == chan ) return createnapibool( env, false );
|
|
1456
1484
|
chan->requestclose( "requested" );
|
|
1457
1485
|
|
|
1458
1486
|
return createnapibool( env, true );
|
|
@@ -1563,7 +1591,7 @@ static napi_value channelrecord( napi_env env, napi_callback_info info ) {
|
|
|
1563
1591
|
if( napi_ok == napi_has_named_property( env, argv[ 0 ], "numchannels", &hasit ) &&
|
|
1564
1592
|
hasit &&
|
|
1565
1593
|
napi_ok == napi_get_named_property( env, argv[ 0 ], "numchannels", &mtmp ) ) {
|
|
1566
|
-
|
|
1594
|
+
|
|
1567
1595
|
uint32_t numchannels = 2;
|
|
1568
1596
|
napi_get_value_uint32( env, mtmp, &numchannels );
|
|
1569
1597
|
if( 1 == numchannels || 2 == numchannels ) {
|
|
@@ -2118,8 +2146,8 @@ static napi_value channelcreate( napi_env env, napi_callback_info info ) {
|
|
|
2118
2146
|
if( napi_ok == napi_has_named_property( env, argv[ 0 ], "remote", &hasit ) &&
|
|
2119
2147
|
hasit &&
|
|
2120
2148
|
napi_ok == napi_get_named_property( env, argv[ 0 ], "remote", &nremote ) ) {
|
|
2121
|
-
/*
|
|
2122
|
-
optional - DTLS
|
|
2149
|
+
/*
|
|
2150
|
+
optional - DTLS
|
|
2123
2151
|
"dtls": {
|
|
2124
2152
|
"fingerprint": {
|
|
2125
2153
|
"type": "sha-256 - but ignored for now!",
|
|
@@ -2364,7 +2392,7 @@ nodtls:
|
|
|
2364
2392
|
napi_ok != napi_create_string_utf8( env, getdtlssrtpsha256fingerprint(), NAPI_AUTO_LENGTH, &fp ) ||
|
|
2365
2393
|
napi_ok != napi_set_named_property( env, ndtls, "fingerprint", fp ) ||
|
|
2366
2394
|
napi_ok != napi_set_named_property( env, ndtls, "enabled", createnapibool( env, dtlsenabled ) ) ||
|
|
2367
|
-
|
|
2395
|
+
|
|
2368
2396
|
napi_ok != napi_create_string_utf8( env, p->icelocalpwd.c_str(), NAPI_AUTO_LENGTH, &nicepwd ) ||
|
|
2369
2397
|
napi_ok != napi_set_named_property( env, nlocal, "icepwd", nicepwd ) ) {
|
|
2370
2398
|
|
|
@@ -149,7 +149,7 @@ void projectchannelmux::mix2( void ) {
|
|
|
149
149
|
while( true ) {
|
|
150
150
|
{
|
|
151
151
|
SpinLockGuard guard( chan1->rtpbufferlock );
|
|
152
|
-
src = chan1->inbuff->
|
|
152
|
+
src = chan1->inbuff->peek();
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
if( nullptr == src ) break;
|
|
@@ -165,6 +165,10 @@ void projectchannelmux::mix2( void ) {
|
|
|
165
165
|
!currentdtlssession->rtpdtlshandshakeing ) {
|
|
166
166
|
if( !currentdtlssession->unprotect( src ) ) {
|
|
167
167
|
chan1->receivedpkskip++;
|
|
168
|
+
{
|
|
169
|
+
SpinLockGuard guard( chan1->rtpbufferlock );
|
|
170
|
+
chan1->inbuff->poppeeked();
|
|
171
|
+
}
|
|
168
172
|
src = nullptr;
|
|
169
173
|
break;
|
|
170
174
|
}
|
|
@@ -172,13 +176,22 @@ void projectchannelmux::mix2( void ) {
|
|
|
172
176
|
|
|
173
177
|
/* process but ignore and look for next other packet */
|
|
174
178
|
if( !chan1->checkfordtmf( src ) ) break;
|
|
179
|
+
|
|
180
|
+
{
|
|
181
|
+
SpinLockGuard guard( chan1->rtpbufferlock );
|
|
182
|
+
chan1->inbuff->poppeeked();
|
|
183
|
+
}
|
|
175
184
|
}
|
|
176
185
|
this->postrtpdata( chan1, chan2, src );
|
|
186
|
+
if( nullptr != src ) {
|
|
187
|
+
SpinLockGuard guard( chan1->rtpbufferlock );
|
|
188
|
+
chan1->inbuff->poppeeked();
|
|
189
|
+
}
|
|
177
190
|
|
|
178
191
|
while( true ) {
|
|
179
192
|
{
|
|
180
193
|
SpinLockGuard guard( chan2->rtpbufferlock );
|
|
181
|
-
src = chan2->inbuff->
|
|
194
|
+
src = chan2->inbuff->peek();
|
|
182
195
|
}
|
|
183
196
|
|
|
184
197
|
if( nullptr == src ) break;
|
|
@@ -194,15 +207,28 @@ void projectchannelmux::mix2( void ) {
|
|
|
194
207
|
!currentdtlssession->rtpdtlshandshakeing ) {
|
|
195
208
|
if( !currentdtlssession->unprotect( src ) ) {
|
|
196
209
|
chan2->receivedpkskip++;
|
|
210
|
+
{
|
|
211
|
+
SpinLockGuard guard( chan2->rtpbufferlock );
|
|
212
|
+
chan2->inbuff->poppeeked();
|
|
213
|
+
}
|
|
197
214
|
src = nullptr;
|
|
198
215
|
break;
|
|
199
216
|
}
|
|
200
217
|
}
|
|
201
218
|
|
|
202
219
|
if( !chan2->checkfordtmf( src ) ) break;
|
|
220
|
+
|
|
221
|
+
{
|
|
222
|
+
SpinLockGuard guard( chan2->rtpbufferlock );
|
|
223
|
+
chan2->inbuff->poppeeked();
|
|
224
|
+
}
|
|
203
225
|
}
|
|
204
226
|
|
|
205
227
|
this->postrtpdata( chan2, chan1, src );
|
|
228
|
+
if( nullptr != src ) {
|
|
229
|
+
SpinLockGuard guard( chan2->rtpbufferlock );
|
|
230
|
+
chan2->inbuff->poppeeked();
|
|
231
|
+
}
|
|
206
232
|
}
|
|
207
233
|
|
|
208
234
|
/**
|