更新media-server库

This commit is contained in:
xiongziliang 2019-12-12 22:25:55 +08:00
parent 2a518493d7
commit ee66d945e8
3 changed files with 13 additions and 17 deletions

@ -1 +1 @@
Subproject commit 4325386be318889b7815cdd86a2e83f05a059c81
Subproject commit 8d40dad3dbdce171756691d4511aca49fcf2a231

View File

@ -180,6 +180,9 @@ CodecId Factory::getCodecIdByAmf(const AMFValue &val){
if(str == "mp4a"){
return CodecAAC;
}
if(str == "hev1" || str == "hvc1"){
return CodecH265;
}
WarnL << "暂不支持该Amf:" << str;
return CodecInvalid;
}
@ -187,12 +190,9 @@ CodecId Factory::getCodecIdByAmf(const AMFValue &val){
if (val.type() != AMF_NULL){
auto type_id = val.as_integer();
switch (type_id){
case 7:{
return CodecH264;
}
case 10:{
return CodecAAC;
}
case 7: return CodecH264;
case 10: return CodecAAC;
case 12: return CodecH265;
default:
WarnL << "暂不支持该Amf:" << type_id;
return CodecInvalid;
@ -219,14 +219,10 @@ RtmpCodec::Ptr Factory::getRtmpCodecByTrack(const Track::Ptr &track) {
AMFValue Factory::getAmfByCodecId(CodecId codecId) {
switch (codecId){
case CodecAAC:{
return AMFValue("mp4a");
}
case CodecH264:{
return AMFValue("avc1");
}
default:
return AMFValue(AMF_NULL);
case CodecAAC: return AMFValue("mp4a");
case CodecH264: return AMFValue("avc1");
case CodecH265: return AMFValue(12);
default: return AMFValue(AMF_NULL);
}
}

View File

@ -152,7 +152,7 @@ void MP4Muxer::addTrack(const Track::Ptr &track) {
struct mpeg4_avc_t avc;
string sps_pps = string("\x00\x00\x00\x01", 4) + h264_track->getSps() +
string("\x00\x00\x00\x01", 4) + h264_track->getPps();
h264_annexbtomp4(&avc, sps_pps.data(), sps_pps.size(), NULL, 0, NULL);
h264_annexbtomp4(&avc, sps_pps.data(), sps_pps.size(), NULL, 0, NULL, NULL);
uint8_t extra_data[1024];
int extra_data_size = mpeg4_avc_decoder_configuration_record_save(&avc, extra_data, sizeof(extra_data));
@ -186,7 +186,7 @@ void MP4Muxer::addTrack(const Track::Ptr &track) {
string vps_sps_pps = string("\x00\x00\x00\x01", 4) + h265_track->getVps() +
string("\x00\x00\x00\x01", 4) + h265_track->getSps() +
string("\x00\x00\x00\x01", 4) + h265_track->getPps();
h265_annexbtomp4(&hevc, vps_sps_pps.data(), vps_sps_pps.size(), NULL, 0, NULL);
h265_annexbtomp4(&hevc, vps_sps_pps.data(), vps_sps_pps.size(), NULL, 0, NULL, NULL);
uint8_t extra_data[1024];
int extra_data_size = mpeg4_hevc_decoder_configuration_record_save(&hevc, extra_data, sizeof(extra_data));