Compare commits

..

4 Commits

Author SHA1 Message Date
mtdxc
bdaadfc879
Merge af6d265018 into 6729257eab 2024-10-31 13:55:54 +00:00
cqm
af6d265018 change getSSRC 2024-10-31 21:55:39 +08:00
cqm
eb8e39d897 use ref callback 2024-10-31 21:39:28 +08:00
wuxingzhong
6729257eab
修复时间戳回退导致超大mp4切片问题 (#3991)
Some checks are pending
Android / build (push) Waiting to run
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
Docker / build (push) Waiting to run
Linux / build (push) Waiting to run
macOS / build (push) Waiting to run
Windows / build (push) Waiting to run
当出现dts回退时,应该取frame->dts(), 即MIN, 非MAX
2024-10-31 20:11:34 +08:00
3 changed files with 6 additions and 4 deletions

View File

@ -346,7 +346,7 @@ public:
return it->second;
}
void for_each(std::function<void(const std::string&, const Pointer&)> cb) {
void for_each(const std::function<void(const std::string&, const Pointer&)>& cb) {
std::lock_guard<std::recursive_mutex> lck(_mtx);
auto it = _map.begin();
while (it != _map.end()) {

View File

@ -126,7 +126,7 @@ bool MP4Recorder::inputFrame(const Frame::Ptr &frame) {
if (_last_dts == 0 || _last_dts > frame->dts()) {
// b帧情况下dts时间戳可能回退 [AUTO-TRANSLATED:1de38f77]
// In the case of b-frames, the dts timestamp may regress
_last_dts = MAX(frame->dts(), _last_dts);
_last_dts = MIN(frame->dts(), _last_dts);
}
auto duration = 5u; // 默认至少一帧5ms
if (frame->dts() > 0 && frame->dts() > _last_dts) {

View File

@ -296,10 +296,12 @@ void RtpServer::updateSSRC(uint32_t ssrc) {
}
uint32_t RtpServer::getSSRC() const {
if (_ssrc)
if (_ssrc) {
return *_ssrc;
else if (_tcp_server)
}
if (_tcp_server) {
return (*_tcp_server)[RtpSession::kSSRC];
}
return 0;
}