mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-24 01:42:22 +08:00
Accelerate the ready speed of certain media that actually only have a single video track but the metadata contains an audio track (#3885)
加快某些实际上只有单视频track但是metadata包含音频track的媒体Ready速度,比如GB28181 PS流 --------- Co-authored-by: TalusL <liangzhuohua@genew.com>
This commit is contained in:
@@ -107,6 +107,26 @@ void MediaSink::checkTrackIfReady() {
|
||||
}
|
||||
}
|
||||
|
||||
// 等待音频超时时间
|
||||
GET_CONFIG(uint32_t, kWaitAudioTrackDataMS, General::kWaitAudioTrackDataMS);
|
||||
if (_max_track_size > 1) {
|
||||
for (auto it = _track_map.begin(); it != _track_map.end(); ++it) {
|
||||
if (it->second.first->getTrackType() != TrackAudio) {
|
||||
continue;
|
||||
}
|
||||
if (_ticker.elapsedTime() > kWaitAudioTrackDataMS && !it->second.second) {
|
||||
// 音频超时且完全没收到音频数据,忽略音频
|
||||
auto index = it->second.first->getIndex();
|
||||
WarnL << "audio track " << "index " << index << " codec " << it->second.first->getCodecName() << " receive no data for long "
|
||||
<< _ticker.elapsedTime() << "ms. Ignore it!";
|
||||
it = _track_map.erase(it);
|
||||
_max_track_size -= 1;
|
||||
_track_ready_callback.erase(index);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!_all_track_ready) {
|
||||
GET_CONFIG(uint32_t, kMaxWaitReadyMS, General::kWaitTrackReadyMS);
|
||||
if (_ticker.elapsedTime() > kMaxWaitReadyMS) {
|
||||
|
||||
Reference in New Issue
Block a user