Parcourir la source

add encoder mode parameter validation check

Alfonso Gamboa il y a 3 ans
Parent
commit
6b76e278e1
2 fichiers modifiés avec 32 ajouts et 16 suppressions
  1. 30 14
      SD_ROOT/wz_mini/etc/init.d/wz_user.sh
  2. 2 2
      file.chk

+ 30 - 14
SD_ROOT/wz_mini/etc/init.d/wz_user.sh

@@ -424,13 +424,21 @@ if [[ "$RTSP_HI_RES_ENABLED" == "true" ]]; then
 		echo "rtsp audio disabled"
         fi
 
-	if [[ "$RTSP_HI_RES_ENC_PARAMETER" != "" ]]; then
-		if [[ "$V2" == "true" ]]; then
-			watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:0:4:$RTSP_HI_RES_ENC_PARAMETER" > /dev/null 2>&1 &
-		else
-			watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:44:4:$RTSP_HI_RES_ENC_PARAMETER" > /dev/null 2>&1 &
-		fi
-	fi
+        if [[ "$RTSP_HI_RES_ENC_PARAMETER" != "" ]]; then
+                if [[ "$V2" == "true" ]]; then
+                        if [[ $RTSP_HI_RES_ENC_PARAMETER =~ "^[1|2|4|8]$" ]]; then
+                                watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:0:4:$RTSP_HI_RES_ENC_PARAMETER" > /dev/null 2>&1 &
+                        else
+                                echo "Invalid encoder value"
+                        fi
+                else
+                        if [[ $RTSP_HI_RES_ENC_PARAMETER =~ "^[1|2|4|8]$" ]]; then
+                                watch -n30 -t "/system/bin/impdbg --enc_rc_s 0:44:4:$RTSP_HI_RES_ENC_PARAMETER" > /dev/null 2>&1 &
+                        else
+                                echo "Invalid encoder value"
+                        fi
+                fi
+        fi
 
 	if [[ "$RTSP_HI_RES_MAX_BITRATE" != "" ]]; then
 		if [[ "$V2" == "true" ]]; then
@@ -493,13 +501,21 @@ if [[ "$RTSP_LOW_RES_ENABLED" == "true" ]]; then
                 echo "rtsp audio disabled"
         fi
 
-	if [[ "$RTSP_LOW_RES_ENC_PARAMETER" != "" ]]; then
-		if [[ "$V2" == "true" ]]; then
-			watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:0:4:$RTSP_LOW_RES_ENC_PARAMETER" > /dev/null 2>&1 &
-		else
-			watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:44:4:$RTSP_LOW_RES_ENC_PARAMETER" > /dev/null 2>&1 &
-		fi
-	fi
+        if [[ "$RTSP_LOW_RES_ENC_PARAMETER" != "" ]]; then
+                if [[ "$V2" == "true" ]]; then
+                        if [[ $RTSP_LOW_RES_ENC_PARAMETER =~ "^[1|2|4|8]$" ]]; then
+                                watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:0:4:$RTSP_LOW_RES_ENC_PARAMETER" > /dev/null 2>&1 &
+                        else
+                                echo "Invalid encoder value"
+                        fi
+                else
+                        if [[ $RTSP_LOW_RES_ENC_PARAMETER =~ "^[1|2|4|8]$" ]]; then
+                                watch -n30 -t "/system/bin/impdbg --enc_rc_s 1:44:4:$RTSP_LOW_RES_ENC_PARAMETER" > /dev/null 2>&1 &
+                        else
+                                echo "Invalid encoder value"
+                        fi
+                fi
+        fi
 
 	if [[ "$RTSP_LOW_RES_MAX_BITRATE" != "" ]]; then
 		if [[ "$V2" == "true" ]]; then

+ 2 - 2
file.chk

@@ -3,7 +3,7 @@ d41d8cd98f00b204e9800998ecf8427e  SD_ROOT/wz_mini/mnt/.gitignore
 34c6a4c3a941ff2becd9f487826d7692  SD_ROOT/wz_mini/etc/uvc.config
 58d3a10a80422e3aa1b49b046e17db5c  SD_ROOT/wz_mini/etc/init.d/wz_cam.sh
 4973a55d6eecc6f3559f42651ec2bee6  SD_ROOT/wz_mini/etc/init.d/v3_init.sh
-656765ee7c73eec0d5263f3f183226f5  SD_ROOT/wz_mini/etc/init.d/wz_user.sh
+827e7ba29e010ef751ffb88f36fc13e5  SD_ROOT/wz_mini/etc/init.d/wz_user.sh
 86082f8c1b7de18463731372bac630d1  SD_ROOT/wz_mini/etc/init.d/wz_post.sh
 e3034eac02d8eda9902ca9cf89f0a586  SD_ROOT/wz_mini/etc/inittab
 840aa9c26726201f7cffbf001bee193a  SD_ROOT/wz_mini/etc/uvc_jxf22.config
@@ -53,7 +53,7 @@ e6a6a9dd8ce138686083a3d4303cea40  SD_ROOT/wz_mini/bin/iperf3
 65510c6c4d0db4b4679fc92d1c617fdd  SD_ROOT/wz_mini/bin/rtmp-stream.sh
 5d1359af0c7c5d326b8682a62f910620  SD_ROOT/wz_mini/bin/strace
 516118bfcc0f0ddc93fb9339b3c6a315  SD_ROOT/wz_mini/bin/xtables-multi
-b61c2d71aea3064aec9004f49bbb1488  SD_ROOT/wz_mini/bin/gather_wz_logs.sh
+58e5eefc025e32d629b91b7b592f6852  SD_ROOT/wz_mini/bin/gather_wz_logs.sh
 097cd91a56f2b0caea1dd87ae0e51a54  SD_ROOT/wz_mini/bin/screen
 fbbc2a8f362d05fc31557b1a534b42c6  SD_ROOT/wz_mini/bin/wget
 35420095a770c9bb6177788842f55bba  SD_ROOT/wz_mini/bin/dropbearconvert