liusuyi
2025-03-11 de7cddcd9a5597ac281fbd619f4f0bba09772386
ard-work/src/main/java/com/ard/tianyu/websocket/handler/UavStreamManager.java
@@ -42,7 +42,7 @@
     * @param boxSn  盒子序列号
     * @param userId 用户ID
     */
    public void startPullStream(String boxSn, Long userId) {
    public void subscribe(String boxSn, Long userId) {
        String webrtcUrl = "";
        STREAM_USER_MAP.computeIfAbsent(boxSn, k -> ConcurrentHashMap.newKeySet()).add(userId);
        //不管谁拉流都判断流媒体中是否存在
@@ -68,7 +68,7 @@
     * @param boxSn  盒子序列号
     * @param userId 用户ID
     */
    public void stopPullStream(String boxSn, Long userId) {
    public void unsubscribe(String boxSn, Long userId) {
        synchronized (this) {
            Set<Long> users = STREAM_USER_MAP.get(boxSn);
            if (users == null) {
@@ -102,7 +102,7 @@
     */
    public void stopAllPullStreamByUser(Long userId) {
        synchronized (this) {
            STREAM_USER_MAP.forEach((boxSn, users) -> stopPullStream(boxSn, userId));
            STREAM_USER_MAP.forEach((boxSn, users) -> unsubscribe(boxSn, userId));
        }
    }