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

Function write_packet

fftools/ffmpeg_mux.c:209–248  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207}
208
209static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
210{
211 MuxStream *ms = ms_from_ost(ost);
212 AVFormatContext *s = mux->fc;
213 int64_t fs;
214 uint64_t frame_num;
215 int ret;
216
217 fs = filesize(s->pb);
218 atomic_store(&mux->last_filesize, fs);
219 if (fs >= mux->limit_filesize) {
220 ret = AVERROR_EOF;
221 goto fail;
222 }
223
224 ret = mux_fixup_ts(mux, ms, pkt);
225 if (ret < 0)
226 goto fail;
227
228 ms->data_size_mux += pkt->size;
229 frame_num = atomic_fetch_add(&ost->packets_written, 1);
230
231 pkt->stream_index = ost->index;
232
233 if (ms->stats.io)
234 enc_stats_write(ost, &ms->stats, NULL, pkt, frame_num);
235
236 ret = av_interleaved_write_frame(s, pkt);
237 if (ret < 0) {
238 av_log(ost, AV_LOG_ERROR,
239 "Error submitting a packet to the muxer: %s\n",
240 av_err2str(ret));
241 goto fail;
242 }
243
244 return 0;
245fail:
246 av_packet_unref(pkt);
247 return ret;
248}
249
250static int sync_queue_process(Muxer *mux, MuxStream *ms, AVPacket *pkt, int *stream_eof)
251{

Callers 1

sync_queue_processFunction · 0.70

Calls 7

ms_from_ostFunction · 0.85
filesizeFunction · 0.85
mux_fixup_tsFunction · 0.85
enc_stats_writeFunction · 0.85
av_logFunction · 0.85
av_packet_unrefFunction · 0.85

Tested by

no test coverage detected