Message ID | 1588045757-25182-1-git-send-email-lance.lmwang@gmail.com |
---|---|
State | Accepted |
Commit | 386dbf5726368783ce4c4ae057885d873380f60c |
Headers | show |
Series | [FFmpeg-devel,1/2] avformat/vividas: simplify, use av_rescale_q() instead | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On Tue, Apr 28, 2020 at 11:49:16AM +0800, lance.lmwang@gmail.com wrote: > From: Limin Wang <lance.lmwang@gmail.com> > > note it'll cause a small difference in accuracy for the pts, please see the testing result below: > $ wget http://samples.ffmpeg.org/archive/all/unknown+unknown+unknown+unknown+5029_paramount_en_1250.viv > $ ./ffmpeg -t 0.04 -i ./unknown+unknown+unknown+unknown+5029_paramount_en_1250.viv -f null - > old: > pts: 522 > pts: 1044 > pts: 1567 > pts: 3918 > pts: 8097 > pts: 12277 > pts: 16457 > ... > > new: > pts: 522 > pts: 1045 > pts: 1567 > pts: 3918 > pts: 8098 > pts: 12278 > pts: 16457 > ... > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > --- > libavformat/vividas.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/vividas.c b/libavformat/vividas.c > index 4f54a4302e..b0f9f35ac2 100644 > --- a/libavformat/vividas.c > +++ b/libavformat/vividas.c > @@ -646,7 +646,7 @@ static int viv_read_packet(AVFormatContext *s, > pkt->stream_index = 1; > astream = s->streams[pkt->stream_index]; > > - pkt->pts = av_rescale(viv->audio_sample, astream->time_base.den, astream->time_base.num) / astream->codecpar->sample_rate; > + pkt->pts = av_rescale_q(viv->audio_sample, av_make_q(1, astream->codecpar->sample_rate), astream->time_base); > viv->audio_sample += viv->audio_subpackets[viv->current_audio_subpacket].pcm_bytes / 2 / astream->codecpar->channels; > pkt->flags |= AV_PKT_FLAG_KEY; > viv->current_audio_subpacket++; ping the patchset. > -- > 2.21.0 >
On Tue, Apr 28, 2020 at 11:49:16AM +0800, lance.lmwang@gmail.com wrote: > From: Limin Wang <lance.lmwang@gmail.com> > > note it'll cause a small difference in accuracy for the pts, please see the testing result below: > $ wget http://samples.ffmpeg.org/archive/all/unknown+unknown+unknown+unknown+5029_paramount_en_1250.viv > $ ./ffmpeg -t 0.04 -i ./unknown+unknown+unknown+unknown+5029_paramount_en_1250.viv -f null - > old: > pts: 522 > pts: 1044 > pts: 1567 > pts: 3918 > pts: 8097 > pts: 12277 > pts: 16457 > ... > > new: > pts: 522 > pts: 1045 > pts: 1567 > pts: 3918 > pts: 8098 > pts: 12278 > pts: 16457 > ... > > Signed-off-by: Limin Wang <lance.lmwang@gmail.com> > --- > libavformat/vividas.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/vividas.c b/libavformat/vividas.c > index 4f54a4302e..b0f9f35ac2 100644 > --- a/libavformat/vividas.c > +++ b/libavformat/vividas.c > @@ -646,7 +646,7 @@ static int viv_read_packet(AVFormatContext *s, > pkt->stream_index = 1; > astream = s->streams[pkt->stream_index]; > > - pkt->pts = av_rescale(viv->audio_sample, astream->time_base.den, astream->time_base.num) / astream->codecpar->sample_rate; > + pkt->pts = av_rescale_q(viv->audio_sample, av_make_q(1, astream->codecpar->sample_rate), astream->time_base); > viv->audio_sample += viv->audio_subpackets[viv->current_audio_subpacket].pcm_bytes / 2 / astream->codecpar->channels; > pkt->flags |= AV_PKT_FLAG_KEY; > viv->current_audio_subpacket++; > -- > 2.21.0 > will apply the patchset tomorrow.
diff --git a/libavformat/vividas.c b/libavformat/vividas.c index 4f54a4302e..b0f9f35ac2 100644 --- a/libavformat/vividas.c +++ b/libavformat/vividas.c @@ -646,7 +646,7 @@ static int viv_read_packet(AVFormatContext *s, pkt->stream_index = 1; astream = s->streams[pkt->stream_index]; - pkt->pts = av_rescale(viv->audio_sample, astream->time_base.den, astream->time_base.num) / astream->codecpar->sample_rate; + pkt->pts = av_rescale_q(viv->audio_sample, av_make_q(1, astream->codecpar->sample_rate), astream->time_base); viv->audio_sample += viv->audio_subpackets[viv->current_audio_subpacket].pcm_bytes / 2 / astream->codecpar->channels; pkt->flags |= AV_PKT_FLAG_KEY; viv->current_audio_subpacket++;