nvcodec: fix missing IDR data for nvh264enc and nvh265enc

This patch solves the symptom of non-presence of VPS, SPS and PPS data
in IDR frames.
The previously observed symptom is that it was not possible to perform
stream decoding if the receiver had not received this data.
If the receiver is launched before the transmitter, the fault does not
occur. Otherwise, it is not possible to decode the frames.

Example (respecting the call order):
$ gst-launch-1.0 videotestsrc ! nvh264enc ! rtph264pay ! udpsink
$ gst-launch-1.0 udpsrc address=localhost ! \
"application/x-rtp,encoding-name=(string)H264" ! rtph264depay ! \
h264parse ! nvh264dec ! queue ! videoconvert ! ximagesink

The stream will not be decoded.
This patch fixes this symptom.
It has been applied for nvh264enc and nvh265enc encoders.
This commit is contained in:
Paul Goulpié 2022-09-19 14:35:57 +02:00
parent 57292bfe78
commit 1c0494ed0b
2 changed files with 2 additions and 0 deletions

View file

@ -513,6 +513,7 @@ gst_nv_h264_enc_set_encoder_config (GstNvBaseEnc * nvenc,
h264_config->chromaFormatIDC = 3;
}
h264_config->repeatSPSPPS = 1;
h264_config->idrPeriod = config->gopLength;
h264_config->outputAUD = h264enc->aud;

View file

@ -556,6 +556,7 @@ gst_nv_h265_enc_set_encoder_config (GstNvBaseEnc * nvenc,
GST_LOG_OBJECT (h265enc, "setting parameters");
config->profileGUID = selected_profile;
hevc_config->level = level_idc;
hevc_config->repeatSPSPPS = 1;
hevc_config->idrPeriod = config->gopLength;
config->encodeCodecConfig.hevcConfig.chromaFormatIDC = 1;