You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Fixing a bug for newer versions of LibAV and FFmpeg, regarding error codes
This commit is contained in:
@@ -1142,6 +1142,11 @@ void FFmpegReader::ProcessAudioPacket(long int requested_frame, long int target_
|
|||||||
// No other thread is processing it. Mark the audio as processed (final)
|
// No other thread is processing it. Mark the audio as processed (final)
|
||||||
processed_audio_frames[f] = f;
|
processed_audio_frames[f] = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (target_frame == starting_frame_number) {
|
||||||
|
// This typically never happens, but just in case, remove the currently processing number
|
||||||
|
processing_audio_frames.erase(processing_audio_frames.find(target_frame));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove this packet
|
// Remove this packet
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ void FFmpegWriter::flush_encoders()
|
|||||||
|
|
||||||
// Write packet
|
// Write packet
|
||||||
error_code = av_interleaved_write_frame(oc, &pkt);
|
error_code = av_interleaved_write_frame(oc, &pkt);
|
||||||
if (error_code != 0) {
|
if (error_code < 0) {
|
||||||
AppendDebugMethod("FFmpegWriter::flush_encoders ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
AppendDebugMethod("FFmpegWriter::flush_encoders ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -662,7 +662,7 @@ void FFmpegWriter::flush_encoders()
|
|||||||
|
|
||||||
// Write packet
|
// Write packet
|
||||||
error_code = av_interleaved_write_frame(oc, &pkt);
|
error_code = av_interleaved_write_frame(oc, &pkt);
|
||||||
if (error_code != 0) {
|
if (error_code < 0) {
|
||||||
AppendDebugMethod("FFmpegWriter::flush_encoders ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
AppendDebugMethod("FFmpegWriter::flush_encoders ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1323,7 +1323,7 @@ void FFmpegWriter::write_audio_packets(bool final)
|
|||||||
|
|
||||||
/* write the compressed frame in the media file */
|
/* write the compressed frame in the media file */
|
||||||
int error_code = av_interleaved_write_frame(oc, &pkt);
|
int error_code = av_interleaved_write_frame(oc, &pkt);
|
||||||
if (error_code != 0)
|
if (error_code < 0)
|
||||||
{
|
{
|
||||||
AppendDebugMethod("FFmpegWriter::write_audio_packets ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
AppendDebugMethod("FFmpegWriter::write_audio_packets ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
||||||
}
|
}
|
||||||
@@ -1465,7 +1465,7 @@ void FFmpegWriter::write_video_packet(tr1::shared_ptr<Frame> frame, AVFrame* fra
|
|||||||
|
|
||||||
/* write the compressed frame in the media file */
|
/* write the compressed frame in the media file */
|
||||||
int error_code = av_interleaved_write_frame(oc, &pkt);
|
int error_code = av_interleaved_write_frame(oc, &pkt);
|
||||||
if (error_code != 0)
|
if (error_code < 0)
|
||||||
{
|
{
|
||||||
AppendDebugMethod("FFmpegWriter::write_video_packet ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
AppendDebugMethod("FFmpegWriter::write_video_packet ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
||||||
throw ErrorEncodingVideo("Error while writing raw video frame", frame->number);
|
throw ErrorEncodingVideo("Error while writing raw video frame", frame->number);
|
||||||
@@ -1538,7 +1538,7 @@ void FFmpegWriter::write_video_packet(tr1::shared_ptr<Frame> frame, AVFrame* fra
|
|||||||
|
|
||||||
/* write the compressed frame in the media file */
|
/* write the compressed frame in the media file */
|
||||||
int error_code = av_interleaved_write_frame(oc, &pkt);
|
int error_code = av_interleaved_write_frame(oc, &pkt);
|
||||||
if (error_code != 0)
|
if (error_code < 0)
|
||||||
{
|
{
|
||||||
AppendDebugMethod("FFmpegWriter::write_video_packet ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
AppendDebugMethod("FFmpegWriter::write_video_packet ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
||||||
throw ErrorEncodingVideo("Error while writing compressed video frame", frame->number);
|
throw ErrorEncodingVideo("Error while writing compressed video frame", frame->number);
|
||||||
|
|||||||
+1
-1
@@ -661,7 +661,7 @@ void FrameMapper::ResampleMappedAudio(tr1::shared_ptr<Frame> frame, long int ori
|
|||||||
int error_code = avcodec_fill_audio_frame(audio_frame, channels_in_frame, AV_SAMPLE_FMT_S16, (uint8_t *) frame_samples,
|
int error_code = avcodec_fill_audio_frame(audio_frame, channels_in_frame, AV_SAMPLE_FMT_S16, (uint8_t *) frame_samples,
|
||||||
audio_frame->nb_samples * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16) * channels_in_frame, 1);
|
audio_frame->nb_samples * av_get_bytes_per_sample(AV_SAMPLE_FMT_S16) * channels_in_frame, 1);
|
||||||
|
|
||||||
if (error_code != 0)
|
if (error_code < 0)
|
||||||
{
|
{
|
||||||
AppendDebugMethod("FrameMapper::ResampleMappedAudio ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
AppendDebugMethod("FrameMapper::ResampleMappedAudio ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code, "", -1, "", -1, "", -1, "", -1, "", -1);
|
||||||
throw ErrorEncodingVideo("Error while resampling audio in frame mapper", frame->number);
|
throw ErrorEncodingVideo("Error while resampling audio in frame mapper", frame->number);
|
||||||
|
|||||||
Reference in New Issue
Block a user