gpt4 book ai didi

android - "Missed SL_PLAYEVENT_HEADATNEWPOS for position"消息

转载 作者:行者123 更新时间:2023-11-29 00:22:29 28 4
gpt4 key购买 nike

我使用 OpenSL ES 编写了一个音乐播放器。除了来自 libOpenSLES 库的一条警告消息外,它工作正常。这是消息。

03-05 00:10:15.367: W/libOpenSLES(12055): Missed SL_PLAYEVENT_HEADATNEWPOS for position 7000; current position 724009
...
03-05 00:10:27.226: W/libOpenSLES(12055): Missed SL_PLAYEVENT_HEADATNEWPOS for position 329015; current position 816013

当我寻找媒体轨道时,它就来了。有时我可以在没有警告的情况下进行搜索,有时消息会出现在日志中。

实现非常简单。在初始化时,我选择了搜索控件。

SLObjectItf decoder;
SLSeekItf seek;
...

SLresult result = (*decoder)->GetInterface(decoder, SL_IID_SEEK, &seek);

然后,当用户改变轨道位置时,我调用 SetPosition 方法如下。

SLresult result = (*seek)->SetPosition(seek, position, SL_SEEKMODE_ACCURATE);

两个调用都返回成功结果,位置更改也一直有效。唯一的问题是上面提到的警告消息。

知道为什么会出现此消息以及如何避免它吗?

更新:

虽然一半的赏金是自动分配的,但问题尚未得到解答。我们不知道导致问题的原因以及如何避免。

最佳答案

快速谷歌一下该日志消息的一部分,发现了以下代码 fragment ,您的日志打印在中间,( complete source ):

    // nextVirtualMarkerMs will be set to the position of the next upcoming virtual marker
int32_t nextVirtualMarkerMs;
if (mObservedPositionMs <= virtualMarkerMs && virtualMarkerMs <= positionMs) {
// we did pass through the virtual marker, now compute the next virtual marker
mDeliveredNewPosMs = virtualMarkerMs;
nextVirtualMarkerMs = virtualMarkerMs + mPositionUpdatePeriodMs;
// re-synchronize if we missed an update
if (nextVirtualMarkerMs <= positionMs) {
SL_LOGW("Missed SL_PLAYEVENT_HEADATNEWPOS for position %d; current position %d",
nextVirtualMarkerMs, positionMs);
// try to catch up by setting next goal to current position plus update period
mDeliveredNewPosMs = positionMs;
nextVirtualMarkerMs = positionMs + mPositionUpdatePeriodMs;
}
notify(PLAYEREVENT_PLAY, (int32_t) SL_PLAYEVENT_HEADATNEWPOS, true /*async*/);

如果您搜索通过某个点,则需要进行一些追赶(跳跃),并且可能错过了更新,这就是日志中的内容,我们需要重新同步标记位置。

更新上面的整个代码 fragment 用于计算 oneshot(稳定的临时状态)暂停时间,如果代码解释正确的话,oneshot, row 116 的定义。 :

    // deferred (non-0 timeout) handler for SL_PLAYEVENT_*
// As used here, "one-shot" is the software equivalent of a "retriggerable monostable
// multivibrator" from electronics. Briefly, a one-shot is a timer that can be triggered
// to fire at some point in the future. It is "retriggerable" because while the timer
// is active, it is possible to replace the current timeout value by a new value.
// This is done by cancelling the current timer (using a generation count),
// and then posting another timer with the new desired value.

我认为,您之所以会收到日志消息,是因为经常跳转到让代码跟上进度。所以尽量不要经常跳?顺便说一句,这是一个警告日志,下次会在这个代码路径中 catch 。

关于android - "Missed SL_PLAYEVENT_HEADATNEWPOS for position"消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22191804/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com