diff options
author | Mikhail Burakov <mburakov@mailbox.org> | 2024-05-26 08:54:53 +0200 |
---|---|---|
committer | Mikhail Burakov <mburakov@mailbox.org> | 2024-05-26 08:54:53 +0200 |
commit | aa3e079a127e25ae91d2d4059a527a70536d5d4d (patch) | |
tree | 68dd58e077d6ce755a2de74728c3dcf2a8230310 | |
parent | 8c2bb886f377d1ac1265ca4c2ac8ebc9f7fdcc5a (diff) |
Do not crash when audio capturing is disabled
-rw-r--r-- | main.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -305,15 +305,17 @@ static void OnClientConnecting(void* user) { goto drop_client; } - struct Proto proto = { - .size = (uint32_t)strlen(contexts->audio_config) + 1, - .type = PROTO_TYPE_AUDIO, - .flags = PROTO_FLAG_KEYFRAME, - .latency = 0, - }; - if (!WriteProto(contexts->client_fd, &proto, contexts->audio_config)) { - LOG("Failed to write audio configuration"); - goto drop_client; + if (contexts->audio_config) { + struct Proto proto = { + .size = (uint32_t)strlen(contexts->audio_config) + 1, + .type = PROTO_TYPE_AUDIO, + .flags = PROTO_FLAG_KEYFRAME, + .latency = 0, + }; + if (!WriteProto(contexts->client_fd, &proto, contexts->audio_config)) { + LOG("Failed to write audio configuration"); + goto drop_client; + } } return; |