修复rtmp点播移动时间轴相关bug

This commit is contained in:
xiongziliang 2019-09-03 17:20:56 +08:00
parent 226473a223
commit d864e7084b
3 changed files with 22 additions and 1 deletions

View File

@ -49,7 +49,7 @@ void Stamp::revise(uint32_t dts, uint32_t pts, int64_t &dts_out, int64_t &pts_ou
//相对时间戳
dts_out = dts - _start_dts;
if(dts_out < _dts_inc){
if(dts_out < _dts_inc && !_playback){
//本次相对时间戳竟然小于上次?
if(dts_out < 0 || _dts_inc - dts_out > 0xFFFF){
//时间戳回环,保证下次相对时间戳与本次相对合理增长
@ -77,4 +77,8 @@ void Stamp::revise(uint32_t dts, uint32_t pts, int64_t &dts_out, int64_t &pts_ou
}
}
void Stamp::setPlayBack(bool playback) {
_playback = playback;
}
}//namespace mediakit

View File

@ -39,8 +39,23 @@ class Stamp {
public:
Stamp() = default;
~Stamp() = default;
/**
* 退
* @param playback
*/
void setPlayBack(bool playback = true);
/**
*
* @param dts dts0
* @param pts pts0dts
* @param dts_out dts
* @param pts_out pts
*/
void revise(uint32_t dts, uint32_t pts, int64_t &dts_out, int64_t &pts_out);
private:
bool _playback = false;
int64_t _start_dts = 0;
int64_t _dts_inc = 0;
bool _first = true;

View File

@ -464,6 +464,8 @@ void RtmpSession::onCmd_seek(AMFDecoder &dec) {
InfoP(this) << "rtmp seekTo(ms):" << milliSeconds;
auto stongSrc = _pPlayerSrc.lock();
if (stongSrc) {
_stamp[0].setPlayBack();
_stamp[1].setPlayBack();
stongSrc->seekTo(milliSeconds);
}
AMFValue status(AMF_OBJECT);