- fixes for pvqa_pcap project - lazy creation of codecs + compare timespec structures
This commit is contained in:
@@ -420,13 +420,10 @@ bool AudioReceiver::add(const std::shared_ptr<jrtplib::RTPPacket>& p, Codec** co
|
||||
return false; // Reject packet with unknown payload type
|
||||
}
|
||||
|
||||
// Check if codec is created actually
|
||||
// Check if codec is creating lazily
|
||||
if (!codecIter->second)
|
||||
{
|
||||
// Look for ptype
|
||||
for (int codecIndex = 0; codecIndex < mCodecList.count(); codecIndex++)
|
||||
if (mCodecList.codecAt(codecIndex).payloadType() == p->GetPayloadType())
|
||||
codecIter->second = mCodecList.codecAt(codecIndex).create();
|
||||
codecIter->second = mCodecList.createCodecByPayloadType(ptype);
|
||||
}
|
||||
|
||||
// Return pointer to codec if needed.get()
|
||||
|
||||
@@ -407,11 +407,21 @@ void CodecList::fillCodecMap(CodecMap& cm)
|
||||
for (auto& factory: mFactoryList)
|
||||
{
|
||||
// Create codec here. Although they are not needed right now - they can be needed to find codec's info.
|
||||
PCodec c = factory->create();
|
||||
cm.insert({factory->payloadType(), c});
|
||||
// PCodec c = factory->create();
|
||||
cm.insert({factory->payloadType(), PCodec()});
|
||||
}
|
||||
}
|
||||
|
||||
PCodec CodecList::createCodecByPayloadType(int payloadType)
|
||||
{
|
||||
for (auto& factory: mFactoryList)
|
||||
{
|
||||
if (factory->payloadType() == payloadType)
|
||||
return factory->create();
|
||||
}
|
||||
return PCodec();
|
||||
}
|
||||
|
||||
CodecListPriority::CodecListPriority()
|
||||
{
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@ public:
|
||||
Codec::Factory& codecAt(int index) const;
|
||||
int findCodec(const std::string& name) const;
|
||||
void fillCodecMap(CodecMap& cm);
|
||||
PCodec createCodecByPayloadType(int payloadType);
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user