History

avformat/rtpenc: Add flag AVFMT_NODIMENSIONS.

Not all rtp formats require the video dimensions to be available up front. H264 and HEVC will send them as stream parameters. The flag is restrictive and prevents RTP repacketization without parsing the codec information out of the stream. This change checks to see if the codec parameters are available on the rtp formats that need it.

Koushik Dutta committed 1 year ago

Commit 2657e161 parent 5fac8d01 file · +9 −1Browse files

Unified · Split

libavformat/rtpenc.c+9−1
@@ -635,10 +635,18 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt) · 634 unmodified lines
635 rtp_send_ilbc(s1, pkt->data, size);635 rtp_send_ilbc(s1, pkt->data, size);
636 break;636 break;
637 case AV_CODEC_ID_MJPEG:637 case AV_CODEC_ID_MJPEG:
638 if (st->codecpar->width <= 0 || st->codecpar->height <= 0) {
639 av_log(s1, AV_LOG_ERROR, "dimensions not set\n");
640 return AVERROR(EINVAL);
641 }
638 ff_rtp_send_jpeg(s1, pkt->data, size);642 ff_rtp_send_jpeg(s1, pkt->data, size);
639 break;643 break;
640 case AV_CODEC_ID_BITPACKED:644 case AV_CODEC_ID_BITPACKED:
641 case AV_CODEC_ID_RAWVIDEO: {645 case AV_CODEC_ID_RAWVIDEO: {
646 if (st->codecpar->width <= 0 || st->codecpar->height <= 0) {
647 av_log(s1, AV_LOG_ERROR, "dimensions not set\n");
648 return AVERROR(EINVAL);
649 }
642 int interlaced = st->codecpar->field_order != AV_FIELD_PROGRESSIVE;650 int interlaced = st->codecpar->field_order != AV_FIELD_PROGRESSIVE;
643 651
644 ff_rtp_send_raw_rfc4175(s1, pkt->data, size, interlaced, 0);652 ff_rtp_send_raw_rfc4175(s1, pkt->data, size, interlaced, 0);
@@ -685,5 +693,5 @@ const FFOutputFormat ff_rtp_muxer = { · 40 unmodified lines
685 .write_packet = rtp_write_packet,693 .write_packet = rtp_write_packet,
686 .write_trailer = rtp_write_trailer,694 .write_trailer = rtp_write_trailer,
687 .p.priv_class = &rtp_muxer_class,695 .p.priv_class = &rtp_muxer_class,
688 .p.flags = AVFMT_TS_NONSTRICT,696 .p.flags = AVFMT_NODIMENSIONS | AVFMT_TS_NONSTRICT,
689};697};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t