From 090593f67c9a3e06c974c42cad56ec5d341bcea9 Mon Sep 17 00:00:00 2001 From: alexliyu7352 Date: Sat, 12 Mar 2022 09:44:47 +0800 Subject: [PATCH] =?UTF-8?q?hls=E6=8B=89=E5=8F=96=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=81=BF=E5=85=8D=E5=BE=AA=E7=8E=AF=E9=87=8D?= =?UTF-8?q?=E8=AF=95=20(#1474)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当hls拉取索引文件失败时会触发重试. 但是play失败会调用一次rePlay, OnShutdow又会调用一次的rePlay. 由于m3u8文件非常小, 很大可能上短时间马上就会重试成功. 但是由于有两次的rePlay所以很可能再次析构了player, 又循环触发了更多的rePlay. 所以在播放成功后, 应该取消掉定时器 --- src/Player/PlayerProxy.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Player/PlayerProxy.cpp b/src/Player/PlayerProxy.cpp index 73ceef51..dab199e6 100644 --- a/src/Player/PlayerProxy.cpp +++ b/src/Player/PlayerProxy.cpp @@ -56,6 +56,8 @@ void PlayerProxy::play(const string &strUrlTmp) { } if (!err) { + // 取消定时器,避免hls拉流索引文件因为网络波动失败重连成功后出现循环重试的情况 + strongSelf->_timer.reset(); // 播放成功 *piFailedCnt = 0;//连续播放失败次数清0 strongSelf->onPlaySuccess();