Send Opus packets as generic RTP packets
In the future we may want to include the Opus header for versatility but for now Opus packets can be just send without the header
This commit is contained in:
parent
645beb08d7
commit
09d1c8e0a4
|
@ -2,19 +2,34 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "conn.hh"
|
||||
#include "debug.hh"
|
||||
#include "rtp_opus.hh"
|
||||
#include "rtp_generic.hh"
|
||||
|
||||
int RTPOpus::pushOpusFrame(RTPConnection *conn, uint8_t *data, uint32_t dataLen, uint32_t timestamp)
|
||||
{
|
||||
if (!conn || !data)
|
||||
return RTP_INVALID_VALUE;
|
||||
|
||||
#if 0
|
||||
uint8_t buffer[MAX_PACKET] = { 0 };
|
||||
RTPOpus::OpusConfig *config = (RTPOpus::OpusConfig *)conn->getConfig();
|
||||
|
||||
LOG_DEBUG("sending opus packet of size %u", dataLen);
|
||||
|
||||
if (config == nullptr) {
|
||||
LOG_ERROR("Opus config has not been set!");
|
||||
return RTP_INVALID_VALUE;
|
||||
}
|
||||
|
||||
buffer[0] = (config->configurationNumber << 3) |
|
||||
(config->channels > 1 ? (1 << 2) : 0) | 0;
|
||||
|
||||
memcpy(&buffer[1], data, dataLen);
|
||||
conn->setPayloadType(RTP_FORMAT_OPUS);
|
||||
|
||||
return RTPGeneric::pushGenericFrame(conn, buffer, dataLen + 1, 0);
|
||||
#endif
|
||||
|
||||
conn->setPayloadType(RTP_FORMAT_OPUS);
|
||||
return RTPGeneric::pushGenericFrame(conn, data, dataLen, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue