Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit a70aa06

Browse files
authored
Merge branch 'master' into quic-protocol
2 parents fbb963d + dc4a7ae commit a70aa06

File tree

7 files changed

+79
-41
lines changed

7 files changed

+79
-41
lines changed

doc/servermd/AnalyticsGuide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Start up MCU in Docker container:
135135

136136
````
137137
cd Release-vxxx
138-
./bin/init-all.sh --deps
138+
./bin/init-all.sh --deps ##default password for user owt is owt
139139
./bin/start-all.sh
140140
````
141141

docker/Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,18 @@ WORKDIR /home
220220
ARG NODE_VER=v10.21.0
221221
ARG NODE_REPO=https://nodejs.org/dist/${NODE_VER}/node-${NODE_VER}-linux-x64.tar.xz
222222

223-
COPY --from=owt-build /home/owt-server/dist /home/owt
224-
COPY startowt.sh /home/
225-
226-
RUN apt-get update && apt-get install -y -q --no-install-recommends ca-certificates wget xz-utils rabbitmq-server mongodb libboost-system-dev libboost-thread-dev liblog4cxx-dev libglib2.0-0 libfreetype6-dev curl
223+
RUN apt-get update && apt-get install -y -q --no-install-recommends ca-certificates wget xz-utils rabbitmq-server mongodb libboost-system-dev libboost-thread-dev liblog4cxx-dev libglib2.0-0 libfreetype6-dev curl sudo
227224

228225
RUN wget ${NODE_REPO} && \
229226
tar xf node-${NODE_VER}-linux-x64.tar.xz && \
230227
cp node-*/* /usr/local -rf && rm -rf node-*
231228

229+
RUN useradd -m owt && echo "owt:owt" | chpasswd && adduser owt sudo
230+
231+
COPY --chown=owt:owt --from=owt-build /home/owt-server/dist /home/owt
232+
COPY --chown=owt:owt startowt.sh /home/
233+
234+
USER owt
235+
236+
CMD /bin/bash
232237
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib/x86_64-linux-gnu

docker/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ Note that `externalip` and `network_interface` should be both set if there are e
4444
a) Launch a Docker container with following command to simply try OWT:
4545
4646
```shell
47-
docker run -itd --name=owt --net=host owt:run /home/startowt.sh
47+
docker run -itd --name=owt --net=host owt:run bash
48+
docker exec -it owt bash
49+
cd /home/
50+
./startowt.sh ##default password for user owt is owt
4851
```
4952
Then OWT service should be launched and you can connect to https://localhost:3004 to start your OWT journey.
5053
5154
b) Launch OWT service with Docker swarm with script ```conference/build_server.sh```
5255
53-
c) Customize different OWT module images and launch OWT service with Kubernetes.
56+
c) Customize different OWT module images and launch OWT service with Kubernetes.

docker/gst-analytics.Dockerfile

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -521,19 +521,14 @@ ARG IE_DIR=/home/build/opt/intel/dldt/inference-engine
521521

522522
RUN mkdir -p ${IE_DIR}/include && \
523523
cp -r /opt/intel/openvino_2021/inference_engine/include/* ${IE_DIR}/include && \
524-
525524
mkdir -p ${IE_DIR}/lib/intel64 && \
526525
cp -r /opt/intel/openvino_2021/inference_engine/lib/intel64/* ${IE_DIR}/lib/intel64 && \
527-
528526
mkdir -p ${IE_DIR}/share && \
529527
cp -r /opt/intel/openvino_2021/inference_engine/share/* ${IE_DIR}/share/ && \
530-
531528
mkdir -p ${IE_DIR}/external/ && \
532529
cp -r /opt/intel/openvino_2021/inference_engine/external/* ${IE_DIR}/external && \
533-
534530
mkdir -p ${IE_DIR}/external/opencv && \
535531
cp -r /opt/intel/openvino_2021/opencv/* ${IE_DIR}/external/opencv/ && \
536-
537532
mkdir -p ${IE_DIR}/external/ngraph && \
538533
cp -r /opt/intel/openvino_2021/deployment_tools/ngraph/* ${IE_DIR}/external/ngraph/
539534

@@ -585,7 +580,7 @@ RUN cd ${SERVER_PATH} && ./scripts/build.js -t mcu -r -c && \
585580
FROM ubuntu:18.04 AS owt-run
586581
LABEL Description="This is the base image for GSTREAMER & DLDT Ubuntu 18.04 LTS"
587582
LABEL Vendor="Intel Corporation"
588-
WORKDIR /root
583+
WORKDIR /home
589584

590585
# Prerequisites
591586
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends \
@@ -612,14 +607,12 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-
612607
\
613608
libmpeg2-4-dev libopencore-amrnb-dev libopencore-amrwb-dev liba52-0.7.4-dev \
614609
\
615-
libva-dev libxrandr-dev libudev-dev liblog4cxx-dev gstreamer1.0-plugins-ugly rabbitmq-server mongodb \
610+
libva-dev libxrandr-dev libudev-dev liblog4cxx-dev gstreamer1.0-plugins-ugly rabbitmq-server mongodb sudo\
616611
\
612+
&& useradd -m owt && echo "owt:owt" | chpasswd && adduser owt sudo \
617613
&& rm -rf /var/lib/apt/lists/*
618614

619615
# Install
620-
COPY --from=dldt-build /home/build /
621-
COPY --from=gst-build /home/build /
622-
COPY --from=owt-build /home/owt-server/dist /home/owt
623616

624617
ARG LIBDIR=/usr/lib/x86_64-linux-gnu
625618

@@ -653,7 +646,10 @@ ARG SOURCE_REV
653646
ARG DLSTREAMER_VERSION=1.2.1
654647
ARG DLSTREAM_SOURCE_REPO=https://github.com/openvinotoolkit/dlstreamer_gst/archive/v${DLSTREAMER_VERSION}.tar.gz
655648

656-
COPY analyticspage /home/analyticspage
649+
COPY --chown=owt:owt --from=dldt-build /home/build /
650+
COPY --chown=owt:owt --from=gst-build /home/build /
651+
COPY --chown=owt:owt --from=owt-build /home/owt-server/dist /home/owt
652+
COPY --chown=owt:owt analyticspage /home/analyticspage
657653
ARG ENABLE_PAHO_INSTALLATION=false
658654
ARG ENABLE_RDKAFKA_INSTALLATION=false
659655
ARG BUILD_TYPE=Release
@@ -673,12 +669,14 @@ RUN wget ${DLSTREAM_SOURCE_REPO} && tar zxf v${DLSTREAMER_VERSION}.tar.gz && mv
673669
.. \
674670
&& make -j $(nproc) \
675671
&& make install \
676-
&& rm /root/v${DLSTREAMER_VERSION}.tar.gz
672+
&& rm /home/v${DLSTREAMER_VERSION}.tar.gz
677673

678674
RUN cp /home/analyticspage/index.js /home/owt/apps/current_app/public/scripts/ \
679675
&& cp /home/analyticspage/rest-sample.js /home/owt/apps/current_app/public/scripts/ \
680676
&& cp /home/analyticspage/index.html /home/owt/apps/current_app/public/ \
681677
&& cp /home/analyticspage/samplertcservice.js /home/owt/apps/current_app/
682678

683-
ENV GST_PLUGIN_PATH=/root/gst-video-analytics/
684-
ENV PYTHONPATH=/root/gst-video-analytics/python:$PYTHONPATH
679+
USER owt
680+
681+
ENV GST_PLUGIN_PATH=/home/gst-video-analytics/
682+
ENV PYTHONPATH=/home/gst-video-analytics/python:$PYTHONPATH

source/agent/conference/conference.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ var Conference = function (rpcClient, selfRpcId) {
253253
});
254254
});
255255
} else if (direction === 'out') {
256-
return addSubscription(sessionId, sessionInfo.locality, sessionInfo.transport, sessionInfo.media, sessionInfo.data, sessionInfo.info
256+
return addSubscription(sessionId, sessionInfo.locality, sessionInfo.media, sessionInfo.data, sessionInfo.info, sessionInfo.transport
257257
).then(() => {
258258
if (sessionInfo.info && sessionInfo.info.type !== 'webrtc') {
259259
if (sessionInfo.info.location) {
@@ -754,7 +754,7 @@ var Conference = function (rpcClient, selfRpcId) {
754754
return Promise.resolve('ok');
755755
};
756756

757-
const addSubscription = (id, locality, transport, mediaSpec, dataSpec, info) => {
757+
const addSubscription = (id, locality, mediaSpec, dataSpec, info, transport) => {
758758
if (!participants[info.owner]) {
759759
return Promise.reject('Participant early left');
760760
}
@@ -1311,7 +1311,7 @@ var Conference = function (rpcClient, selfRpcId) {
13111311
}
13121312

13131313
if (subDesc.type === 'sip') {
1314-
return addSubscription(subscriptionId, subDesc.transport, subDesc.locality, subDesc.media, subDesc.data, {owner: participantId, type: 'sip'})
1314+
return addSubscription(subscriptionId, subDesc.locality, subDesc.media, subDesc.data, {owner: participantId, type: 'sip'}, subDesc.transport)
13151315
.then((result) => {
13161316
callback('callback', result);
13171317
})
@@ -2459,6 +2459,7 @@ var Conference = function (rpcClient, selfRpcId) {
24592459
var subUpdate;
24602460
var muteReqs = [];
24612461
for (const cmd of commands) {
2462+
var exe;
24622463
switch (cmd.op) {
24632464
case 'replace':
24642465
if ((cmd.path === '/media/audio/status') && (cmd.value === 'inactive' || cmd.value === 'active')) {
@@ -2498,6 +2499,7 @@ var Conference = function (rpcClient, selfRpcId) {
24982499
} else {
24992500
return Promise.reject('Invalid path or value');
25002501
}
2502+
break;
25012503
default:
25022504
return Promise.reject('Invalid subscription control operation');
25032505
}

source/agent/webrtc/sdpInfo.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ class SdpInfo {
2929
});
3030
}
3131

32+
bundleMids() {
33+
const bundles = this.obj.groups.find(g => g.type === 'BUNDLE');
34+
return bundles.mids.split(' ');
35+
}
36+
37+
setBundleMids(mids) {
38+
const bundles = this.obj.groups.find(g => g.type === 'BUNDLE');
39+
bundles.mids = mids.join(' ');
40+
}
41+
3242
mids() {
3343
return this.obj.media.map(mediaInfo => mediaInfo.mid.toString());
3444
}
@@ -321,6 +331,30 @@ class SdpInfo {
321331
});
322332
}
323333

334+
isMediaClosed(mid) {
335+
const mediaInfo = this.media(mid);
336+
if (!mediaInfo) {
337+
return true;
338+
}
339+
if (mediaInfo.port === 0 && mediaInfo.direction === 'inactive') {
340+
return true;
341+
}
342+
return false;
343+
}
344+
345+
closeMedia(mid) {
346+
const mediaInfo = this.media(mid);
347+
if (mediaInfo) {
348+
mediaInfo.direction = 'inactive';
349+
mediaInfo.port = 0;
350+
delete mediaInfo.ext;
351+
delete mediaInfo.ssrcs;
352+
delete mediaInfo.ssrcGroups;
353+
delete mediaInfo.simulcast;
354+
delete mediaInfo.rids;
355+
}
356+
}
357+
324358
compareMedia(sdp) {
325359
const diffMids = [];
326360
this.obj.media.forEach(m1 => {

source/agent/webrtc/wrtcConnection.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ module.exports = function (spec, on_status, on_track) {
441441
// Check Media MID with saved operation
442442
if (!operationMap.has(mid)) {
443443
log.warn(`MID ${mid} in offer has no mapped operations (disabled)`);
444-
remoteSdp.setMediaPort(mid, 0);
444+
remoteSdp.closeMedia(mid);
445445
return;
446446
}
447447
if (operationMap.get(mid).sdpDirection !== remoteSdp.mediaDirection(mid)) {
@@ -452,9 +452,10 @@ module.exports = function (spec, on_status, on_track) {
452452
log.warn(`MID ${mid} in offer has conflict media type with operation`);
453453
return;
454454
}
455-
if (operationMap.get(mid).enabled && (remoteSdp.getMediaPort(mid) === 0)) {
456-
log.warn(`MID ${mid} in offer has conflict port with operation (disabled)`);
455+
if (operationMap.get(mid).enabled && remoteSdp.isMediaClosed(mid)) {
456+
log.warn(`MID ${mid} in offer has conflict closed state (disabled)`);
457457
operationMap.get(mid).enabled = false;
458+
return;
458459
}
459460

460461
// Determine media format in offer
@@ -501,34 +502,28 @@ module.exports = function (spec, on_status, on_track) {
501502
const addedMids = [];
502503
const removedMids = [];
503504

504-
for (let cmid of changedMids) {
505+
for (let cmid of laterSdp.mids()) {
505506
const oldMedia = remoteSdp.media(cmid);
506507
if (!oldMedia) {
507508
// Add media
508509
const tempSdp = laterSdp.singleMediaSdp(cmid);
509510
remoteSdp.mergeMedia(tempSdp);
510511
addedMids.push(cmid);
511-
} else if (laterSdp.getMediaPort(cmid) === 0) {
512+
} else if (laterSdp.isMediaClosed(cmid)) {
512513
// Remove media
513-
remoteSdp.setMediaPort(cmid, 0);
514-
localSdp.setMediaPort(cmid, 0);
515-
removedMids.push(cmid);
516-
} else if (laterSdp.mediaDirection(cmid) === 'inactive') {
517-
// Disable media
518-
remoteSdp.media(cmid).direction = 'inactive';
519-
localSdp.media(cmid).direction = 'inactive';
514+
remoteSdp.closeMedia(cmid);
520515
removedMids.push(cmid);
521516
} else {
522-
// May be port or direction change
523-
log.debug(`MID ${cmid} port or direction change`);
517+
// Treat as no change
518+
log.debug(`MID ${cmid} no change`);
524519
}
525520
}
526521

527522
let opId = null;
528523
for (let mid of addedMids) {
529524
processOfferMedia(mid);
530525
localSdp.mergeMedia(remoteSdp.singleMediaSdp(mid).answer());
531-
if (remoteSdp.getMediaPort(mid) !== 0) {
526+
if (!remoteSdp.isMediaClosed(mid)) {
532527
opId = setupTransport(mid);
533528
}
534529
}
@@ -540,10 +535,11 @@ module.exports = function (spec, on_status, on_track) {
540535
}
541536

542537
for (let mid of removedMids) {
543-
// processOfferMedia(mid);
538+
localSdp.closeMedia(mid);
539+
// Should already be destroyed by 'removeTrackOperation'
544540
// destroyTransport(mid);
545541
}
546-
542+
localSdp.setBundleMids(remoteSdp.bundleMids());
547543
// Produce answer
548544
const message = localSdp.toString();
549545
log.debug('Answer SDP', message);

0 commit comments

Comments
 (0)