mirror of
https://github.com/danog/libtgvoip.git
synced 2024-11-26 20:24:38 +01:00
Small fixes
This commit is contained in:
parent
656840b57a
commit
ed54b36464
@ -409,7 +409,7 @@ protected:
|
||||
|
||||
void SendPacket(OutgoingPacket &&pkt, double retryInterval = 0.5, double timeout = 5.0, uint8_t tries = 0);
|
||||
|
||||
bool SendOrEnqueuePacket(PendingOutgoingPacket &pkt, bool enqueue = true);
|
||||
void SendOrEnqueuePacket(PendingOutgoingPacket &pkt, bool enqueue = true);
|
||||
void SendPacketReliably(PendingOutgoingPacket &pkt, double retryInterval, double timeout, uint8_t tries = 0xFF);
|
||||
|
||||
void SendNopPacket(int64_t endpointId = 0, double retryInterval = 0.5, double timeout = 5.0, uint8_t tries = 0);
|
||||
|
@ -8,7 +8,7 @@ using namespace std;
|
||||
void VoIPController::InitializeAudio()
|
||||
{
|
||||
double t = GetCurrentTime();
|
||||
auto &outgoingAudioStream = GetStreamByType<AudioStream>(StreamType::Audio, true);
|
||||
auto &outgoingAudioStream = GetStreamByType<OutgoingAudioStream>();
|
||||
LOGI("before create audio io");
|
||||
audioIO = audio::AudioIO::Create(currentAudioInput, currentAudioOutput);
|
||||
audioInput = audioIO->GetInput();
|
||||
@ -43,7 +43,7 @@ void VoIPController::InitializeAudio()
|
||||
encoder->AddAudioEffect(inputVolume);
|
||||
}
|
||||
|
||||
dynamic_cast<AudioPacketSender *>(outgoingAudioStream->packetSender.get())->SetSource(encoder);
|
||||
outgoingAudioStream->packetSender->SetSource(encoder);
|
||||
|
||||
#if defined(TGVOIP_USE_CALLBACK_AUDIO_IO)
|
||||
dynamic_cast<audio::AudioInputCallback *>(audioInput.get())->SetDataCallback(audioInputDataCallback);
|
||||
@ -85,7 +85,7 @@ void VoIPController::StartAudio()
|
||||
void VoIPController::OnAudioOutputReady()
|
||||
{
|
||||
LOGI("Audio I/O ready");
|
||||
auto &stm = GetStreamByID<AudioStream>(StreamId::Audio, false);
|
||||
auto &stm = GetStreamByID<IncomingAudioStream>(StreamId::Audio);
|
||||
stm->decoder = make_shared<OpusDecoder>(audioOutput, true, ver.peerVersion >= 6);
|
||||
stm->decoder->SetEchoCanceller(echoCanceller);
|
||||
if (config.enableVolumeControl)
|
||||
|
@ -104,7 +104,7 @@ void VoIPController::RunRecvThread()
|
||||
LOGE("Packet has null address. This shouldn't happen.");
|
||||
continue;
|
||||
}
|
||||
if (packet.data.IsEmpty())
|
||||
if (packet.data->IsEmpty())
|
||||
{
|
||||
LOGE("Packet has zero length.");
|
||||
continue;
|
||||
|
@ -60,7 +60,6 @@ void VoIPController::SendPacket(OutgoingPacket &&pkt, double retryInterval, doub
|
||||
packet.serializeLegacy(out, ver, state, callID);
|
||||
legacyPm.setLocalSeq(packet.legacySeq);
|
||||
|
||||
size_t length = 0;
|
||||
for (auto &t : out)
|
||||
{
|
||||
auto res = PreparePacket(std::get<0>(t), std::get<1>(t), endpoint, CongestionControlPacket(seq++, StreamId::Signaling));
|
||||
@ -76,7 +75,7 @@ void VoIPController::SendPacket(OutgoingPacket &&pkt, double retryInterval, doub
|
||||
}
|
||||
}
|
||||
|
||||
bool VoIPController::SendOrEnqueuePacket(PendingOutgoingPacket &pkt, bool enqueue)
|
||||
void VoIPController::SendOrEnqueuePacket(PendingOutgoingPacket &pkt, bool enqueue)
|
||||
{
|
||||
Endpoint &endpoint = *GetEndpointForPacket(pkt);
|
||||
bool canSend;
|
||||
@ -113,7 +112,7 @@ bool VoIPController::SendOrEnqueuePacket(PendingOutgoingPacket &pkt, bool enqueu
|
||||
LOGW("Not ready to send - enqueueing");
|
||||
sendQueue.push_back(move(pkt));
|
||||
}
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if ((endpoint.type == Endpoint::Type::TCP_RELAY && useTCP) || (endpoint.type != Endpoint::Type::TCP_RELAY && useUDP))
|
||||
{
|
||||
@ -140,7 +139,7 @@ bool VoIPController::SendOrEnqueuePacket(PendingOutgoingPacket &pkt, bool enqueu
|
||||
//LOGV("Sending: to=%s:%u, seq=%u, length=%u, type=%s, streamId=%hhu", ep.GetAddress().ToString().c_str(), ep.port, seq, (unsigned int)out.GetLength(), GetPacketTypeString(type).c_str(), streamId);
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
void VoIPController::SendInit()
|
||||
|
@ -18,7 +18,7 @@ void VoIPController::ProcessIncomingPacket(NetworkPacket &npacket, Endpoint &src
|
||||
// Initial packet decryption and recognition
|
||||
|
||||
unsigned char *buffer = **npacket.data;
|
||||
size_t len = npacket.data->Length();
|
||||
//size_t len = npacket.data->Length();
|
||||
BufferInputStream in(*npacket.data);
|
||||
if (ver.peerVersion < 9 || srcEndpoint.IsReflector())
|
||||
{
|
||||
|
@ -30,6 +30,10 @@ struct VideoStreamInfo : public MediaStreamInfo
|
||||
unsigned int width = 0;
|
||||
unsigned int height = 0;
|
||||
uint16_t rotation = 0;
|
||||
|
||||
std::vector<Buffer> codecSpecificData;
|
||||
bool csdIsValid = false;
|
||||
|
||||
int resolution;
|
||||
};
|
||||
|
||||
|
@ -62,8 +62,6 @@ struct IncomingVideoStream : public VideoStreamInfo, public IncomingStream
|
||||
IncomingVideoStream(uint8_t _id = Packet::StreamId::Video) : IncomingStream(_id, TYPE){};
|
||||
|
||||
std::shared_ptr<PacketReassembler> packetReassembler;
|
||||
std::vector<Buffer> codecSpecificData;
|
||||
bool csdIsValid = false;
|
||||
|
||||
static const StreamType TYPE = StreamType::Video;
|
||||
static const bool OUTGOING = false;
|
||||
|
@ -11,7 +11,7 @@
|
||||
using namespace tgvoip;
|
||||
using namespace tgvoip::video;
|
||||
|
||||
VideoPacketSender::VideoPacketSender(VoIPController *controller, const std::shared_ptr<Stream> &stream, VideoSource *videoSource) : PacketSender(controller, stream)
|
||||
VideoPacketSender::VideoPacketSender(VoIPController *controller, const std::shared_ptr<OutgoingVideoStream> &stream, VideoSource *videoSource) : PacketSender(controller, stream)
|
||||
{
|
||||
SetSource(videoSource);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class VideoSource;
|
||||
class VideoPacketSender : public PacketSender
|
||||
{
|
||||
public:
|
||||
VideoPacketSender(VoIPController *controller, const std::shared_ptr<VideoStream> &stream, VideoSource *videoSource);
|
||||
VideoPacketSender(VoIPController *controller, const std::shared_ptr<OutgoingVideoStream> &stream, VideoSource *videoSource);
|
||||
virtual ~VideoPacketSender();
|
||||
virtual void PacketAcknowledged(const RecentOutgoingPacket &packet) override;
|
||||
virtual void PacketLost(const RecentOutgoingPacket &packet) override;
|
||||
|
Loading…
Reference in New Issue
Block a user