我制作了一个带有媒体服务的Mediaplayer应用,该服务控制着我的Mediaplayer对象.
一切正常,但我的logcat每秒都被此消息淹没.
此消息是什么意思?
Logcat(资讯)
W/audio_hw_generic: Not supplying enough data to HAL, expected position
7310473 , only wrote 7310160
W/audio_hw_generic: Not supplying enough data to HAL, expected position
7326138 , only wrote 7326000
W/audio_hw_generic: Not supplying enough data to HAL, expected position
7326108 , only wrote 7326000
W/audio_hw_generic: Not supplying enough data to HAL, expected position
7328176 , only wrote 7326720
W/audio_hw_generic: Not supplying enough data to HAL, expected position
7330512 , only wrote 7330320
W/audio_hw_generic: Not supplying enough data to HAL, expected position 7333401 , only wrote 7333200
解决方法:
经过一些研究,我发现了与此问题相关的有用链接.
实际上,这是硬件抽象层(Hal)发出的警告.
什么是哈尔?你可以在这里找到它:
> https://www.coursera.org/lecture/androidapps-2/android-hardware-abstraction-layer-hal-noH7V
> https://www.e-consystems.com/blog/system-on-module-SOM/android-hal-and-device-driver-architecture/
HAL的工作方式类似于连接黑白软件和硬件层.
经过更多搜索后,我找到了此日志的编码文件.
https://android.googlesource.com/device/generic/goldfish/+/master/audio/audio_hw.c#512
在哪里可以看到some_position> some_frames_write可能导致此警告.
同样,此警告通常会在Generic Devices中出现,例如模拟器或纯Android设备.您是否在真实设备上或通过更改设备尝试过该应用程序?我认为此问题与您的应用程序无关,而与设备有关.
PS:我刚刚搜索了这些东西,但对它们并没有太多的了解.可能我在这个问题上错了.