X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=shared%2Fmux.cpp;fp=shared%2Fmux.cpp;h=adec53de7923171842d90822a7ec8600b9e78fd0;hp=e122e2bb32c998556c377291c1d1d513badd9e98;hb=9ffd4f03f314cc6e0254449593def95c9bc203d6;hpb=a3b76e5ad9493b0af08fdcbe6d6b689d91496f85 diff --git a/shared/mux.cpp b/shared/mux.cpp index e122e2b..adec53d 100644 --- a/shared/mux.cpp +++ b/shared/mux.cpp @@ -53,7 +53,7 @@ Mux::Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const AVStream *avstream_video = avformat_new_stream(avctx, nullptr); if (avstream_video == nullptr) { fprintf(stderr, "avformat_new_stream() failed\n"); - exit(1); + abort(); } avstream_video->time_base = AVRational{1, time_base}; avstream_video->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; @@ -94,12 +94,12 @@ Mux::Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const AVStream *avstream_audio = avformat_new_stream(avctx, nullptr); if (avstream_audio == nullptr) { fprintf(stderr, "avformat_new_stream() failed\n"); - exit(1); + abort(); } avstream_audio->time_base = AVRational{1, time_base}; if (avcodec_parameters_copy(avstream_audio->codecpar, audio_codecpar) < 0) { fprintf(stderr, "avcodec_parameters_copy() failed\n"); - exit(1); + abort(); } streams.push_back(avstream_audio); } @@ -108,7 +108,7 @@ Mux::Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const AVStream *avstream_subtitles = avformat_new_stream(avctx, nullptr); if (avstream_subtitles == nullptr) { fprintf(stderr, "avformat_new_stream() failed\n"); - exit(1); + abort(); } avstream_subtitles->time_base = AVRational{1, time_base}; avstream_subtitles->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; @@ -125,7 +125,7 @@ Mux::Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const } if (avformat_write_header(avctx, &options) < 0) { fprintf(stderr, "avformat_write_header() failed\n"); - exit(1); + abort(); } for (MuxMetrics *metric : metrics) { metric->metric_written_bytes += avctx->pb->pos; @@ -166,7 +166,7 @@ void Mux::add_packet(const AVPacket &pkt, int64_t pts, int64_t dts, AVRational t av_init_packet(&pkt_copy); if (av_packet_ref(&pkt_copy, &pkt) < 0) { fprintf(stderr, "av_copy_packet() failed\n"); - exit(1); + abort(); } if (stream_index_override != -1) { pkt_copy.stream_index = stream_index_override;