Fixed audio issue
This commit is contained in:
parent
dbd8e73ab5
commit
58d4e1489b
@ -147,7 +147,7 @@ void UDPSocket::callback_read(evutil_socket_t fd) {
|
|||||||
source_address_length = sizeof(sockaddr);
|
source_address_length = sizeof(sockaddr);
|
||||||
read_length = recvfrom(fd, (char*) buffer, (int) buffer_length, MSG_DONTWAIT, &source_address, &source_address_length);
|
read_length = recvfrom(fd, (char*) buffer, (int) buffer_length, MSG_DONTWAIT, &source_address, &source_address_length);
|
||||||
if(read_length <= 0) {
|
if(read_length <= 0) {
|
||||||
if(errno == EAGAIN || read_length == 0)
|
if(errno == EAGAIN || (read_length == 0 && read_count > 0))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
logger::warn(category::socket, tr("Failed to receive data: {}/{}"), errno, strerror(errno));
|
logger::warn(category::socket, tr("Failed to receive data: {}/{}"), errno, strerror(errno));
|
||||||
|
@ -227,7 +227,7 @@ VoiceClient::VoiceClient(const std::shared_ptr<VoiceConnection>&, uint16_t clien
|
|||||||
this->set_state(state::buffering);
|
this->set_state(state::buffering);
|
||||||
}
|
}
|
||||||
|
|
||||||
audio::decode_event_loop->schedule(dynamic_pointer_cast<event::EventEntry>(this->ref()));
|
audio::decode_event_loop->schedule(static_pointer_cast<event::EventEntry>(this->ref()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ void VoiceClient::process_packet(uint16_t packet_id, const pipes::buffer_view& b
|
|||||||
codec_data.process_pending = true;
|
codec_data.process_pending = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
audio::decode_event_loop->schedule(dynamic_pointer_cast<event::EventEntry>(this->ref()));
|
audio::decode_event_loop->schedule(static_pointer_cast<event::EventEntry>(this->ref()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoiceClient::cancel_replay() {
|
void VoiceClient::cancel_replay() {
|
||||||
@ -376,7 +376,7 @@ void VoiceClient::cancel_replay() {
|
|||||||
|
|
||||||
this->output_source->clear();
|
this->output_source->clear();
|
||||||
this->set_state(state::stopped);
|
this->set_state(state::stopped);
|
||||||
audio::decode_event_loop->cancel(dynamic_pointer_cast<event::EventEntry>(this->ref()));
|
audio::decode_event_loop->cancel(static_pointer_cast<event::EventEntry>(this->ref()));
|
||||||
|
|
||||||
auto execute_lock = this->execute_lock(true);
|
auto execute_lock = this->execute_lock(true);
|
||||||
for(auto& codec : this->codec) {
|
for(auto& codec : this->codec) {
|
||||||
@ -549,7 +549,7 @@ void VoiceClient::event_execute(const std::chrono::system_clock::time_point &sch
|
|||||||
if(reschedule) {
|
if(reschedule) {
|
||||||
log_warn(category::voice_connection, tr("Audio data decode will take longer than {} us. Enqueueing for later"),
|
log_warn(category::voice_connection, tr("Audio data decode will take longer than {} us. Enqueueing for later"),
|
||||||
chrono::duration_cast<chrono::microseconds>(max_time).count());
|
chrono::duration_cast<chrono::microseconds>(max_time).count());
|
||||||
audio::decode_event_loop->schedule(dynamic_pointer_cast<event::EventEntry>(this->ref()));
|
audio::decode_event_loop->schedule(static_pointer_cast<event::EventEntry>(this->ref()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,8 +49,14 @@ namespace tc {
|
|||||||
class VoiceClient : private event::EventEntry {
|
class VoiceClient : private event::EventEntry {
|
||||||
friend class VoiceConnection;
|
friend class VoiceConnection;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
template<typename _Tp, typename _Up>
|
||||||
|
friend _NODISCARD std::shared_ptr<_Tp> std::static_pointer_cast(std::shared_ptr<_Up>&& _Other) noexcept;
|
||||||
|
#else
|
||||||
template<typename _Tp, typename _Up>
|
template<typename _Tp, typename _Up>
|
||||||
friend inline std::shared_ptr<_Tp> std::static_pointer_cast(const std::shared_ptr<_Up>& __r) noexcept;
|
friend inline std::shared_ptr<_Tp> std::static_pointer_cast(const std::shared_ptr<_Up>& __r) noexcept;
|
||||||
|
#endif
|
||||||
|
//_NODISCARD shared_ptr<_Ty1> static_pointer_cast(shared_ptr<_Ty2>&& _Other) noexcept
|
||||||
public:
|
public:
|
||||||
struct state {
|
struct state {
|
||||||
enum value {
|
enum value {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "TeaClient",
|
"name": "TeaClient",
|
||||||
"version": "1.4.2-4",
|
"version": "1.4.2-5",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user