| 2270 | } |
| 2271 | |
| 2272 | static int update_offset(RTMPContext *rt, int size) |
| 2273 | { |
| 2274 | int old_flv_size; |
| 2275 | |
| 2276 | if (size < 0) |
| 2277 | return AVERROR(EINVAL); |
| 2278 | |
| 2279 | // generate packet header and put data into buffer for FLV demuxer |
| 2280 | if (rt->flv_off < rt->flv_size) { |
| 2281 | // There is old unread data in the buffer, thus append at the end |
| 2282 | if (rt->flv_size > INT_MAX - size) |
| 2283 | return AVERROR(ERANGE); |
| 2284 | old_flv_size = rt->flv_size; |
| 2285 | rt->flv_size += size; |
| 2286 | } else { |
| 2287 | // All data has been read, write the new data at the start of the buffer |
| 2288 | old_flv_size = 0; |
| 2289 | rt->flv_size = size; |
| 2290 | rt->flv_off = 0; |
| 2291 | } |
| 2292 | |
| 2293 | return old_flv_size; |
| 2294 | } |
| 2295 | |
| 2296 | static int append_flv_data(RTMPContext *rt, RTMPPacket *pkt, int skip) |
| 2297 | { |
no outgoing calls
no test coverage detected