Fixed RTSP VoD and added Opus codec support (both input and output)
This commit is contained in:
parent
a178fd206d
commit
b2a0bf7015
2 changed files with 19 additions and 1 deletions
|
@ -60,6 +60,7 @@ namespace Mist {
|
|||
capa["codecs"][0u][1u].append("MP3");
|
||||
capa["codecs"][0u][1u].append("AC3");
|
||||
capa["codecs"][0u][1u].append("ALAW");
|
||||
capa["codecs"][0u][1u].append("opus");
|
||||
|
||||
capa["methods"][0u]["handler"] = "rtsp";
|
||||
capa["methods"][0u]["type"] = "rtsp";
|
||||
|
@ -291,7 +292,7 @@ namespace Mist {
|
|||
if (!range.empty()) {
|
||||
range = range.substr(0, range.find('-'));
|
||||
uint64_t targetPos = 1000*atof(range.c_str());
|
||||
if (targetPos){seek(targetPos);}
|
||||
if (targetPos || myMeta.vod){seek(targetPos);}
|
||||
}
|
||||
}
|
||||
std::stringstream rangeStr;
|
||||
|
@ -589,6 +590,13 @@ namespace Mist {
|
|||
bufferLivePacket(nextPack);
|
||||
return;
|
||||
}
|
||||
if (myMeta.tracks[track].codec == "opus"){
|
||||
char * pl = pkt.getPayload();
|
||||
DTSC::Packet nextPack;
|
||||
nextPack.genericFill((pkt.getTimeStamp() - tracks[track].firstTime + 1) / ((double)myMeta.tracks[track].rate / 1000.0), 0, track, pl, pkt.getPayloadSize(), 0, false);
|
||||
bufferLivePacket(nextPack);
|
||||
return;
|
||||
}
|
||||
if (myMeta.tracks[track].codec == "AAC"){
|
||||
//assume AAC packets are single AU units
|
||||
/// \todo Support other input than single AU units
|
||||
|
@ -849,6 +857,10 @@ namespace Mist {
|
|||
}
|
||||
}
|
||||
if (trCodec == "H264"){thisTrack->codec = "H264";}
|
||||
if (trCodec == "OPUS"){
|
||||
thisTrack->codec = "opus";
|
||||
thisTrack->init = std::string("OpusHead\001\002\170\000\200\273\000\000\000\000\000", 19);
|
||||
}
|
||||
if (trCodec == "PCMA"){thisTrack->codec = "ALAW";}
|
||||
if (trCodec == "MPEG4-GENERIC"){thisTrack->codec = "AAC";}
|
||||
INFO_MSG("Incoming track %s", thisTrack->getIdentifier().c_str());
|
||||
|
|
|
@ -96,6 +96,10 @@ namespace Mist {
|
|||
mediaDesc << "a=rtpmap:101 PCMA/" << trk.rate << "/" << trk.channels << "\r\n";
|
||||
}
|
||||
mediaDesc << "a=control:track" << trk.trackID << "\r\n";
|
||||
}else if ( trk.codec == "opus") {
|
||||
mediaDesc << "m=audio 0 RTP/AVP 102" << "\r\n"
|
||||
"a=rtpmap:102 opus/" << trk.rate << "/" << trk.channels << "\r\n"
|
||||
"a=control:track" << trk.trackID << "\r\n";
|
||||
}
|
||||
return mediaDesc.str();
|
||||
}
|
||||
|
@ -115,6 +119,8 @@ namespace Mist {
|
|||
}else{
|
||||
pack = RTP::Packet(101, 1, 0, SSrc);
|
||||
}
|
||||
}else if(trk.codec == "opus"){
|
||||
pack = RTP::Packet(102, 1, 0, SSrc);
|
||||
}else{
|
||||
ERROR_MSG("Unsupported codec %s for RTSP on track %u", trk.codec.c_str(), trk.trackID);
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue