sorry for my english.
In your code, absl::optional sps = webrtc::SpsParser::ParseSps(buffer + index.payload_start_offset, index.payload_size); buffer + index.payload_start_offset includes nalu type, but webrtc::SpsParser::ParseSps will read first byte as profile_idc, so sps.width and sps.height was never right, may you can fix it, that was confused.