Commit Graph

118284 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
caifan3 1bbb7f368d libavformat/id3v2: fix disable-id3 decoding mp3 time exception
Signed-off-by: caifan3 <caifan3@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
zengshuang 1cd71fc957 ffmpeg:Resolve aac compilation warnings.
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
caifan3 0aebd61b29 libavformat/file: apply pkt_size option to read mode
Previously, the pkt_size option only affected write buffering in the file
protocol. This change extends its effect to read mode as well.
On embedded systems with limited RAM, users can now reduce I/O buffer
memory by setting a smaller pkt_size.

Signed-off-by: caifan3 <caifan3@xiaomi.com>
2026-04-20 20:58:46 +08:00
chenyu29 d137f3c175 ffmpeg: add armv8-m.main+dsp support
Signed-off-by: chenyu29 <chenyu29@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
caifan3 61b521eee8 avformat/unix: add pkt_size option
Add a "pkt_size" AVOption to the Unix domain socket protocol. This option
allows the user to specify the maximum packet size for packet-oriented
sockets (SOCK_DGRAM and SOCK_SEQPACKET).

Signed-off-by: caifan3 <caifan3@xiaomi.com>
2026-04-20 20:58:45 +08:00
caifan3 225f4eb4b5 avformat/rpmsg: add pkt_size option
This option allows the user to specify the maximum packet size for packet-oriented
sockets (SOCK_DGRAM and SOCK_SEQPACKET).
For SOCK_STREAM, it sets the I/O buffer size to reduce memory usage.

Signed-off-by: caifan3 <caifan3@xiaomi.com>
2026-04-20 20:58:45 +08:00
wangwenchao10 12edb5ae2d external/ffmpeg:Fix the issue where av_find_stream_info needs to read a large amount of data when playing PCM
Signed-off-by: wangwenchao10 <wangwenchao10@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
zengshuang 7355bbb91b libavformat: resolve complation errors
Signed-off-by: zengshuang <zengshuang@xiaomi.com>
Signed-off-by: zengshuang <zengshuang@xiaomi.com>
2026-04-20 20:58:44 +08:00
jinxiuxu b14fd65105 FFMPEG: change offset when cache missed
Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
2026-04-20 20:58:44 +08:00
wurui3 f598c6ff75 libavformat: Replace strncat with av_strlcat while concatenating media cache_ threadname string.
Use a more secure and consistent function av_strlcat to replace strncat function .

Signed-off-by: wurui3 <wurui3@xiaomi.com>
2026-04-20 20:58:44 +08:00
wurui3 bbb34206ec libavformat: Add suffix on cache_thread name.
Add a "_cache" suffix on cache_thread name to distinguish from
movie_async_thread.

Signed-off-by: wurui3 <wurui3@xiaomi.com>
2026-04-20 20:58:44 +08:00
yangsen5 d2f6524ead FFmpeg: fix format warning in libavformat/cache.c
fmpeg/libavformat/cache.c:130:52: warning: format '%lld' expects argument of type 'long long int', but argument 6 has type 'int64_t' {aka 'long int'} [-Wformat=]
  130 |     av_log(h, AV_LOG_INFO, "%s end ret %d bytes %lld %lldbps\n", __func__, ret, offset, bps);
      |                                                 ~~~^                            ~~~~~~
      |                                                    |                            |
      |                                                    long long int                int64_t {aka long int}
      |                                                 %ld
ffmpeg/libavformat/cache.c:130:57: warning: format '%lld' expects argument of type 'long long int', but argument 7 has type 'int64_t' {aka 'long int'} [-Wformat=]
  130 |     av_log(h, AV_LOG_INFO, "%s end ret %d bytes %lld %lldbps\n", __func__, ret, offset, bps);
      |                                                      ~~~^                               ~~~
      |                                                         |                               |
      |                                                         long long int                   int64_t {aka long int}
      |                                                      %ld
ffmpeg/libavformat/cache.c: In function 'add_entry':
ffmpeg/libavformat/cache.c:200:66: warning: format '%lld' expects argument of type 'long long int', but argument 4 has type 'int64_t' {aka 'long int'} [-Wformat=]
  200 |         av_log(h, AV_LOG_ERROR, "Failed to seek in cache, ret %lld errno %d\n", pos, errno);
      |                                                               ~~~^              ~~~
      |                                                                  |              |
      |                                                                  long long int  int64_t {aka long int}
      |                                                               %ld

Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2026-04-20 20:58:44 +08:00
qiaohaijiao1 5d1e863aec FFMPEG: add debug log.
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:58:44 +08:00
qiaohaijiao1 a509499b30 FFMPEG: add error handle in cache protocol
_url_close does't called when init_input failed in avformat_open_input.

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:58:43 +08:00
qiaohaijiao1 d38558d89a FFMPEG: use ffurl_read_complete to read 2K once in cache thread.
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:58:43 +08:00
qiaohaijiao1 4f0e0b7898 FFMPEG: calculate average bps in cache protocol.
1, calculate average bps.
2, log when EOF.

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:58:43 +08:00
qiaohaijiao1 307d30c72e FFMPEG: unlink cache file when cache_close
mkstemp->unlink->close(fd) doest't release space.

Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:58:43 +08:00
qiaohaijiao1 72fa6b236a FFMPEG: add thread to cache data in cache protocol
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:58:43 +08:00
qiaohaijiao1 5c5c06c7c6 FFMPEG: add cache_pread function.
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2026-04-20 20:58:43 +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
fangyibo 9b041395d9 ffmpeg: reduce codesize by ingnore tx_double and tx_int32
Signed-off-by: fangyibo <fangyibo@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