1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-11-30 04:39:03 +01:00

Small fixes

This commit is contained in:
Daniil Gentili 2020-03-10 22:51:37 +01:00
parent eb3bc4e5b3
commit c81037e7ca
5 changed files with 12 additions and 8 deletions

View File

@ -399,7 +399,7 @@ public:
{
int32_t userID;
uint8_t id;
StreamInfo::StreamType type;
StreamInfo::Type type;
uint32_t codec;
bool enabled;
bool extraECEnabled;
@ -443,7 +443,7 @@ protected:
void InitializeTimers();
void ResetEndpointPingStats();
void ProcessIncomingVideoFrame(Buffer frame, uint32_t pts, bool keyframe, uint16_t rotation);
std::shared_ptr<Stream> GetStreamByType(StreamInfo::StreamType type, bool outgoing);
std::shared_ptr<Stream> GetStreamByType(StreamInfo::Type type, bool outgoing);
std::shared_ptr<Stream> GetStreamByID(unsigned char id, bool outgoing);
Endpoint *GetEndpointForPacket(const PendingOutgoingPacket &pkt);
Endpoint *GetEndpointById(const int64_t id);

View File

@ -133,3 +133,6 @@ enum ProtocolVersions
#define LEGACY_PFLAG_HAS_SEQ 16
#define LEGACY_PFLAG_HAS_RECENT_RECV 32
#define LEGACY_PFLAG_HAS_SENDER_TAG_HASH 64
#include "protocol/protocol/Extra.h"

View File

@ -16,9 +16,8 @@ VoIPController::~VoIPController()
abort();
}
for (auto _stm = incomingStreams.begin(); _stm != incomingStreams.end(); ++_stm)
for (auto &stm : incomingStreams)
{
shared_ptr<Stream> stm = *_stm;
LOGD("before stop decoder");
if (stm->decoder)
{
@ -153,7 +152,7 @@ void VoIPController::SetMicMute(bool mute)
messageThread.Post([this] {
for (shared_ptr<Stream> &s : outgoingStreams)
{
if (s->type == STREAM_TYPE_AUDIO)
if (s->type == StreamInfo::Type::Audio)
{
s->enabled = !micMuted;
if (peerVersion < 6)
@ -203,7 +202,7 @@ string VoIPController::GetDebugString()
snprintf(buffer, sizeof(buffer), "%s:%u %dms %d 0x%" PRIx64 " [%s%s]\n", endpoint.address.IsEmpty() ? ("[" + endpoint.v6address.ToString() + "]").c_str() : endpoint.address.ToString().c_str(), endpoint.port, (int)(endpoint.averageRTT * 1000), endpoint.udpPongCount, (uint64_t)endpoint.id, type, currentEndpoint == endpoint.id ? ", IN_USE" : "");
r += buffer;
}
AudioPacketSender *sender = dynamic_cast<AudioPacketSender *>(GetStreamByType(STREAM_TYPE_AUDIO, true)->packetSender.get());
AudioPacketSender *sender = dynamic_cast<AudioPacketSender *>(GetStreamByType(StreamInfo::Type::Audio, true)->packetSender.get());
if (sender->getShittyInternetMode())
{
snprintf(buffer, sizeof(buffer), "ShittyInternetMode: level %u\n", sender->getExtraEcLevel());

View File

@ -34,14 +34,14 @@ public:
bool parse(const BufferInputStream &in, const VersionInfo &ver) override;
void serialize(BufferOutputStream &out, const VersionInfo &ver) const override;
enum StreamType : uint8_t
enum Type : uint8_t
{
Audio = 1,
Video
};
uint8_t streamId = 0;
StreamType type = StreamType::Audio;
Type type = Type::Audio;
Codec codec;
uint16_t frameDuration = 0;
bool enabled = false;

View File

@ -5,6 +5,8 @@
//
#pragma once
#include <numeric>
#include <algorithm>
#define TGVOIP_DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&) = delete; \