Skip to content

Commit 75fcf90

Browse files
author
eagleychen
committed
revert msg
1 parent fd3c12a commit 75fcf90

File tree

1 file changed

+1
-35
lines changed

1 file changed

+1
-35
lines changed

ijkmedia/ijkplayer/ff_ffmsg_queue.h

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -151,49 +151,15 @@ 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-
159154
AVMessage msg;
160155
msg_init_msg(&msg);
161156
msg.what = what;
162157
msg.arg1 = arg1;
163158
msg.arg2 = arg2;
164-
165-
// 分配内存并检查是否成功
166159
msg.obj = av_malloc(obj_len);
167-
if (!msg.obj) {
168-
av_log(NULL, AV_LOG_ERROR, "msg_queue_put_simple4: 内存分配失败 size=%d\n", obj_len);
169-
return;
170-
}
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");
186-
187-
// 安全拷贝数据
188160
memcpy(msg.obj, obj, obj_len);
189161
msg.free_l = msg_obj_free_l;
190-
191-
// 放入队列
192-
if (msg_queue_put(q, &msg) < 0) {
193-
// 如果放入队列失败,释放已分配的内存
194-
msg_obj_free_l(msg.obj);
195-
av_log(NULL, AV_LOG_WARNING, "msg_queue_put_simple4: 放入消息队列失败\n");
196-
}
162+
msg_queue_put(q, &msg);
197163
}
198164

199165
inline static void msg_queue_init(MessageQueue *q)

0 commit comments

Comments
 (0)