mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-12 10:07:26 +00:00
fix split slice
This commit is contained in:
parent
760dc31ee6
commit
e75818fb79
@ -761,7 +761,7 @@ static switch_status_t consume_h264_bitstream(h264_codec_context_t *context, swi
|
|||||||
frame->datalen = nalu->len;
|
frame->datalen = nalu->len;
|
||||||
context->nalu_current_index++;
|
context->nalu_current_index++;
|
||||||
|
|
||||||
if (nalu_type == 6 || nalu_type == 7 || nalu_type == 8 || context->nalus[context->nalu_current_index].len) {
|
if (context->nalus[context->nalu_current_index].len) {
|
||||||
frame->m = 0;
|
frame->m = 0;
|
||||||
return SWITCH_STATUS_MORE_DATA;
|
return SWITCH_STATUS_MORE_DATA;
|
||||||
}
|
}
|
||||||
@ -780,18 +780,24 @@ static switch_status_t consume_h264_bitstream(h264_codec_context_t *context, swi
|
|||||||
memcpy(p+2, nalu->eat, left);
|
memcpy(p+2, nalu->eat, left);
|
||||||
nalu->eat += left;
|
nalu->eat += left;
|
||||||
frame->datalen = left + 2;
|
frame->datalen = left + 2;
|
||||||
frame->m = 1;
|
|
||||||
context->nalu_current_index++;
|
context->nalu_current_index++;
|
||||||
|
|
||||||
|
if (!context->nalus[context->nalu_current_index].len) {
|
||||||
if (pkt->size > 0) av_packet_unref(pkt);
|
if (pkt->size > 0) av_packet_unref(pkt);
|
||||||
|
frame->m = 1;
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return SWITCH_STATUS_MORE_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
p[0] = nri | 28; // FU-A
|
p[0] = nri | 28; // FU-A
|
||||||
p[1] = start | nalu_type;
|
p[1] = start | nalu_type;
|
||||||
if (start) nalu->eat++;
|
if (start) nalu->eat++;
|
||||||
memcpy(p+2, nalu->eat, SLICE_SIZE - 2);
|
memcpy(p+2, nalu->eat, SLICE_SIZE - 2);
|
||||||
nalu->eat += (SLICE_SIZE - 2);
|
nalu->eat += (SLICE_SIZE - 2);
|
||||||
frame->datalen = SLICE_SIZE;
|
frame->datalen = SLICE_SIZE;
|
||||||
|
frame->m = 0;
|
||||||
return SWITCH_STATUS_MORE_DATA;
|
return SWITCH_STATUS_MORE_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1238,7 +1244,10 @@ GCC_DIAG_ON(deprecated-declarations)
|
|||||||
context->nalus[i].start = p;
|
context->nalus[i].start = p;
|
||||||
context->nalus[i].eat = p;
|
context->nalus[i].eat = p;
|
||||||
}
|
}
|
||||||
if (i >= MAX_NALUS - 2) break;
|
if (i >= MAX_NALUS - 2) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "TOO MANY SLICES!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context->nalus[i].len = p - context->nalus[i].start;
|
context->nalus[i].len = p - context->nalus[i].start;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user