mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/mpegtsenc: check that not only first pts but also first dts is valid
Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
parent
27e8a6c44b
commit
be4ff0f1b2
|
@ -232,7 +232,7 @@ typedef struct MpegTSWriteStream {
|
||||||
int cc;
|
int cc;
|
||||||
int discontinuity;
|
int discontinuity;
|
||||||
int payload_size;
|
int payload_size;
|
||||||
int first_pts_checked; ///< first pts check needed
|
int first_timestamp_checked; ///< first pts/dts check needed
|
||||||
int prev_payload_key;
|
int prev_payload_key;
|
||||||
int64_t payload_pts;
|
int64_t payload_pts;
|
||||||
int64_t payload_dts;
|
int64_t payload_dts;
|
||||||
|
@ -1699,11 +1699,11 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
|
||||||
dts += delay;
|
dts += delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ts_st->first_pts_checked && pts == AV_NOPTS_VALUE) {
|
if (!ts_st->first_timestamp_checked && (pts == AV_NOPTS_VALUE || dts == AV_NOPTS_VALUE)) {
|
||||||
av_log(s, AV_LOG_ERROR, "first pts value must be set\n");
|
av_log(s, AV_LOG_ERROR, "first pts and dts value must be set\n");
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
ts_st->first_pts_checked = 1;
|
ts_st->first_timestamp_checked = 1;
|
||||||
|
|
||||||
if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
|
if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
|
||||||
const uint8_t *p = buf, *buf_end = p + size;
|
const uint8_t *p = buf, *buf_end = p + size;
|
||||||
|
|
Loading…
Reference in New Issue