Opened 4 months ago

#6522 new enhancement

Hardcoded publish type of rtmp publishing

Reported by: blackshadow4279 Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: rtmp, streaming, publish type
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Type of publishing in RTMP spec:
"live", "record", or "append".
record: The stream is published and the data is recorded to a new file.The file is stored on the server in a subdirectory within the directory that contains the server application. If the file already exists, it is overwritten.
append: The stream is published and the data is appended to a file. If no file is found, it is created.
live: Live data is published without
recording it in a file.

In https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/rtmpproto.c#L857 we have hardcoded type "live":

static int gen_publish(URLContext *s, RTMPContext *rt)
{
    RTMPPacket pkt;
    uint8_t *p;
    int ret;

    av_log(s, AV_LOG_DEBUG, "Sending publish command for '%s'\n", rt->playpath);

    if ((ret = ff_rtmp_packet_create(&pkt, RTMP_SOURCE_CHANNEL, RTMP_PT_INVOKE,
                                     0, 30 + strlen(rt->playpath))) < 0)
        return ret;

    pkt.extra = rt->stream_id;

    p = pkt.data;
    ff_amf_write_string(&p, "publish");
    ff_amf_write_number(&p, ++rt->nb_invokes);
    ff_amf_write_null(&p);
    ff_amf_write_string(&p, rt->playpath);
    ff_amf_write_string(&p, "live");

    return rtmp_send_packet(rt, &pkt, 1);
}

For myself, of course, I will recompile, but I hope that it will be useful to someone.

Change History (0)

Note: See TracTickets for help on using tickets.