Skip to content

Commit 62e562d

Browse files
author
shimei.jmh
committed
[+] Fix: Initialize video and audio frame structures to zero to avoid core dump
1 parent 41ea48c commit 62e562d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

moq/demo/xqc_moq_demo_client.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ xqc_app_send_callback(int fd, short what, void* arg)
609609
xqc_int_t ret;
610610
if (user_conn->video_subscribe_id != -1) {
611611
uint8_t payload_video[102400] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
612-
xqc_moq_video_frame_t video_frame;
612+
xqc_moq_video_frame_t video_frame = {0};
613613
if (user_conn->request_keyframe || user_conn->video_seq % 10 == 0) {
614614
video_frame.type = XQC_MOQ_VIDEO_KEY;
615615
user_conn->request_keyframe = 0;
@@ -630,7 +630,7 @@ xqc_app_send_callback(int fd, short what, void* arg)
630630

631631
if (user_conn->audio_subscribe_id != -1) {
632632
uint8_t payload_audio[1024] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
633-
xqc_moq_audio_frame_t audio_frame;
633+
xqc_moq_audio_frame_t audio_frame = {0};
634634
audio_frame.seq_num = user_conn->audio_seq++;
635635
audio_frame.timestamp_us = xqc_now();
636636
audio_frame.audio_len = 1024;

moq/demo/xqc_moq_demo_server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ xqc_app_send_callback(int fd, short what, void* arg)
576576
xqc_int_t ret;
577577
if (user_conn->video_subscribe_id != -1) {
578578
uint8_t payload_video[1024000] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
579-
xqc_moq_video_frame_t video_frame;
579+
xqc_moq_video_frame_t video_frame = {0};
580580
if (user_conn->request_keyframe || user_conn->video_seq % 30 == 0) {
581581
video_frame.type = XQC_MOQ_VIDEO_KEY;
582582
user_conn->request_keyframe = 0;
@@ -600,7 +600,7 @@ xqc_app_send_callback(int fd, short what, void* arg)
600600

601601
/*if (user_conn->audio_subscribe_id != -1) {
602602
uint8_t payload_audio[1024] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
603-
xqc_moq_audio_frame_t audio_frame;
603+
xqc_moq_audio_frame_t audio_frame = {0};
604604
audio_frame.seq_num = user_conn->audio_seq++;
605605
audio_frame.timestamp_us = xqc_now();
606606
audio_frame.audio_len = 1024;

0 commit comments

Comments
 (0)