MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / append_flv_data

Function append_flv_data

libavformat/rtmpproto.c:2296–2331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2294}
2295
2296static int append_flv_data(RTMPContext *rt, RTMPPacket *pkt, int skip)
2297{
2298 int old_flv_size, ret;
2299 PutByteContext pbc;
2300 const uint8_t *data = pkt->data + skip;
2301 const int size = pkt->size - skip;
2302 uint32_t ts = pkt->timestamp;
2303
2304 if (pkt->type == RTMP_PT_AUDIO) {
2305 rt->has_audio = 1;
2306 } else if (pkt->type == RTMP_PT_VIDEO) {
2307 rt->has_video = 1;
2308 }
2309
2310 if (size > INT_MAX - 15)
2311 return AVERROR(ERANGE);
2312 old_flv_size = update_offset(rt, size + 15);
2313 if (old_flv_size < 0)
2314 return old_flv_size;
2315
2316 if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) {
2317 rt->flv_size = rt->flv_off = 0;
2318 return ret;
2319 }
2320 bytestream2_init_writer(&pbc, rt->flv_data, rt->flv_size);
2321 bytestream2_skip_p(&pbc, old_flv_size);
2322 bytestream2_put_byte(&pbc, pkt->type);
2323 bytestream2_put_be24(&pbc, size);
2324 bytestream2_put_be24(&pbc, ts);
2325 bytestream2_put_byte(&pbc, ts >> 24);
2326 bytestream2_put_be24(&pbc, 0);
2327 bytestream2_put_buffer(&pbc, data, size);
2328 bytestream2_put_be32(&pbc, size + RTMP_HEADER);
2329
2330 return 0;
2331}
2332
2333static int handle_notify(URLContext *s, RTMPPacket *pkt)
2334{

Callers 2

handle_notifyFunction · 0.85
get_packetFunction · 0.85

Calls 5

update_offsetFunction · 0.85
av_reallocpFunction · 0.85
bytestream2_init_writerFunction · 0.85
bytestream2_skip_pFunction · 0.85
bytestream2_put_bufferFunction · 0.85

Tested by

no test coverage detected