[FFmpeg-devel] [PATCH] connect AVCodecContext.rtp_payload_size to x264_params_t.i_slice_max_size
Lyubomir Marinov
lyubomir.marinov at jitsi.org
Sun Sep 16 11:46:27 CEST 2012
Hey Michael,
On 15.09.2012, at 04:03, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sat, Sep 15, 2012 at 12:42:02AM +0300, Lyubomir Marinov wrote:
>> Dear FFmpeg developers,
>>
>> We at the Jitsi open-source VoIP and Instant Messaging client community would like to propose the following patch which allows instructing the FFmpeg x264 encoder through AVCodecContext to produce payload suitable for the H.264 RTP packetization-mode 0 i.e. single NAL unit per RTP packet:
>>
>
>> libx264.c | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>> c875f0cd07291c778e455664b9fcfcf4f600de1f libavcodec_libx264.c-rtp_payload_size.patch
>> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
>> index f2f8990..5efe69a 100644
>> --- a/libavcodec/libx264.c
>> +++ b/libavcodec/libx264.c
>> @@ -477,6 +477,14 @@ static av_cold int X264_init(AVCodecContext *avctx)
>> // x4->params.b_open_gop = !(avctx->flags & CODEC_FLAG_CLOSED_GOP);
>>
>> x4->params.i_slice_count = avctx->slices;
>> + /*
>> + * Allow x246 to be instructed through AVCodecContext about the maximum size
> ^^^^
> x264
Thank you very much for the timely and thorough review!
>> + * of the RTP payload. For example, this enables the production of payload
>> + * suitable for the H.264 RTP packetization-mode 0 i.e. single NAL unit per
>> + * RTP packet.
>> + */
>> + if (avctx->rtp_payload_size)
>> + x4->params.i_slice_max_size = avctx->rtp_payload_size;
>
> This should be before the x4->slice_max_size based setting of this
> field together with the other avctx based initialization
I see there is x4->params initialization based on avctx fields even after the assignment to i_slice_max_size. Additionally, if we put the newly-proposed assignment before the x4->slice_max_size based setting, it may be overridden by the latter. That's why the new patch puts the avctx->rtp_payload_size based setting in an else to avoid an unnecessary assignment.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libavcodec_libx264.c-rtp_payload_size.patch
Type: application/octet-stream
Size: 823 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120916/f18a1e75/attachment.obj>
-------------- next part --------------
We hope that the new patch aptly addresses your concerns.
Best regards,
Lyubomir
More information about the ffmpeg-devel
mailing list