[FFmpeg-devel] [PATCH] connect AVCodecContext.rtp_payload_size to x264_params_t.i_slice_max_size

Michael Niedermayer michaelni at gmx.at
Mon Sep 17 21:37:28 CEST 2012


On Sun, Sep 16, 2012 at 12:46:27PM +0300, Lyubomir Marinov wrote:
> 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.

hmm, ok

patch applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120917/020780f1/attachment.asc>


More information about the ffmpeg-devel mailing list