mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 02:34:26 +08:00
compatible rtsp sdp parse no samplerate for audio (#3740)
兼容rtsp sdp协商中未声明采样率但是可以通过a 字段中fmtp中有config中解析出来的情况
This commit is contained in:
parent
9463d1291d
commit
8398ae17e4
@ -15,6 +15,7 @@
|
||||
#include "Common/Parser.h"
|
||||
#include "Common/config.h"
|
||||
#include "Network/Socket.h"
|
||||
#include "Extension/Factory.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace toolkit;
|
||||
@ -236,10 +237,6 @@ void SdpParser::load(const string &sdp) {
|
||||
track._codec = codec;
|
||||
track._samplerate = samplerate;
|
||||
}
|
||||
if (!track._samplerate && track._type == TrackVideo) {
|
||||
// 未设置视频采样率时,赋值为90000
|
||||
track._samplerate = 90000;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
|
||||
@ -260,6 +257,17 @@ void SdpParser::load(const string &sdp) {
|
||||
if (it != track._attr.end()) {
|
||||
track._control = it->second;
|
||||
}
|
||||
|
||||
if (!track._samplerate && track._type == TrackVideo) {
|
||||
// 未设置视频采样率时,赋值为90000
|
||||
track._samplerate = 90000;
|
||||
} else if (!track._samplerate && track._type == TrackAudio) {
|
||||
// some rtsp sdp no sample rate but has fmt config to parser get sample rate
|
||||
auto t = Factory::getTrackBySdp(track_ptr);
|
||||
if (t) {
|
||||
track._samplerate = std::static_pointer_cast<AudioTrack>(t)->getAudioSampleRate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user