From 71dbac60afa54d2642c3471c080686da56579ca0 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期六, 09 九月 2023 16:37:13 +0800
Subject: [PATCH] 流媒体优化

---
 ard-work/src/main/java/com/ruoyi/media/domain/Conf.java                   |    3 
 ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java    |   21 ++-
 ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java  |   10 +
 ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml                    |   83 ++++++++++++----
 ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java |   83 ++++++++-------
 ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java         |    4 
 lib/mediamtx/mediamtx.yml                                                 |    2 
 ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java                   |   15 ++
 ard-work/src/main/resources/templates/preview.html                        |   20 ++-
 9 files changed, 163 insertions(+), 78 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
index 411a27f..a4e65f3 100644
--- a/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
+++ b/ard-work/src/main/java/com/ruoyi/media/controller/MediaController.java
@@ -18,6 +18,7 @@
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
@@ -51,14 +52,18 @@
         if (StringUtils.isEmpty(streamInfo.getRtspSource())) {
             return AjaxResult.error("rtsp鍦板潃涓嶈兘涓虹┖");
         }
-        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(), streamInfo.getIsCode());
+        Map<String, String> map = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(), streamInfo.getIsCode());
+        map.get("rtspUrl");
         Vtdu vtdu = new Vtdu();
         vtdu.setName(streamInfo.getName());
-        vtdu.setRtspUrl(streamInfo.getRtspSource());
+        vtdu.setSourceUrl(streamInfo.getRtspSource());
         vtdu.setIsCode(streamInfo.getIsCode());
         vtdu.setCodeType(streamInfo.getMode());
+        vtdu.setRtspUrl(map.get("rtspUrl"));
+        vtdu.setRtmpUrl(map.get("rtmpUrl"));
+        vtdu.setWebrtcUrl(map.get("webrtcUrl"));
         vtduService.insertVtdu(vtdu);
-        return AjaxResult.success(rtsp);
+        return AjaxResult.success(map);
     }
 
 
@@ -72,14 +77,16 @@
     public AjaxResult edit(@RequestBody StreamInfo streamInfo) {
         mediaService.removePath(new String[]{streamInfo.getName()});
         vtduService.deleteVtduByName(streamInfo.getName());
-        String rtsp = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(), streamInfo.getIsCode());
+        Map<String, String> map = mediaService.addPath(streamInfo.getName(), streamInfo.getRtspSource(), streamInfo.getMode(), streamInfo.getIsCode());
         Vtdu vtdu = new Vtdu();
         vtdu.setName(streamInfo.getName());
-        vtdu.setRtspUrl(streamInfo.getRtspSource());
+        vtdu.setSourceUrl(streamInfo.getRtspSource());
         vtdu.setIsCode(streamInfo.getIsCode());
         vtdu.setCodeType(streamInfo.getMode());
-        vtduService.insertVtdu(vtdu);
-        return AjaxResult.success(rtsp);
+        vtdu.setRtspUrl(map.get("rtspUrl"));
+        vtdu.setRtmpUrl(map.get("rtmpUrl"));
+        vtdu.setWebrtcUrl(map.get("webrtcUrl"));
+        return AjaxResult.success(map);
     }
 
     /**
diff --git a/ard-work/src/main/java/com/ruoyi/media/domain/Conf.java b/ard-work/src/main/java/com/ruoyi/media/domain/Conf.java
index 85480b8..e7cdc7e 100644
--- a/ard-work/src/main/java/com/ruoyi/media/domain/Conf.java
+++ b/ard-work/src/main/java/com/ruoyi/media/domain/Conf.java
@@ -130,4 +130,7 @@
     private String runonread;
     @JsonProperty("runOnReadRestart")
     private boolean runonreadrestart;
+
+    @JsonProperty("maxReaders")
+    private Integer maxReaders;
 }
diff --git a/ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java b/ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java
index bbf9d60..a2c5e14 100644
--- a/ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java
+++ b/ard-work/src/main/java/com/ruoyi/media/domain/Vtdu.java
@@ -27,7 +27,7 @@
      * rtsp婧愬湴鍧�
      */
     @Excel(name = "rtsp婧愬湴鍧�")
-    private String rtspUrl;
+    private String sourceUrl;
 
     /**
      * 鏄惁杞爜
@@ -41,5 +41,16 @@
     @Excel(name = "杞爜妯″紡")
     private String codeType;
 
-
+    /**
+     * rtsp鎾斁鍦板潃
+     */
+    String rtspUrl;
+    /**
+     * rtmp鎾斁鍦板潃
+     */
+    String rtmpUrl;
+    /**
+     * webrtc鎾斁鍦板潃
+     */
+    String webrtcUrl;
 }
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java b/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java
index 8337a5f..195ab1a 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/IMediaService.java
@@ -2,7 +2,9 @@
 
 import com.ruoyi.media.domain.*;
 
+import java.lang.reflect.MalformedParameterizedTypeException;
 import java.util.List;
+import java.util.Map;
 
 public interface IMediaService {
     /**
@@ -14,7 +16,7 @@
      * 鍒樿嫃涔�
      * 2023/8/12 13:56:52
      */
-    String addPath(String name, String rtspPath, String mode, String isCode);
+    Map<String,String> addPath(String name, String rtspPath, String mode, String isCode);
 
     StreamInfo getPathInfo(String name);
 
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
index 4966e7e..32fc297 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/MediaServiceImpl.java
@@ -1,6 +1,8 @@
 package com.ruoyi.media.service.impl;
 
 import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.media.domain.*;
 import com.ruoyi.media.mapper.VtduMapper;
@@ -20,10 +22,7 @@
 import javax.annotation.PreDestroy;
 import javax.annotation.Resource;
 import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -61,8 +60,13 @@
                 mediaClient.removePath(path.getName());
             }
             List<Vtdu> vtduList = vtduMapper.selectVtduList(new Vtdu());
-            for (Vtdu v : vtduList) {
-                addPath(v.getName(), v.getRtspUrl(), v.getCodeType(), v.getIsCode());
+            for (Vtdu vtdu : vtduList) {
+                Map<String, String> map = addPath(vtdu.getName(), vtdu.getSourceUrl(), vtdu.getCodeType(), vtdu.getIsCode());
+                vtdu.setRtspUrl(map.get("rtspUrl"));
+                vtdu.setRtmpUrl(map.get("rtmpUrl"));
+                vtdu.setWebrtcUrl(map.get("webrtcUrl"));
+                vtdu.setUpdateTime(DateUtils.getNowDate());
+                vtduMapper.updateVtdu(vtdu);
             }
         } catch (Exception ex) {
             log.error("鍔犺浇娴佸獟浣撳垪琛ㄥ紓甯�:" + ex.getMessage());
@@ -105,8 +109,11 @@
     }
 
     @Override
-    public String addPath(String name, String rtspPath, String mode, String isCode) {
+    public Map<String,String> addPath(String name, String sourceUrl, String mode, String isCode) {
         String rtspUrl = "rtsp://" + mediamtxHost + ":7554/" + name;
+        String rtmpUrl = "rtmp://" + mediamtxHost + ":1935/" + name;
+        String webrtcUrl = "http://" + mediamtxHost + ":8889/" + name;
+
         Conf mediaInfo = new Conf();
         String rootPath = System.getProperty("user.dir").replaceAll("\\\\", "/") + "/lib/mediamtx/";
         //-vcodec libx264 //鎸囧畾瑙嗛缂栫爜鍣ㄤ负 libx264锛屼娇鐢� H.264 缂栫爜鏍煎紡杩涜瑙嗛鍘嬬缉
@@ -124,9 +131,9 @@
         //GPU纭В鐮佺紪鐮� -hwaccel cuvid -c:v h264_cuvid  浣跨敤cuda瑙g爜   -c:v h264_nvenc 浣跨敤cuda缂栫爜
         //String cmd = rootPath  + "/lib/mediamtx/" + "ffmpeg -hwaccel cuvid -c:v h264_cuvid  -rtsp_transport udp  -i " + rtspPath + " -c:v h264_nvenc  -r 25 -threads 4  -b:v 2048k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
         if (isCode.equals("1")) {
-            String cmd = rootPath + "ffmpeg -rtsp_transport tcp -i " + rtspPath + " -vcodec libx264 -preset:v ultrafast -r 25 -keyint_min 20 -g 20 -sc_threshold 0 -threads 6  -b:v 2048k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
+            String cmd = rootPath + "ffmpeg -rtsp_transport tcp -i " + sourceUrl + " -vcodec libx264 -preset:v ultrafast -r 25 -keyint_min 25 -g 25 -sc_threshold 0 -threads 6  -b:v 4096k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
             if (!softwareDecoding) {
-                cmd = rootPath + "ffmpeg -hwaccel cuvid -c:v h264_cuvid  -rtsp_transport tcp  -i " + rtspPath + " -c:v h264_nvenc  -r 25 -g 60 -threads 6  -b:v 2048k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
+                cmd = rootPath + "ffmpeg -hwaccel cuvid -c:v h264_cuvid  -rtsp_transport tcp  -i " + sourceUrl + " -c:v h264_nvenc  -r 25 -g 60 -threads 6  -b:v 4096k -bf 0 -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH";
             }
             if (mode.equals("0")) {
                 mediaInfo.setRunondemand(cmd);
@@ -134,13 +141,20 @@
             } else {
                 mediaInfo.setRunoninit(cmd);
                 mediaInfo.setRunoninitrestart(true);
+                //mediaInfo.setRunonready(cmd);
+                //mediaInfo.setRunonreadyrestart(true);
             }
         } else {
-            mediaInfo.setSource(rtspPath);
+            mediaInfo.setSource(sourceUrl);
         }
+        mediaInfo.setMaxReaders(100);
         mediaInfo.setSourceprotocol("tcp");
         mediaClient.addPath(name, mediaInfo);
-        return rtspUrl;
+        Map<String,String> map=new HashMap<>();
+        map.put("rtspUrl",rtspUrl);
+        map.put("rtmpUrl",rtmpUrl);
+        map.put("webrtcUrl",webrtcUrl);
+        return map;
     }
 
     @Override
@@ -149,19 +163,17 @@
         StreamInfo info = new StreamInfo();
         //ID
         info.setName(name);
-        String runoninit;
-        String runondemand = item.getConf().getRunondemand();
-        if (StringUtils.isNotEmpty(runondemand)) {
-            runoninit = item.getConf().getRunondemand();
+        String runOn;
+        if (StringUtils.isNotEmpty(item.getConf().getRunondemand())) {
+            runOn = item.getConf().getRunondemand();
             info.setMode("0");
         } else {
-            runoninit = item.getConf().getRunoninit();
+            //runOn = item.getConf().getRunonready();
+            runOn = item.getConf().getRunoninit();
             info.setMode("1");
         }
         //RTSP婧愬湴鍧�
-        String regex = "rtsp://[^\\s\"]+";
-        Pattern pattern = Pattern.compile(regex);
-        Matcher matcher = pattern.matcher(runoninit);
+        Matcher matcher = Pattern.compile("rtsp://[^\\s\"]+").matcher(runOn);
         if (matcher.find()) {
             info.setRtspSource(matcher.group());
             info.setIsCode("1");
@@ -190,19 +202,17 @@
             //ID
             String name = item.getName();
             info.setName(name);
-            String runoninit;
-            String runondemand = item.getConf().getRunondemand();
-            if (StringUtils.isNotEmpty(runondemand)) {
-                runoninit = item.getConf().getRunondemand();
+            String runOn;
+            if (StringUtils.isNotEmpty(item.getConf().getRunondemand())) {
+                runOn = item.getConf().getRunondemand();
                 info.setMode("0");
             } else {
-                runoninit = item.getConf().getRunoninit();
+                runOn = item.getConf().getRunoninit();
+                //runOn = item.getConf().getRunonready();
                 info.setMode("1");
             }
             //RTSP婧愬湴鍧�
-            String regex = "rtsp://[^\\s\"]+";
-            Pattern pattern = Pattern.compile(regex);
-            Matcher matcher = pattern.matcher(runoninit);
+            Matcher matcher = Pattern.compile("rtsp://[^\\s\"]+").matcher(runOn);
             if (matcher.find()) {
                 info.setRtspSource(matcher.group());
                 info.setIsCode("1");
@@ -211,9 +221,7 @@
                 info.setIsCode("0");
             }
             //浼犺緭鍗忚
-            regex = "-rtsp_transport\\s+(\\w+)";
-            pattern = Pattern.compile(regex);
-            matcher = pattern.matcher(runoninit);
+            matcher = Pattern.compile("-rtsp_transport\\s+(\\w+)").matcher(runOn);
             if (matcher.find()) {
                 info.setProtocol(matcher.group(1));
             }
@@ -296,16 +304,14 @@
                 info.setRemoteAddr(rtspSession.getRemoteAddr());
             }
             //RTSP婧愬湴鍧�
-            String runondemand = item.getConf().getRunondemand();
-            String runoninit;
-            if (StringUtils.isNotEmpty(runondemand)) {
-                runoninit = item.getConf().getRunondemand();
+            String runOn;
+            if (StringUtils.isNotEmpty(item.getConf().getRunondemand())) {
+                runOn = item.getConf().getRunondemand();
             } else {
-                runoninit = item.getConf().getRunoninit();
+                runOn = item.getConf().getRunoninit();
+                //runOn = item.getConf().getRunonready();
             }
-            String regex = "rtsp://[^\\s\"]+";
-            Pattern pattern = Pattern.compile(regex);
-            Matcher matcher = pattern.matcher(runoninit);
+            Matcher matcher = Pattern.compile("rtsp://[^\\s\"]+").matcher(runOn);
             if (matcher.find()) {
                 info.setRtspSource(matcher.group());
             } else {
@@ -316,7 +322,6 @@
             //鎷夋祦鏁伴噺
             List<Readers> readers = item.getReaders();
             info.setNum(readers.size());
-
 
             PushStreamInfoList.add(info);
         }
diff --git a/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java b/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java
index ebf5978..456fad4 100644
--- a/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/media/service/impl/VtduServiceImpl.java
@@ -2,12 +2,16 @@
 
 import java.util.List;
 
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.uuid.IdUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.media.mapper.VtduMapper;
 import com.ruoyi.media.domain.Vtdu;
 import com.ruoyi.media.service.IVtduService;
+
+import javax.annotation.Resource;
 
 /**
  * 娴佸獟浣撶鐞哠ervice涓氬姟灞傚鐞�
@@ -17,7 +21,7 @@
  */
 @Service
 public class VtduServiceImpl implements IVtduService {
-    @Autowired
+    @Resource
     private VtduMapper vtduMapper;
 
     /**
@@ -50,6 +54,8 @@
      */
     @Override
     public int insertVtdu(Vtdu vtdu) {
+        vtdu.setCreateBy(SecurityUtils.getUserId());
+        vtdu.setCreateTime(DateUtils.getNowDate());
         return vtduMapper.insertVtdu(vtdu);
     }
 
@@ -61,6 +67,8 @@
      */
     @Override
     public int updateVtdu(Vtdu vtdu) {
+        vtdu.setUpdateBy(SecurityUtils.getUserId());
+        vtdu.setUpdateTime(DateUtils.getNowDate());
         return vtduMapper.updateVtdu(vtdu);
     }
 
diff --git a/ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml b/ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml
index 30dd0fb..cfb9e36 100644
--- a/ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml
+++ b/ard-work/src/main/resources/mapper/vtdu/VtduMapper.xml
@@ -1,63 +1,104 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.media.mapper.VtduMapper">
-    
+
     <resultMap type="Vtdu" id="VtduResult">
-        <result property="name"    column="name"    />
-        <result property="rtspUrl"    column="rtsp_url"    />
-        <result property="isCode"    column="is_code"    />
-        <result property="codeType"    column="code_type"    />
+        <result property="name" column="name"/>
+        <result property="sourceUrl" column="source_url"/>
+        <result property="isCode" column="is_code"/>
+        <result property="codeType" column="code_type"/>
+        <result property="rtspUrl" column="rtsp_url"/>
+        <result property="rtmpUrl" column="rtmp_url"/>
+        <result property="webrtcUrl" column="webrtc_url"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
     </resultMap>
 
     <sql id="selectVtduVo">
-        select name, rtsp_url, is_code, code_type from vtdu
+        select name,
+               source_url,
+               is_code,
+               code_type,
+               rtsp_url,
+               rtmp_url,
+               webrtc_url,
+               create_by,
+               create_time,
+               update_by,
+               update_time
+        from vtdu
     </sql>
 
     <select id="selectVtduList" parameterType="Vtdu" resultMap="VtduResult">
         <include refid="selectVtduVo"/>
-        <where>  
-            <if test="name != null  and name != ''"> and name like '%'||#{name}||'%'</if>
-            <if test="rtspUrl != null  and rtspUrl != ''"> and rtsp_url = #{rtspUrl}</if>
-            <if test="isCode != null  and isCode != ''"> and is_code = #{isCode}</if>
-            <if test="codeType != null  and codeType != ''"> and code_type = #{codeType}</if>
+        <where>
+            <if test="name != null  and name != ''">and name like '%'||#{name}||'%'</if>
+            <if test="sourceUrl != null  and sourceUrl != ''">and source_url = #{sourceUrl}</if>
+            <if test="isCode != null  and isCode != ''">and is_code = #{isCode}</if>
+            <if test="codeType != null  and codeType != ''">and code_type = #{codeType}</if>
         </where>
     </select>
-    
+
     <select id="selectVtduByName" parameterType="String" resultMap="VtduResult">
         <include refid="selectVtduVo"/>
         where name = #{name}
     </select>
-        
+
     <insert id="insertVtdu" parameterType="Vtdu">
         insert into vtdu
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="name != null">name,</if>
-            <if test="rtspUrl != null">rtsp_url,</if>
+            <if test="sourceUrl != null">source_url,</if>
             <if test="isCode != null">is_code,</if>
             <if test="codeType != null">code_type,</if>
-         </trim>
+            <if test="rtspUrl != null">rtsp_url,</if>
+            <if test="rtmpUrl != null">rtmp_url,</if>
+            <if test="webrtcUrl != null">webrtc_url,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="name != null">#{name},</if>
-            <if test="rtspUrl != null">#{rtspUrl},</if>
+            <if test="sourceUrl != null">#{sourceUrl},</if>
             <if test="isCode != null">#{isCode},</if>
             <if test="codeType != null">#{codeType},</if>
-         </trim>
+            <if test="rtspUrl != null">#{rtspUrl},</if>
+            <if test="rtmpUrl != null">#{rtmpUrl},</if>
+            <if test="webrtcUrl != null">#{webrtcUrl},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
     </insert>
 
     <update id="updateVtdu" parameterType="Vtdu">
         update vtdu
         <trim prefix="SET" suffixOverrides=",">
-            <if test="rtspUrl != null">rtsp_url = #{rtspUrl},</if>
+            <if test="sourceUrl != null">source_url = #{sourceUrl},</if>
             <if test="isCode != null">is_code = #{isCode},</if>
             <if test="codeType != null">code_type = #{codeType},</if>
+            <if test="rtspUrl != null">rtsp_url = #{rtspUrl},</if>
+            <if test="rtmpUrl != null">rtmp_url = #{rtmpUrl},</if>
+            <if test="webrtcUrl != null">webrtc_url = #{webrtcUrl},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
         </trim>
         where name = #{name}
     </update>
 
     <delete id="deleteVtduByName" parameterType="String">
-        delete from vtdu where name = #{name}
+        delete
+        from vtdu
+        where name = #{name}
     </delete>
 
     <delete id="deleteVtduByNames" parameterType="String">
diff --git a/ard-work/src/main/resources/templates/preview.html b/ard-work/src/main/resources/templates/preview.html
index 49c1059..63871f9 100644
--- a/ard-work/src/main/resources/templates/preview.html
+++ b/ard-work/src/main/resources/templates/preview.html
@@ -153,14 +153,22 @@
     window.onload = function () {
         changeGrid(2, 2);
         chanMap.set("video1", "http://" + mediamtxHost + ":8889/164/");
-        chanMap.set("video2", "http://" + mediamtxHost + ":8889/165/");
-        chanMap.set("video3", "http://" + mediamtxHost + ":8889/245/");
+        chanMap.set("video2", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video3", "http://" + mediamtxHost + ":8889/164/");
         chanMap.set("video4", "http://" + mediamtxHost + ":8889/164/");
-        chanMap.set("video5", "http://" + mediamtxHost + ":8889/165/");
-        chanMap.set("video6", "http://" + mediamtxHost + ":8889/245/");
+        chanMap.set("video5", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video6", "http://" + mediamtxHost + ":8889/164/");
         chanMap.set("video7", "http://" + mediamtxHost + ":8889/164/");
-        chanMap.set("video8", "http://" + mediamtxHost + ":8889/165/");
-        chanMap.set("video9", "http://" + mediamtxHost + ":8889/245/");
+        chanMap.set("video8", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video9", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video10", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video11", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video12", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video13", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video14", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video15", "http://" + mediamtxHost + ":8889/164/");
+        chanMap.set("video16", "http://" + mediamtxHost + ":8889/164/");
+
         console.log(chanMap);
     }
     const linkToIceServers = (links) => (
diff --git a/lib/mediamtx/mediamtx.yml b/lib/mediamtx/mediamtx.yml
index 9dfc5b5..df30797 100644
--- a/lib/mediamtx/mediamtx.yml
+++ b/lib/mediamtx/mediamtx.yml
@@ -15,7 +15,7 @@
 writeTimeout: 10s
 # Size of the queue of outgoing packets.
 # A higher value allows to increase throughput, a lower value allows to save RAM.
-writeQueueSize: 512
+writeQueueSize: 8192
 # Maximum size of outgoing UDP packets.
 # This can be decreased to avoid fragmentation on networks with a low UDP MTU.
 udpMaxPayloadSize: 1472

--
Gitblit v1.9.3