Skip to content

Commit ef90178

Browse files
committed
增加sei检查和日志打印
1 parent a7a08e2 commit ef90178

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ijkmedia/ijkplayer/ff_ffmsg_queue.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ inline static void msg_obj_free_l(void *obj)
151151

152152
inline static void msg_queue_put_simple4(MessageQueue *q, int what, int arg1, int arg2, void *obj, int obj_len)
153153
{
154+
if (!obj || obj_len <= 0) {
155+
av_log(NULL, AV_LOG_ERROR, "msg_queue_put_simple4: 无效的参数 - obj: %p, obj_len: %d\n", obj, obj_len);
156+
return;
157+
}
158+
154159
AVMessage msg;
155160
msg_init_msg(&msg);
156161
msg.what = what;
@@ -163,6 +168,21 @@ inline static void msg_queue_put_simple4(MessageQueue *q, int what, int arg1, in
163168
av_log(NULL, AV_LOG_ERROR, "msg_queue_put_simple4: 内存分配失败 size=%d\n", obj_len);
164169
return;
165170
}
171+
// 将信息合并到一条日志中
172+
char log_msg[1024] = {0};
173+
snprintf(log_msg, sizeof(log_msg),
174+
"msg_queue_put_simple4: 准备进行内存拷贝\n"
175+
"msg.obj: %p, obj: %p, obj_len: %d\n",
176+
msg.obj, obj, obj_len);
177+
178+
av_log(NULL, AV_LOG_INFO, "%s", log_msg);
179+
180+
// 打印内存状态
181+
av_log(NULL, AV_LOG_INFO, "内存状态: ");
182+
for (int i = 0; i < obj_len; ++i) {
183+
fprintf(stderr, "%02x ", ((unsigned char *) obj)[i]);
184+
}
185+
fprintf(stderr, "\n");
166186

167187
// 安全拷贝数据
168188
memcpy(msg.obj, obj, obj_len);

0 commit comments

Comments
 (0)