Open winlinvip opened 2 years ago
描述(Description) 28181推流h264到SRS/develop, 用vlc播放RTMP卡顿花屏(由于NALU startcode=0x00 00 01 3Bytes)
startcode=0x00 00 01
4.0release和develop分支
重现Bug的步骤(How to replay bug?) ffmpeg编码输出的h264帧,sps与pps的startcode=0x000001(3Bytes),而非startcode=0x00000001(4Bytes) 将导致h264转flv时,sps/pps不完整,VLC播放卡花
期望行为(Expect)
if (video_data[index] == 0x00 && video_data[index+1] == 0x00 && - video_data[index+2] == 0x00 && video_data[index+3] == 0x01){ - list_index.push_back(index); - } + video_data[index+2] == 0x00 && video_data[index+3] == 0x01) { + index_node.pos = index; + index_node.len = 4; + list_index.push_back(index_node); + } + + if (video_data[index] == 0x00 && video_data[index+1] == 0x00 && + video_data[index+2] == 0x01) { + index_node.pos = index; + index_node.len = 3; + list_index.push_back(index_node); + } } //0001xxxxxxxxxx //xxxx0001xxxxxxx - uint32_t naluLen = size - cur_pos - 4; + uint32_t naluLen = size - index_node.pos - index_node.len; - char *frame = video_data + cur_pos + 4; + char *frame = video_data + index_node.pos + index_node.len; int frame_size = naluLen;
描述(Description) 28181推流h264到SRS/develop, 用vlc播放RTMP卡顿花屏(由于NALU
startcode=0x00 00 01
3Bytes)4.0release和develop分支
期望行为(Expect)