[推流设备] 修复推流中重启服务导致无法继续播放

pull/1733/head
648540858 2024-12-27 10:42:40 +08:00
parent 3ea236efdd
commit 460f73555e
3 changed files with 66 additions and 65 deletions

View File

@ -106,9 +106,7 @@ public class MediaInfo {
}
}
JSONArray jsonArray = jsonObject.getJSONArray("tracks");
if (jsonArray.isEmpty()) {
return null;
}
if (!jsonArray.isEmpty()) {
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject trackJson = jsonArray.getJSONObject(i);
Integer channels = trackJson.getInteger("channels");
@ -166,6 +164,7 @@ public class MediaInfo {
}
}
}
}
return mediaInfo;
}

View File

@ -178,18 +178,20 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaServer, app, stream);
if (mediaList != null) {
if (mediaList.getInteger("code") == 0) {
JSONArray data = mediaList.getJSONArray("data");
if (data == null) {
JSONArray dataArray = mediaList.getJSONArray("data");
if (dataArray == null) {
return streamInfoList;
}
JSONObject mediaJSON = data.getJSONObject(0);
for (int i = 0; i < dataArray.size(); i++) {
JSONObject mediaJSON = dataArray.getJSONObject(0);
MediaInfo mediaInfo = MediaInfo.getInstance(mediaJSON, mediaServer, userSetting.getServerId());
StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, app, stream, mediaInfo, callId, true);
StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, mediaInfo.getApp(), mediaInfo.getStream(), mediaInfo, callId, true);
if (streamInfo != null) {
streamInfoList.add(streamInfo);
}
}
}
}
return streamInfoList;
}

View File

@ -48,9 +48,9 @@ public interface StreamPushMapper {
" from " +
" wvp_stream_push st " +
" LEFT join wvp_device_channel wdc " +
" on st.id = wdc.data_device_id " +
" on wdc.data_type = 2 and st.id = wdc.data_device_id " +
" WHERE " +
" wdc.data_type = 2 " +
" 1=1 " +
" <if test='query != null'> AND (st.app LIKE concat('%',#{query},'%') escape '/' OR st.stream LIKE concat('%',#{query},'%') escape '/' " +
" OR wdc.gb_device_id LIKE concat('%',#{query},'%') escape '/' OR wdc.gb_name LIKE concat('%',#{query},'%') escape '/')</if> " +
" <if test='pushing == true' > AND st.pushing=1</if>" +