mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
修复rtmp点播移动时间轴相关bug
This commit is contained in:
parent
226473a223
commit
d864e7084b
@ -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;
|
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){
|
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
|
}//namespace mediakit
|
@ -39,8 +39,23 @@ class Stamp {
|
|||||||
public:
|
public:
|
||||||
Stamp() = default;
|
Stamp() = default;
|
||||||
~Stamp() = default;
|
~Stamp() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置回放模式,回放模式时间戳可以回退
|
||||||
|
* @param playback 是否为回放模式
|
||||||
|
*/
|
||||||
|
void setPlayBack(bool playback = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修正时间戳
|
||||||
|
* @param dts 输入dts,如果为0则根据系统时间戳生成
|
||||||
|
* @param pts 输入pts,如果为0则等于dts
|
||||||
|
* @param dts_out 输出dts
|
||||||
|
* @param pts_out 输出pts
|
||||||
|
*/
|
||||||
void revise(uint32_t dts, uint32_t pts, int64_t &dts_out, int64_t &pts_out);
|
void revise(uint32_t dts, uint32_t pts, int64_t &dts_out, int64_t &pts_out);
|
||||||
private:
|
private:
|
||||||
|
bool _playback = false;
|
||||||
int64_t _start_dts = 0;
|
int64_t _start_dts = 0;
|
||||||
int64_t _dts_inc = 0;
|
int64_t _dts_inc = 0;
|
||||||
bool _first = true;
|
bool _first = true;
|
||||||
|
@ -464,6 +464,8 @@ void RtmpSession::onCmd_seek(AMFDecoder &dec) {
|
|||||||
InfoP(this) << "rtmp seekTo(ms):" << milliSeconds;
|
InfoP(this) << "rtmp seekTo(ms):" << milliSeconds;
|
||||||
auto stongSrc = _pPlayerSrc.lock();
|
auto stongSrc = _pPlayerSrc.lock();
|
||||||
if (stongSrc) {
|
if (stongSrc) {
|
||||||
|
_stamp[0].setPlayBack();
|
||||||
|
_stamp[1].setPlayBack();
|
||||||
stongSrc->seekTo(milliSeconds);
|
stongSrc->seekTo(milliSeconds);
|
||||||
}
|
}
|
||||||
AMFValue status(AMF_OBJECT);
|
AMFValue status(AMF_OBJECT);
|
||||||
|
Loading…
Reference in New Issue
Block a user