Write the whole first data packet along with the config packet in the codec extradata to write the header.