Commit f0ff20a1 authored by Wolfram Gloger's avatar Wolfram Gloger Committed by Michael Niedermayer
Browse files

minor fixes for invalid audio data patch by (Wolfram Gloger: wmglo, dent med uni-muenchen de)

Originally committed as revision 4524 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 9450118b
...@@ -139,7 +139,7 @@ AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, ...@@ -139,7 +139,7 @@ AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size,
c->phase_mask= phase_count-1; c->phase_mask= phase_count-1;
c->linear= linear; c->linear= linear;
c->filter_length= FFMAX(ceil(filter_size/factor), 1); c->filter_length= FFMAX((int)ceil(filter_size/factor), 1);
c->filter_bank= av_mallocz(c->filter_length*(phase_count+1)*sizeof(FELEM)); c->filter_bank= av_mallocz(c->filter_length*(phase_count+1)*sizeof(FELEM));
av_build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<<FILTER_SHIFT, 1); av_build_filter(c->filter_bank, factor, c->filter_length, phase_count, 1<<FILTER_SHIFT, 1);
memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c->filter_length-1)*sizeof(FELEM)); memcpy(&c->filter_bank[c->filter_length*phase_count+1], c->filter_bank, (c->filter_length-1)*sizeof(FELEM));
......
...@@ -2188,20 +2188,24 @@ int av_write_header(AVFormatContext *s) ...@@ -2188,20 +2188,24 @@ int av_write_header(AVFormatContext *s)
/* init PTS generation */ /* init PTS generation */
for(i=0;i<s->nb_streams;i++) { for(i=0;i<s->nb_streams;i++) {
int64_t den = AV_NOPTS_VALUE;
st = s->streams[i]; st = s->streams[i];
switch (st->codec->codec_type) { switch (st->codec->codec_type) {
case CODEC_TYPE_AUDIO: case CODEC_TYPE_AUDIO:
av_frac_init(&st->pts, 0, 0, den = (int64_t)st->time_base.num * st->codec->sample_rate;
(int64_t)st->time_base.num * st->codec->sample_rate);
break; break;
case CODEC_TYPE_VIDEO: case CODEC_TYPE_VIDEO:
av_frac_init(&st->pts, 0, 0, den = (int64_t)st->time_base.num * st->codec->time_base.den;
(int64_t)st->time_base.num * st->codec->time_base.den);
break; break;
default: default:
break; break;
} }
if (den != AV_NOPTS_VALUE) {
if (den <= 0)
return AVERROR_INVALIDDATA;
av_frac_init(&st->pts, 0, 0, den);
}
} }
return 0; return 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment