| | |
| | | * @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); |
| | | //不管谁拉流都判断流媒体中是否存在 |
| | |
| | | * @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) { |
| | |
| | | */ |
| | | 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)); |
| | | } |
| | | } |
| | | |