Commit efcd77078edb25ed211225d954245f30507d1585
1 parent
fcf64ffa
修改RTP端口计算方法,确保分配偶数端口
Showing
1 changed file
with
7 additions
and
4 deletions
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMUtils.java
| @@ -36,7 +36,7 @@ public class ZLMUtils { | @@ -36,7 +36,7 @@ public class ZLMUtils { | ||
| 36 | System.out.println(newPort); | 36 | System.out.println(newPort); |
| 37 | System.out.println(jsonObject.toJSONString()); | 37 | System.out.println(jsonObject.toJSONString()); |
| 38 | return newPort; | 38 | return newPort; |
| 39 | - }else { | 39 | + } else { |
| 40 | return getNewRTPPort(ssrc); | 40 | return getNewRTPPort(ssrc); |
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| @@ -48,11 +48,14 @@ public class ZLMUtils { | @@ -48,11 +48,14 @@ public class ZLMUtils { | ||
| 48 | udpPortRangeArray[1] = Integer.parseInt(udpPortRangeStrArray[1]); | 48 | udpPortRangeArray[1] = Integer.parseInt(udpPortRangeStrArray[1]); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | - if (currentPort == 0 || currentPort ++ > udpPortRangeArray[1]) { | 51 | + if (currentPort == 0 || currentPort++ > udpPortRangeArray[1]) { |
| 52 | currentPort = udpPortRangeArray[0]; | 52 | currentPort = udpPortRangeArray[0]; |
| 53 | return udpPortRangeArray[0]; | 53 | return udpPortRangeArray[0]; |
| 54 | - }else { | ||
| 55 | - return currentPort ++; | 54 | + } else { |
| 55 | + if (currentPort % 2 == 1) { | ||
| 56 | + currentPort++; | ||
| 57 | + } | ||
| 58 | + return currentPort++; | ||
| 56 | } | 59 | } |
| 57 | } | 60 | } |
| 58 | } | 61 | } |