[推流设备] 修复推流中重启服务导致无法继续播放
parent
3ea236efdd
commit
460f73555e
|
@ -106,63 +106,62 @@ public class MediaInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONArray jsonArray = jsonObject.getJSONArray("tracks");
|
JSONArray jsonArray = jsonObject.getJSONArray("tracks");
|
||||||
if (jsonArray.isEmpty()) {
|
if (!jsonArray.isEmpty()) {
|
||||||
return null;
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
}
|
JSONObject trackJson = jsonArray.getJSONObject(i);
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
Integer channels = trackJson.getInteger("channels");
|
||||||
JSONObject trackJson = jsonArray.getJSONObject(i);
|
Integer codecId = trackJson.getInteger("codec_id");
|
||||||
Integer channels = trackJson.getInteger("channels");
|
Integer codecType = trackJson.getInteger("codec_type");
|
||||||
Integer codecId = trackJson.getInteger("codec_id");
|
Integer sampleRate = trackJson.getInteger("sample_rate");
|
||||||
Integer codecType = trackJson.getInteger("codec_type");
|
Integer height = trackJson.getInteger("height");
|
||||||
Integer sampleRate = trackJson.getInteger("sample_rate");
|
Integer width = trackJson.getInteger("width");
|
||||||
Integer height = trackJson.getInteger("height");
|
Integer fps = trackJson.getInteger("fps");
|
||||||
Integer width = trackJson.getInteger("width");
|
Integer loss = trackJson.getInteger("loss");
|
||||||
Integer fps = trackJson.getInteger("fps");
|
Integer frames = trackJson.getInteger("frames");
|
||||||
Integer loss = trackJson.getInteger("loss");
|
Long keyFrames = trackJson.getLongValue("key_frames");
|
||||||
Integer frames = trackJson.getInteger("frames");
|
Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms");
|
||||||
Long keyFrames = trackJson.getLongValue("key_frames");
|
Long gop_size = trackJson.getLongValue("gop_size");
|
||||||
Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms");
|
|
||||||
Long gop_size = trackJson.getLongValue("gop_size");
|
|
||||||
|
|
||||||
Long duration = trackJson.getLongValue("duration");
|
Long duration = trackJson.getLongValue("duration");
|
||||||
if (channels != null) {
|
if (channels != null) {
|
||||||
mediaInfo.setAudioChannels(channels);
|
mediaInfo.setAudioChannels(channels);
|
||||||
}
|
}
|
||||||
if (sampleRate != null) {
|
if (sampleRate != null) {
|
||||||
mediaInfo.setAudioSampleRate(sampleRate);
|
mediaInfo.setAudioSampleRate(sampleRate);
|
||||||
}
|
}
|
||||||
if (height != null) {
|
if (height != null) {
|
||||||
mediaInfo.setHeight(height);
|
mediaInfo.setHeight(height);
|
||||||
}
|
}
|
||||||
if (width != null) {
|
if (width != null) {
|
||||||
mediaInfo.setWidth(width);
|
mediaInfo.setWidth(width);
|
||||||
}
|
}
|
||||||
if (fps != null) {
|
if (fps != null) {
|
||||||
mediaInfo.setFps(fps);
|
mediaInfo.setFps(fps);
|
||||||
}
|
}
|
||||||
if (loss != null) {
|
if (loss != null) {
|
||||||
mediaInfo.setLoss(loss);
|
mediaInfo.setLoss(loss);
|
||||||
}
|
}
|
||||||
if (duration > 0L) {
|
if (duration > 0L) {
|
||||||
mediaInfo.setDuration(duration);
|
mediaInfo.setDuration(duration);
|
||||||
}
|
}
|
||||||
if (codecId != null) {
|
if (codecId != null) {
|
||||||
switch (codecId) {
|
switch (codecId) {
|
||||||
case 0:
|
case 0:
|
||||||
mediaInfo.setVideoCodec("H264");
|
mediaInfo.setVideoCodec("H264");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
mediaInfo.setVideoCodec("H265");
|
mediaInfo.setVideoCodec("H265");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
mediaInfo.setAudioCodec("AAC");
|
mediaInfo.setAudioCodec("AAC");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
mediaInfo.setAudioCodec("G711A");
|
mediaInfo.setAudioCodec("G711A");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
mediaInfo.setAudioCodec("G711U");
|
mediaInfo.setAudioCodec("G711U");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,15 +178,17 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
||||||
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaServer, app, stream);
|
JSONObject mediaList = zlmresTfulUtils.getMediaList(mediaServer, app, stream);
|
||||||
if (mediaList != null) {
|
if (mediaList != null) {
|
||||||
if (mediaList.getInteger("code") == 0) {
|
if (mediaList.getInteger("code") == 0) {
|
||||||
JSONArray data = mediaList.getJSONArray("data");
|
JSONArray dataArray = mediaList.getJSONArray("data");
|
||||||
if (data == null) {
|
if (dataArray == null) {
|
||||||
return streamInfoList;
|
return streamInfoList;
|
||||||
}
|
}
|
||||||
JSONObject mediaJSON = data.getJSONObject(0);
|
for (int i = 0; i < dataArray.size(); i++) {
|
||||||
MediaInfo mediaInfo = MediaInfo.getInstance(mediaJSON, mediaServer, userSetting.getServerId());
|
JSONObject mediaJSON = dataArray.getJSONObject(0);
|
||||||
StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, app, stream, mediaInfo, callId, true);
|
MediaInfo mediaInfo = MediaInfo.getInstance(mediaJSON, mediaServer, userSetting.getServerId());
|
||||||
if (streamInfo != null) {
|
StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, mediaInfo.getApp(), mediaInfo.getStream(), mediaInfo, callId, true);
|
||||||
streamInfoList.add(streamInfo);
|
if (streamInfo != null) {
|
||||||
|
streamInfoList.add(streamInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,9 @@ public interface StreamPushMapper {
|
||||||
" from " +
|
" from " +
|
||||||
" wvp_stream_push st " +
|
" wvp_stream_push st " +
|
||||||
" LEFT join wvp_device_channel wdc " +
|
" 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 " +
|
" 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 '/' " +
|
" <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> " +
|
" 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>" +
|
" <if test='pushing == true' > AND st.pushing=1</if>" +
|
||||||
|
|
Loading…
Reference in New Issue