Definition at line 286 of file switch_packetizer.c.
References switch_frame::data, switch_frame::datalen, our_h264_nalu_s::eat, our_h264_nalu_s::len, switch_frame::m, h264_packetizer_s::nalu_current_index, h264_packetizer_s::nalus, h264_packetizer_s::pps, h264_packetizer_s::pps_len, h264_packetizer_s::pps_sent, SFF_CNG, h264_packetizer_s::slice_size, h264_packetizer_s::sps, h264_packetizer_s::sps_len, h264_packetizer_s::sps_sent, SPT_H264_BITSTREAM, SPT_H264_SIZED_BITSTREAM, our_h264_nalu_s::start, SWITCH_CHANNEL_LOG, switch_clear_flag, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_FALSE, SWITCH_STATUS_MORE_DATA, SWITCH_STATUS_SUCCESS, and h264_packetizer_s::type.
291 uint8_t nalu_hdr = 0;
292 uint8_t nalu_type = 0;
295 uint8_t *p = frame->
data;
296 uint8_t start = nalu->
start == nalu->
eat ? 0x80 : 0;
297 int n = nalu->
len / slice_size + 1;
298 int real_slice_size = nalu->
len / n + 1 + 2;
300 if (nalu->
start == NULL) {
305 nalu_hdr = *(uint8_t *)(nalu->
start);
306 nalu_type = nalu_hdr & 0x1f;
307 nri = nalu_hdr & 0x60;
309 if (real_slice_size > slice_size) real_slice_size = slice_size;
310 if (frame->
datalen < slice_size) {
316 if (nalu_type == 0x05) {
331 }
else if (nalu_type == 0x07) {
333 }
else if (nalu_type == 0x08) {
338 if (nalu->
len <= slice_size) {
352 if (nalu_type == 0x05) {
360 if (left <= (real_slice_size - 2)) {
362 p[1] = 0x40 | nalu_type;
363 memcpy(p+2, nalu->
eat, left);
377 p[1] = start | nalu_type;
378 if (start) nalu->
eat++;
379 memcpy(p+2, nalu->
eat, real_slice_size - 2);
380 nalu->
eat += (real_slice_size - 2);
381 frame->
datalen = real_slice_size;
#define SWITCH_CHANNEL_LOG
our_h264_nalu_t nalus[MAX_NALUS]
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
switch_packetizer_bitstream_t type
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.