From 94140a12d3751ce69fc63c3dfd63c17cb0523d97 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 25 Aug 2026 10:24:23 -0400 Subject: [PATCH] MT#65420 add height/width fields to structs Change-Id: I9f8ba35ef346b77241758632812da240fab82936 --- daemon/codec.c | 17 ++++++++++++++++- lib/codeclib.h | 9 +++++++++ lib/rtplib.h | 5 ++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/daemon/codec.c b/daemon/codec.c index b23f8d1ce..c5c999d52 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -2985,10 +2985,16 @@ void codec_init_payload_type(rtp_payload_type *pt, enum media_type type) { if (def) { if (!pt->clock_rate) pt->clock_rate = def->default_clockrate; + if (!pt->time_base) + pt->time_base = def->default_fps ?: pt->clock_rate; if (!pt->channels) pt->channels = def->default_channels; if (pt->ptime <= 0) pt->ptime = def->default_ptime; + if (!pt->height) + pt->height = def->default_height; + if (!pt->width) + pt->width = def->default_width; if (!pt->format_parameters.s && def->default_fmtp) pt->format_parameters = STR(def->default_fmtp); @@ -4443,11 +4449,19 @@ static struct ssrc_entry *__ssrc_handler_transcode_new(void *p) { .clockrate = h->source_pt.clock_rate, .channels = h->source_pt.channels, .format = -1, + .width = h->source_pt.width, + .height = h->source_pt.height, + .pix_fmt = -1, + .time_base = h->source_pt.time_base, }; format_t enc_format = { .clockrate = h->dest_pt.clock_rate, .channels = h->dest_pt.channels, .format = -1, + .width = h->dest_pt.width, + .height = h->dest_pt.height, + .pix_fmt = -1, + .time_base = h->dest_pt.time_base, }; // see if there's a complete codec chain usable for this @@ -5184,7 +5198,8 @@ static rtp_payload_type *codec_make_payload_type_sup(const str *codec_str, struc goto err; if (!ret->codec_def->support_encoding) goto err; - if (ret->codec_def->default_channels <= 0 || ret->codec_def->default_clockrate < 0) + if ((ret->codec_def->default_channels <= 0 || ret->codec_def->default_clockrate < 0) + && (ret->codec_def->default_width <= 0 || ret->codec_def->default_height < 0)) goto err; return ret; diff --git a/lib/codeclib.h b/lib/codeclib.h index a35bf1524..f06beec63 100644 --- a/lib/codeclib.h +++ b/lib/codeclib.h @@ -199,6 +199,9 @@ struct codec_def_s { const char *avcodec_name_dec; int default_clockrate; int default_channels; + int default_width; + int default_height; + int default_fps; int default_bitrate; int default_ptime; int minimum_ptime; @@ -254,6 +257,12 @@ struct format_s { int clockrate; int channels; int format; // enum AVSampleFormat + + int height; + int width; + int pix_fmt; // enum AVPixelFormat + + int time_base; // sample rate, or fps }; struct resample_s { diff --git a/lib/rtplib.h b/lib/rtplib.h index c554771bb..4c0f4ea59 100644 --- a/lib/rtplib.h +++ b/lib/rtplib.h @@ -102,9 +102,12 @@ struct rtp_payload_type { str encoding_with_params; // "opus/48000/2" str encoding_with_full_params; // "opus/48000/1" str encoding; // "opus" - unsigned int clock_rate; // 48000 + unsigned int clock_rate; // 48000 or 90000 str encoding_parameters; // "2" int channels; // 2 + int width; + int height; + unsigned int time_base; // 48000 or 30 str format_parameters; // value of a=fmtp str codec_opts; // extra codec-specific options GQueue rtcp_fb; // a=rtcp-fb:...