Skip to content

Commit

Permalink
Only trust buffersink's timebase
Browse files Browse the repository at this point in the history
When filtering, the timebase on frames is unreliable, since most filters
don't actually update it it seems. So, only trust the timebase of the
buffersink itself, not the timebase of the filtered frames.

FIXME: Make this configurable
  • Loading branch information
Yahweasel committed Dec 17, 2024
1 parent 131ec70 commit 6608a04
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions post.in.js
Original file line number Diff line number Diff line change
Expand Up @@ -1848,9 +1848,8 @@ var ff_filter_multi = Module.ff_filter_multi = function(srcs, buffersink_ctx, fr

if (tbNum) {
if (typeof outFrame === "number") {
if (!AVFrame_time_base_num(outFrame))
AVFrame_time_base_s(outFrame, tbNum, tbDen);
} else if (outFrame && !outFrame.time_base_num) {
AVFrame_time_base_s(outFrame, tbNum, tbDen);
} else if (outFrame) {
outFrame.time_base_num = tbNum;
outFrame.time_base_den = tbDen;
}
Expand All @@ -1866,25 +1865,9 @@ var ff_filter_multi = Module.ff_filter_multi = function(srcs, buffersink_ctx, fr
// Choose a frame copier per stream
var copyoutFrames = [];
for (var ti = 0; ti < inFrames.length; ti++) (function(ti) {
var copyoutFrameO = ff_copyout_frame;
var copyoutFrame = ff_copyout_frame;
if (config[ti].copyoutFrame)
copyoutFrameO = ff_copyout_frame_versions[config[ti].copyoutFrame];
var copyoutFrame = function(ptr) {
var ret = copyoutFrameO(ptr);
if (!ret.time_base_num) {
ret.time_base_num = tbNum;
ret.time_base_den = tbDen;
}
return ret;
};
if (config[ti].copyoutFrame === "ptr") {
copyoutFrame = function(ptr) {
var ret = ff_copyout_frame_ptr(ptr);
if (!AVFrame_time_base_num(ret))
AVFrame_time_base_s(ret, tbNum, tbDen);
return ret;
};
}
copyoutFrame = ff_copyout_frame_versions[config[ti].copyoutFrame];
copyoutFrames.push(copyoutFrame);
})(ti);

Expand Down

0 comments on commit 6608a04

Please sign in to comment.