Commit Graph

15282 Commits

Author SHA1 Message Date
fangyibo 55835928d6 ffmpeg: open alsa device only in link with format
Signed-off-by: fangyibo <fangyibo@xiaomi.com>
2026-04-20 20:58:48 +08:00
hanyongxing1 05d835e0bd alsasink: prevent paused filters from being activated by checking frame_blocked_in
Signed-off-by: hanyongxing1 <hanyongxing1@xiaomi.com>
2026-04-20 20:58:48 +08:00
wurui3 e11540a719 ffmpeg/libavfilter: drain amix input when EOF comes during block.
If free amix input with INPUT_ON|INPUT_EOF|INPUT state, samples left in
AVFilterLink will not be consumed leading to EOF sync pending. Drain
link samples to improve.

Signed-off-by: wurui3 <wurui3@xiaomi.com>
2026-04-20 20:58:48 +08:00
wurui3 e1beec703a Revert "ffmpeg/libavfilter: amix stop mix input with blocked state."
This reverts commit b20bd6fef01a924049f620048b22b4fc9c61e62c.

Reason for revert: drain amix input when input blocked.

Signed-off-by: wurui3 <wurui3@xiaomi.com>
2026-04-20 20:58:48 +08:00
zengshuang 13957af085 ffmpeg:fix compilation warning.
Signed-off-by: zengshuang <zengshuang@xiaomi.com>
2026-04-20 20:58:48 +08:00
fangyibo 27d041cf56 ffmpeg: alsasrc support ioctl SETPARAMTER
Signed-off-by: fangyibo <fangyibo@xiaomi.com>
2026-04-20 20:58:48 +08:00
zhaozhenghang 85b4c936c7 alsasrc: close PCM and volume state during uninit
Signed-off-by: zhaozhenghang <zhaozhenghang@xiaomi.com>
2026-04-20 20:58:48 +08:00
zhaozhenghang f39a6ffb8e alsasink: fix resource leak in alsasink_unint
Signed-off-by: zhaozhenghang <zhaozhenghang@xiaomi.com>
2026-04-20 20:58:48 +08:00
zhaozhenghang ab69aac1a2 alsasink: fix buffer overflow in alsasink_process_command
Signed-off-by: zhaozhenghang <zhaozhenghang@xiaomi.com>
2026-04-20 20:58:47 +08:00
cenzhanquan1 db003cf34a libavfilter/asink_abufsink: the started variable indicates participation in format negotiation.
Signed-off-by: cenzhanquan1 <cenzhanquan1@xiaomi.com>
2026-04-20 20:58:47 +08:00
niyinghao f614a771fb libavfilter: Use type-safe format negotiation functions with enum parameters
Replace generic format functions with type-safe variants to prevent undefined
behavior with -fshort-enums compiler flag.

- ff_set_common_formats_from_list2 -> ff_set_*_formats_from_list2 (sample/pixel)
- ff_set_common_formats_from_list -> ff_set_*_formats_from_list (sample/pixel)
- ff_make_format_list -> ff_make_*_format_list (sample/pixel)

This adapts the upstream FFmpeg master patch to ffmpeg7 version.

Signed-off-by: niyinghao <niyinghao@xiaomi.com>
Signed-off-by: zengshuang <zengshuang@xiaomi.com>
2026-04-20 20:58:47 +08:00
niyinghao b3849036b8 avfilter/formats: add type-safe functions for AVSampleFormat/AVPixelFormat lists
This avoids undefined behavior when -fshort-enums is enabled, where accessing enum arrays through int pointers causes incorrect memory reads.

Signed-off-by: niyinghao <niyinghao@xiaomi.com>
2026-04-20 20:58:47 +08:00
zengshuang a062f93f0f ffmpeg: fix log warning.
Signed-off-by: zengshuang <zengshuang@xiaomi.com>
2026-04-20 20:58:47 +08:00
caifan3 f3b7684df6 libavfilter: Correct the returned error code
Signed-off-by: caifan3 <caifan3@xiaomi.com>
2026-04-20 20:58:46 +08:00
caifan3 8227b29529 libavfilter: Improve error logs
Signed-off-by: caifan3 <caifan3@xiaomi.com>
2026-04-20 20:58:46 +08:00
caifan3 f640ab9252 libavfilter/abufsrc: fix resource leaks
Signed-off-by: caifan3 <caifan3@xiaomi.com>
2026-04-20 20:58:46 +08:00
fangyibo e8d303a6c8 Revert "ffmpeg: Dynamically activate output routing"
This reverts commit 8e176009bcced7d6f287781e5c827955ccd465cb.

Reason for revert: <crash>

Signed-off-by: fangyibo <fangyibo@xiaomi.com>
2026-04-20 20:58:46 +08:00
hanyongxing1 d1b4100abd ffmpeg/aresample.c: Add parameter validation and return value checking.
Signed-off-by: hanyongxing1 <hanyongxing1@xiaomi.com>
2026-04-20 20:58:46 +08:00
hanyongxing1 ae1fd219af Add an volume interface to get the actual volume.
Signed-off-by: hanyongxing1 <hanyongxing1@xiaomi.com>
2026-04-20 20:58:46 +08:00
v-wujin1 2b949e364c ffmpeg: Dynamically activate output routing
Signed-off-by: v-wujin1 <v-wujin1@xiaomi.com>
2026-04-20 20:58:45 +08:00
hanyongxing1 21c5a9cff7 ffmpeg/mapping.c: Add function descriptions and value validation
Signed-off-by: hanyongxing1 <hanyongxing1@xiaomi.com>
2026-04-20 20:58:45 +08:00
hanyongxing1 60e4995664 ffmpeg/volume.c: Add parameter validation, function pointer checking, and overflow protection.
Signed-off-by: hanyongxing1 <hanyongxing1@xiaomi.com>
2026-04-20 20:58:45 +08:00
wurui3 17994f1ff9 libavfilter/amix: clear INPUT_ON after all state synced based on AVFilterLink state.
Suppose that, there are two inputs, the first's link state is AVERROR_EOF with no samples left neither in link or fifo, the second's link state is 0 and with let samples bigger than mix_size, the ff_amix_input_want will return false in both inputs result in failing to trigger the pipeline.

Signed-off-by: wurui3 <wurui3@xiaomi.com>
2026-04-20 20:58:45 +08:00
wangsheng6 b7c3596ab8 avfilter: fix tinycompress sink/source bugs
asrc_tinycomprsrc: fix resource leak in uninit (missing close call).

Signed-off-by: wangsheng6 <wangsheng6@xiaomi.com>
2026-04-20 20:58:45 +08:00
cenzhanquan1 e85d192ac4 libavfilter/asrc_abufsrc: dump player volume & stream volume.
Signed-off-by: cenzhanquan1 <cenzhanquan1@xiaomi.com>
2026-04-20 20:58:45 +08:00
wangwenchao10 94a796c58d qemu/smartspeaker:adapt to new framework
Signed-off-by: wangwenchao10 <wangwenchao10@xiaomi.com>
2026-04-20 20:58:44 +08:00
zhangsenlin 8bec899cbe ffmpeg:Remove data processing from unnecessary links.
Signed-off-by: zhangsenlin <zhangsenlin@xiaomi.com>
2026-04-20 20:58:44 +08:00
wurui3 48913317d1 ffmpeg/libavfilter: fix twice calls of tinycomprsrc_close in once unlink.
Tinycomprsrc_callback might be called in compress_close if a AUDIO_MSG_COMPLETE msg is
received during compress_stop. Move state judge into activate func and directly return if MSG we dont care arrives.

Signed-off-by: wurui3 <wurui3@xiaomi.com>
2026-04-20 20:58:43 +08:00
zhaozhenghang b5f82edf19 libavfilter/volume: use mid_fmt for fade/scale init
\x1b[1m\x1b[31m==3277822==ERROR: AddressSanitizer: SEGV on unknown address
	 0x00000000 (pc 0x00000000 bp 0xf1d69458 sp 0xf1d6936c T0)
\x1b[1m\x1b[0m==3277822==Hint: pc points to the zero page.
==3277822==The signal is caused by a READ memory access.
==3277822==Hint: address points to the zero page.

Signed-off-by: zhaozhenghang <zhaozhenghang@xiaomi.com>
2026-04-20 20:58:42 +08:00
jihandong c8b488ca12 FFMPEG: command "dump_raw_start/dump_raw_stop".
start capture between 2 filters: target=src, cmd="dump_raw_start", arg=dst;
stop  capture between 2 filters: target=src, cmd="dump_raw_stop",  arg=dst;
start capture all from a filter: target=src, cmd="dump_raw_start", arg=(NULL);
stop  capture all from a filter: target=src, cmd="dump_raw_stop",  arg=(NULL);

for plane format, number of dump files equal to number of channels.

file names has format like:
	"srcname-dstname-number.pcm".

Signed-off-by: jihandong <jihandong@xiaomi.com>

Signed-off-by: fangyibo <fangyibo@xiaomi.com>
2026-04-20 20:58:42 +08:00
wurui3 c1366f5889 ffmpeg/libavfilter: tinycomprsrc close after all msg are replied.
If tinycomprsrc is waiting for confirm msg from device when an unlink is
recived, close should be excecuted after confirm msg is received.

Signed-off-by: wurui3 <wurui3@xiaomi.com>
2026-04-20 20:58:42 +08:00
wurui3 2a470e49c2 ffmpeg/libavfilter: delete compress_stop before compress_close in
tinycomprsrc.

Twice compress_stop will cause busy in waiting for buffers dequeued from
device driver.

Signed-off-by: wurui3 <wurui3@xiaomi.com>
2026-04-20 20:58:42 +08:00
wangwenchao10 8efa912cf5 external/ffmpeg:fix tinycompresssnk crash
Signed-off-by: wangwenchao10 <wangwenchao10@xiaomi.com>
2026-04-20 20:58:42 +08:00
hanyongxing1 12f36772c6 media: add volume ctx for seperate output[v2]
Signed-off-by: hanyongxing1 <hanyongxing1@xiaomi.com>
2026-04-20 20:58:42 +08:00
fangyibo 5e87d19af0 ffmpeg: fix volume adjust comparation int with unsigned
Signed-off-by: fangyibo <fangyibo@xiaomi.com>
2026-04-20 20:58:42 +08:00
cenzhanquan1 2c9460af33 ffmpeg: fix the missing break converity issue in switch.
Signed-off-by: cenzhanquan1 <cenzhanquan1@xiaomi.com>
2026-04-20 20:58:42 +08:00
wurui3 16d850ab27 ffmpeg/libavfilter: amix stop mix input with blocked state.
If amix was harved to output frame for a while before BLOCK state passed
from src filter which means that the thread is too busy to activate src
filter passing BLOCK state to sink, then outputing the rest data left in amix after BLOCK being
set by src filter will cause a sound  pop or freezes.

Signed-off-by: wurui3 <wurui3@xiaomi.com>
2026-04-20 20:58:42 +08:00
v-dingxiaofu 8b0fdff3ef external/ffmpeg: fix the issue of incorrect get_latency value.
Signed-off-by: v-dingxiaofu <v-dingxiaofu@xiaomi.com>
2026-04-20 20:58:42 +08:00
fangyibo b8af0e73fe media: add volume ctx for seperate output
Signed-off-by: fangyibo <fangyibo@xiaomi.com>
2026-04-20 20:58:41 +08:00
renjianguang bd7f6f2652 ffmpeg/libavfilter: tinycomprxxx filter adapte new compress lib API
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2026-04-20 20:58:41 +08:00
hanqiyuan 9d7b568aae ffmpeg: codesize optimize for CONFIG_AUDIO_ONLY.
Enabled by --enable-audio-only, default disabled.
The size optimized 114656 bytes @ gcc -Os,-flto by --enable-audio-only.

Signed-off-by: hanqiyuan <hanqiyuan@xiaomi.com>
2026-04-20 20:58:41 +08:00
wangwenchao10 08f1fdc949 external/ffmpeg:Fix the acquisition delay vulnerability
Signed-off-by: wangwenchao10 <wangwenchao10@xiaomi.com>
2026-04-20 20:58:41 +08:00
chenyu29 7337d695cf support volume precision
Signed-off-by: chenyu29 <chenyu29@xiaomi.com>
2026-04-20 20:58:41 +08:00
wangwenchao10 d4f174e979 external/ffmpeg:Add the interface get_latency for obtaining latency
Signed-off-by: wangwenchao10 <wangwenchao10@xiaomi.com>
2026-04-20 20:58:40 +08:00
zhushiqshi 816255cbb6 FFMPEG: implement to drop video frame smoothly
Signed-off-by: zhushiqshi <zhushiqshi@xiaomi.com>
2026-04-20 20:58:40 +08:00
niyinghao 12162a3aee FFMPEG: fix coverity error
CID 8357714: uninit_use_in_call
line 762: ff_outlink_set_status(ctx->outputs[i], AVERROR_EOF, rpts);

Signed-off-by: niyinghao <niyinghao@xiaomi.com>
2026-04-20 20:58:39 +08:00
fangyibo 7be6783e74 ffmpeg: fix busy when upstream data sent slowly
Signed-off-by: fangyibo <fangyibo@xiaomi.com>
2026-04-20 20:58:39 +08:00
niyinghao dc3a250326 FFMPEG: asubgraph add amix function supports
Signed-off-by: niyinghao <niyinghao@xiaomi.com>
2026-04-20 20:58:39 +08:00
niyinghao 8b4a5dc36d FFMPEG: af_asubgraph support multi algorithm filter ability
Signed-off-by: niyinghao <niyinghao@xiaomi.com>
2026-04-20 20:58:39 +08:00
niyinghao f70b0d7cd5 FFMPEG: Optimize af_asubgraph filter code
1: The meanings of struct SubGraph and struct SubGraphPriv are confused, rename SubGraph to GraphInstance
2: Add asubgraph_uninit_instance() priv function.

Signed-off-by: niyinghao <niyinghao@xiaomi.com>
2026-04-20 20:58:39 +08:00