History

lavfi/atempo: avoid asendcmd assertion failure

Check for zeros equal to the total samples early, because in that case we would already be leaving the first few frames out. Fixes trac ticket #10692

Rajiv Harlalka committed 2 years ago

Commit 47009251 parent 89969451 file · +9 −9Browse files

Unified · Split

libavfilter/af_atempo.c+9−9
@@ -531,21 +531,21 @@ static int yae_load_frag(ATempoContext *atempo, · 530 unmodified lines
531 dst = frag->data;531 dst = frag->data;
532 532
533 start = atempo->position[0] - atempo->size;533 start = atempo->position[0] - atempo->size;
534 zeros = 0;
535 534
536 if (frag->position[0] < start) {535 // what we don't have we substitute with zeros:
537 // what we don't have we substitute with zeros:536 zeros =
538 zeros = FFMIN(start - frag->position[0], (int64_t)nsamples);537 frag->position[0] < start ?
539 av_assert0(zeros != nsamples);538 FFMIN(start - frag->position[0], (int64_t)nsamples) : 0;
540
541 memset(dst, 0, zeros * atempo->stride);
542 dst += zeros * atempo->stride;
543 }
544 539
545 if (zeros == nsamples) {540 if (zeros == nsamples) {
546 return 0;541 return 0;
547 }542 }
548 543
544 if (frag->position[0] < start) {
545 memset(dst, 0, zeros * atempo->stride);
546 dst += zeros * atempo->stride;
547 }
548
549 // get the remaining data from the ring buffer:549 // get the remaining data from the ring buffer:
550 na = (atempo->head < atempo->tail ?550 na = (atempo->head < atempo->tail ?
551 atempo->tail - atempo->head :551 atempo->tail - atempo->head :

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t