diff --git a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java index b8da5678..c4a0615b 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java +++ b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java @@ -106,63 +106,62 @@ public class MediaInfo { } } JSONArray jsonArray = jsonObject.getJSONArray("tracks"); - if (jsonArray.isEmpty()) { - return null; - } - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject trackJson = jsonArray.getJSONObject(i); - Integer channels = trackJson.getInteger("channels"); - Integer codecId = trackJson.getInteger("codec_id"); - Integer codecType = trackJson.getInteger("codec_type"); - Integer sampleRate = trackJson.getInteger("sample_rate"); - Integer height = trackJson.getInteger("height"); - Integer width = trackJson.getInteger("width"); - Integer fps = trackJson.getInteger("fps"); - Integer loss = trackJson.getInteger("loss"); - Integer frames = trackJson.getInteger("frames"); - Long keyFrames = trackJson.getLongValue("key_frames"); - Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms"); - Long gop_size = trackJson.getLongValue("gop_size"); + if (!jsonArray.isEmpty()) { + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject trackJson = jsonArray.getJSONObject(i); + Integer channels = trackJson.getInteger("channels"); + Integer codecId = trackJson.getInteger("codec_id"); + Integer codecType = trackJson.getInteger("codec_type"); + Integer sampleRate = trackJson.getInteger("sample_rate"); + Integer height = trackJson.getInteger("height"); + Integer width = trackJson.getInteger("width"); + Integer fps = trackJson.getInteger("fps"); + Integer loss = trackJson.getInteger("loss"); + Integer frames = trackJson.getInteger("frames"); + Long keyFrames = trackJson.getLongValue("key_frames"); + Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms"); + Long gop_size = trackJson.getLongValue("gop_size"); - Long duration = trackJson.getLongValue("duration"); - if (channels != null) { - mediaInfo.setAudioChannels(channels); - } - if (sampleRate != null) { - mediaInfo.setAudioSampleRate(sampleRate); - } - if (height != null) { - mediaInfo.setHeight(height); - } - if (width != null) { - mediaInfo.setWidth(width); - } - if (fps != null) { - mediaInfo.setFps(fps); - } - if (loss != null) { - mediaInfo.setLoss(loss); - } - if (duration > 0L) { - mediaInfo.setDuration(duration); - } - if (codecId != null) { - switch (codecId) { - case 0: - mediaInfo.setVideoCodec("H264"); - break; - case 1: - mediaInfo.setVideoCodec("H265"); - break; - case 2: - mediaInfo.setAudioCodec("AAC"); - break; - case 3: - mediaInfo.setAudioCodec("G711A"); - break; - case 4: - mediaInfo.setAudioCodec("G711U"); - break; + Long duration = trackJson.getLongValue("duration"); + if (channels != null) { + mediaInfo.setAudioChannels(channels); + } + if (sampleRate != null) { + mediaInfo.setAudioSampleRate(sampleRate); + } + if (height != null) { + mediaInfo.setHeight(height); + } + if (width != null) { + mediaInfo.setWidth(width); + } + if (fps != null) { + mediaInfo.setFps(fps); + } + if (loss != null) { + mediaInfo.setLoss(loss); + } + if (duration > 0L) { + mediaInfo.setDuration(duration); + } + if (codecId != null) { + switch (codecId) { + case 0: + mediaInfo.setVideoCodec("H264"); + break; + case 1: + mediaInfo.setVideoCodec("H265"); + break; + case 2: + mediaInfo.setAudioCodec("AAC"); + break; + case 3: + mediaInfo.setAudioCodec("G711A"); + break; + case 4: + mediaInfo.setAudioCodec("G711U"); + break; + } } } } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java index 802b7eb6..dc665d32 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java @@ -178,15 +178,17 @@ 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); - MediaInfo mediaInfo = MediaInfo.getInstance(mediaJSON, mediaServer, userSetting.getServerId()); - StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, app, stream, mediaInfo, callId, true); - if (streamInfo != null) { - streamInfoList.add(streamInfo); + 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, mediaInfo.getApp(), mediaInfo.getStream(), mediaInfo, callId, true); + if (streamInfo != null) { + streamInfoList.add(streamInfo); + } } } } diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java index ce28fa9b..dfdb3421 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/dao/StreamPushMapper.java @@ -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 " + " 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 '/') " + " AND st.pushing=1" +