From: Marton Balint <cus@passwd.hu> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH] avformat/rtmpproto: send proper status for response to play command Date: Wed, 20 Apr 2022 20:00:24 +0200 (CEST) Message-ID: <79555330-aebc-936a-a558-41909211f064@passwd.hu> (raw) In-Reply-To: <20220414210837.28916-1-cus@passwd.hu> On Thu, 14 Apr 2022, Marton Balint wrote: > This fixes referencing the uninitialized filename variable. > > Fixes ticket #9711. Will apply tomorrow. Regards, Marton > > Signed-off-by: Marton Balint <cus@passwd.hu> > --- > libavformat/rtmpproto.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c > index f97e3c3b8e..f0ef223f05 100644 > --- a/libavformat/rtmpproto.c > +++ b/libavformat/rtmpproto.c > @@ -1857,11 +1857,10 @@ static int write_begin(URLContext *s) > } > > static int write_status(URLContext *s, RTMPPacket *pkt, > - const char *status, const char *filename) > + const char *status, const char *description, const char *details) > { > RTMPContext *rt = s->priv_data; > RTMPPacket spkt = { 0 }; > - char statusmsg[128]; > uint8_t *pp; > int ret; > > @@ -1884,11 +1883,11 @@ static int write_status(URLContext *s, RTMPPacket *pkt, > ff_amf_write_field_name(&pp, "code"); > ff_amf_write_string(&pp, status); > ff_amf_write_field_name(&pp, "description"); > - snprintf(statusmsg, sizeof(statusmsg), > - "%s is now published", filename); > - ff_amf_write_string(&pp, statusmsg); > - ff_amf_write_field_name(&pp, "details"); > - ff_amf_write_string(&pp, filename); > + ff_amf_write_string(&pp, description); > + if (details) { > + ff_amf_write_field_name(&pp, "details"); > + ff_amf_write_string(&pp, details); > + } > ff_amf_write_object_end(&pp); > > spkt.size = pp - spkt.data; > @@ -1964,20 +1963,22 @@ static int send_invoke_response(URLContext *s, RTMPPacket *pkt) > pp = spkt.data; > ff_amf_write_string(&pp, "onFCPublish"); > } else if (!strcmp(command, "publish")) { > + char statusmsg[128]; > + snprintf(statusmsg, sizeof(statusmsg), "%s is now published", filename); > ret = write_begin(s); > if (ret < 0) > return ret; > > // Send onStatus(NetStream.Publish.Start) > return write_status(s, pkt, "NetStream.Publish.Start", > - filename); > + statusmsg, filename); > } else if (!strcmp(command, "play")) { > ret = write_begin(s); > if (ret < 0) > return ret; > rt->state = STATE_SENDING; > return write_status(s, pkt, "NetStream.Play.Start", > - filename); > + "playing stream", NULL); > } else { > if ((ret = ff_rtmp_packet_create(&spkt, RTMP_SYSTEM_CHANNEL, > RTMP_PT_INVOKE, 0, > -- > 2.31.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2022-04-20 18:00 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-14 21:08 Marton Balint 2022-04-20 18:00 ` Marton Balint [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=79555330-aebc-936a-a558-41909211f064@passwd.hu \ --to=cus@passwd.hu \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git