mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-23 07:43:28 +00:00
pcmdec: replace a reachable assert with an error check
Libavformat should not make any assumptions about values returned from other libraries. This assert is easily reachable by using a non-raw codec id.
This commit is contained in:
parent
cca4742a5e
commit
38893dc028
@ -74,7 +74,11 @@ static int pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id);
|
bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id);
|
||||||
assert(bps); // if false there IS a bug elsewhere (NOT in this function)
|
if (!bps) {
|
||||||
|
av_log(s, AV_LOG_ERROR, "Unknown number of bytes per sample.\n");
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
pkt->dts=
|
pkt->dts=
|
||||||
pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels);
|
pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user