mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-11 09:19:35 +00:00
Stop reading audio input packets if AVERROR_INVALIDDATA is received.
There are some audio files that cause swr_convert to crash otherwise.
This commit is contained in:
parent
50b10ba0bf
commit
c1c3e4af5b
@ -275,9 +275,11 @@ AudioPlayerLoader::ReadResult FFMpegLoader::readMore(QByteArray &result, int64 &
|
|||||||
|
|
||||||
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
|
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
|
||||||
LOG(("Audio Error: Unable to avcodec_send_packet() file '%1', data size '%2', error %3, %4").arg(file.name()).arg(data.size()).arg(res).arg(av_make_error_string(err, sizeof(err), res)));
|
LOG(("Audio Error: Unable to avcodec_send_packet() file '%1', data size '%2', error %3, %4").arg(file.name()).arg(data.size()).arg(res).arg(av_make_error_string(err, sizeof(err), res)));
|
||||||
if (res == AVERROR_INVALIDDATA) {
|
// There is a sample voice message where skipping such packet
|
||||||
return ReadResult::NotYet; // try to skip bad packet
|
// results in a crash (read_access to nullptr) in swr_convert().
|
||||||
}
|
//if (res == AVERROR_INVALIDDATA) {
|
||||||
|
// return ReadResult::NotYet; // try to skip bad packet
|
||||||
|
//}
|
||||||
return ReadResult::Error;
|
return ReadResult::Error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,9 +149,11 @@ AudioPlayerLoader::ReadResult ChildFFMpegLoader::readMore(QByteArray &result, in
|
|||||||
|
|
||||||
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
|
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
|
||||||
LOG(("Audio Error: Unable to avcodec_send_packet() file '%1', data size '%2', error %3, %4").arg(file.name()).arg(data.size()).arg(res).arg(av_make_error_string(err, sizeof(err), res)));
|
LOG(("Audio Error: Unable to avcodec_send_packet() file '%1', data size '%2', error %3, %4").arg(file.name()).arg(data.size()).arg(res).arg(av_make_error_string(err, sizeof(err), res)));
|
||||||
if (res == AVERROR_INVALIDDATA) {
|
// There is a sample voice message where skipping such packet
|
||||||
return ReadResult::NotYet; // try to skip bad packet
|
// results in a crash (read_access to nullptr) in swr_convert().
|
||||||
}
|
//if (res == AVERROR_INVALIDDATA) {
|
||||||
|
// return ReadResult::NotYet; // try to skip bad packet
|
||||||
|
//}
|
||||||
return ReadResult::Error;
|
return ReadResult::Error;
|
||||||
}
|
}
|
||||||
FFMpeg::freePacket(&packet);
|
FFMpeg::freePacket(&packet);
|
||||||
|
Loading…
Reference in New Issue
Block a user