History

lavfi: grant all permissions on mallocated audio buffers.

The permissions not requested by the filter that created the buffer may be useful for a later filter and avoid a copy.

Nicolas George committed 14 years ago

Commit e54e30c1 parent cc8104b1 file · +5 −1Browse files

Showing the changes to libavfilter/audio.c (1 of 1 file). Show all

Unified · Split

libavfilter/audio.c+5−1
@@ -42,6 +42,10 @@ AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms, · 41 unmodified lines
4242 int nb_channels = av_get_channel_layout_nb_channels(link->channel_layout);
4343 int planes = planar ? nb_channels : 1;
4444 int linesize;
45+ int full_perms = AV_PERM_READ | AV_PERM_WRITE | AV_PERM_PRESERVE |
46+ AV_PERM_REUSE | AV_PERM_REUSE2 | AV_PERM_ALIGN;
47+
48+ av_assert1(!(perms & ~(full_perms | AV_PERM_NEG_LINESIZES)));
4549
4650 if (!(data = av_mallocz(sizeof(*data) * planes)))
4751 goto fail;
@@ -49,7 +53,7 @@ AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms, · 1 unmodified line
4953 if (av_samples_alloc(data, &linesize, nb_channels, nb_samples, link->format, 0) < 0)
5054 goto fail;
5155
52− samplesref = avfilter_get_audio_buffer_ref_from_arrays(data, linesize, perms,
56+ samplesref = avfilter_get_audio_buffer_ref_from_arrays(data, linesize, full_perms,
5357 nb_samples, link->format,
5458 link->channel_layout);
5559 if (!samplesref)

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