mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 14:45:55 +08:00
优先使用静态 payload type 值 (#1206)
This commit is contained in:
parent
e51a78ebdc
commit
9aaf3ce2ff
@ -58,7 +58,18 @@ Sdp::Ptr G711Track::getSdp() {
|
|||||||
WarnL << getCodecName() << " Track未准备好";
|
WarnL << getCodecName() << " Track未准备好";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return std::make_shared<G711Sdp>(getCodecId(), getAudioSampleRate(), getAudioChannel(), getBitRate() / 1024);
|
|
||||||
|
const auto codec = getCodecId();
|
||||||
|
const auto sample_rate = getAudioSampleRate();
|
||||||
|
const auto audio_channel = getAudioChannel();
|
||||||
|
const auto bitrate = getBitRate() >> 10;
|
||||||
|
auto payload_type = 98;
|
||||||
|
if (sample_rate == 8000 && audio_channel == 1) {
|
||||||
|
// https://datatracker.ietf.org/doc/html/rfc3551#section-6
|
||||||
|
payload_type = (codec == CodecG711U) ? Rtsp::PT_PCMU : Rtsp::PT_PCMA;
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::make_shared<G711Sdp>(codec, sample_rate, audio_channel, bitrate, payload_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace mediakit
|
}//namespace mediakit
|
||||||
|
Loading…
Reference in New Issue
Block a user