{"id":5773,"date":"2026-05-26T14:10:00","date_gmt":"2026-05-26T05:10:00","guid":{"rendered":"https:\/\/www.freelifemakers.org\/wordpress\/?p=5773"},"modified":"2026-05-26T14:23:43","modified_gmt":"2026-05-26T05:23:43","slug":"mediaserver-mini_mediaserver_1-code-description-process_complete_message1-6","status":"publish","type":"post","link":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/2026\/05\/26\/mediaserver-mini_mediaserver_1-code-description-process_complete_message1-6\/","title":{"rendered":"[Mediaserver]mini_Mediaserver_1-\ucf54\ub4dc\uc124\uba85\/code description-process_complete_message()(1-6)"},"content":{"rendered":"\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>type<\/th><th>\uc774\ub984\/Name<\/th><th>\uc758\ubbf8\/Description<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>Set Chunk Size<\/td><td>chunk_size_in_ \ubcc0\uacbd. \uae30\ubcf8 128 \u2192 \ub354 \ud070 \uac12\uc73c\ub85c \/ <br>Change chunk_size_in_. Default 128 \u2192 to a larger value<\/td><\/tr><tr><td>3<\/td><td>Acknowledgement<\/td><td>\ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc804\uc1a1\ud55c \ub370\uc774\ud130\uc591\uc744 \uc54c\ub9bc \/ Notify the amount of data sent by the client<\/td><\/tr><tr><td>4<\/td><td>User Control<\/td><td>Ping\/Pong, \uc2a4\ud2b8\ub9bc \uc81c\uc5b4 \/ stream control<\/td><\/tr><tr><td>5<\/td><td>Window Ack Size<\/td><td>Ack \ubcf4\ub0bc \uc6a9\ub7c9 \uc124\uc815. (5MB) \/ <br>Set ACK sending capacity. (5MB)<\/td><\/tr><tr><td>8<\/td><td>Audio Data<\/td><td>\uc624\ub514\uc624 \ud504\ub808\uc784 \ub370\uc774\ud130(payload)\/<br>Audio frame data (payload)<\/td><\/tr><tr><td>9<\/td><td>Video Data<\/td><td>\ube44\ub514\uc624 \ud504\ub808\uc784 H264 \ub370\uc774\ud130(payload) \/ <br>Video frame H264 data (payload)<\/td><\/tr><tr><td>18<\/td><td>AMF0 Data<\/td><td>onMetaData, @setDataFrame \ub4f1 \uba54\ud0c0 \uc815\ubcf4 \/ meta information<\/td><\/tr><tr><td>20<\/td><td>AMF0 Command<\/td><td>connect, publish, play \uac19\uc740 \uba85 \/ Commands like connect, publish, and play<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u2714\ufe0f \ud551\ud401\uc81c\uc5b4 \/ Ping pong control<\/p>\n\n\n\n<p>&#8212; cur_msg_type_ == 4 \uc740 Ping Pong \uc2a4\ud2b8\ub9bc\uc81c\uc5b4\uc5d0 \ub300\ud55c \ubd80\ubd84\uc785\ub2c8\ub2e4.<br>cur_msg_type_ == 4 is the part regarding Ping Pong stream control.<\/p>\n\n\n\n<p>&#8212; ping\uc694\uccad\uc774 \ub4e4\uc5b4\uc654\uc744\ub584 \uc751\ub2f5\uc744 \uad6c\uc131\ud558\ub294 \ubd80\ubd84\uc785\ub2c8\ub2e4.<br>This is the part that configures the response when a ping request is received.<\/p>\n\n\n\n<p>&#8212; pong = [\ud5e4\ub354 (Header)] + [\ud0c0\uc785 \uc2dd\ubcc4\uc790 (Type)] + [\uc2e4\uc81c \ub370\uc774\ud130 (Payload)]<br>pong = [Header] + [Type Identifier] + [Actual Data (Payload)]<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>std::vector&lt;uint8_t&gt; pong;\npong.push_back(0x02);\npong.insert(pong.end(), {0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04});\npong.insert(pong.end(), {0x00, 0x00, 0x00, 0x00});\npong.insert(pong.end(), {0x00, 0x07}); \/\/ Pong\npong.insert(pong.end(), payload_buf_.begin() + 2, payload_buf_.begin() + 6);\nasio::write(socket_, asio::buffer(pong));\nstd::cout &lt;&lt; \"&#91;Server] Pong sent\\n\";<\/code><\/pre>\n\n\n\n<p>&#8212; \ud328\ud0b7 \uad6c\uc870\ub3c4 \/ packet structure diagram<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-left\" data-align=\"left\">\ubc14\uc774\ud2b8 \uadf8\ub8f9 \/ byte group<\/th><th class=\"has-text-align-left\" data-align=\"left\">\uc5ed\ud560 \/ role<\/th><th class=\"has-text-align-left\" data-align=\"left\">\uc124\uba85\/Description<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>0x02<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">\uc0c1\ud0dc\/\ubc84\uc804 \ud50c\ub798\uadf8<br>Status\/Version Flags<\/td><td class=\"has-text-align-left\" data-align=\"left\">\uc804\uccb4 \ud328\ud0b7\uc758 \ucd08\uae30 \uc0c1\ud0dc \ub610\ub294 \ubc84\uc804 \uc9c0\uc815<br>Specifying the initial state or version of the entire packet<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>{0x00, ..., 0x04}<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">\uba54\uc2dc\uc9c0 \ud5e4\ub354<br>message header<\/td><td class=\"has-text-align-left\" data-align=\"left\">\uba54\uc2dc\uc9c0\uc758 \ud06c\uae30, \uae38\uc774, \uc804\uc1a1 \uacbd\ub85c \ub4f1 \uad6c\uc870\uc801 \uc815\ubcf4\ub97c \uc815\uc758<br>Defines structural information such as message size, length, and transmission path.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>{0x00, x00, x00, x00}<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">\uc608\ube44\/\ud328\ub529 \ud544\ub4dc<br>Spare\/Padded Field<\/td><td class=\"has-text-align-left\" data-align=\"left\">\ubbf8\ub798 \ud655\uc7a5\uc774\ub098 \ub370\uc774\ud130 \uc815\ub82c\uc744 \uc704\ud55c \uacf5\uac04<br>Space for future expansion or data alignment<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>{0x00, 0x07}<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">\uba54\uc2dc\uc9c0 \ud0c0\uc785 <br>Message Type<\/td><td class=\"has-text-align-left\" data-align=\"left\">Pong \uc751\ub2f5\uc120\uc5b8<br>Pong response declaration<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>(payload_buf...<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">\uc2e4\uc81c \ub370\uc774\ud130 <br>Payload<\/td><td class=\"has-text-align-left\" data-align=\"left\">Ping\uc744 \ubc1b\uc558\uc744 \ub54c \uc694\uccad\ubc1b\uc740 \ubcf8\ubb38 \ub370\uc774\ud130\ub97c \uadf8\ub300\ub85c \ubc18\uc0ac(Echo)\ud558\uc5ec \ud3ec\ud568<br>When a ping is received, the requested body data is reflected (echoed) and included as is.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>&#8212; payload_buf_.begin() + 2\uacfc payload_buf_.begin() + 6<\/p>\n\n\n\n<p>1)payload_buf_begin() = [0],payload_buf_begin() + 2 = [2],payload_buf_begin() + 6 = [6]<\/p>\n\n\n\n<p>2) \ud558\uc9c0\ub9cc [6]\uc740 \ud3ec\ud568\uc548\ub429\ub2c8\ub2e4.<br>However, [6] is not included.<\/p>\n\n\n\n<p>3) payload \ubc30\uc5f4\uc758 \uc138 \ubc88\uc9f8 \ubc14\uc774\ud2b8\ubd80\ud130 \uc5ec\uc12f \ubc88\uc9f8 \ubc14\uc774\ud2b8 \uc9c1\uc804\uae4c\uc9c0\uc758 \ub370\uc774\ud130\ub97c \uac00\uc838\uc640\uc11c pong \ubc84\ud37c\uc5d0 \ubd99\uc785\ub2c8\ub2e4.<br>It retrieves data from the payload array from the third byte up to just before the sixth byte and appends it to the pong buffer.<\/p>\n\n\n\n<p>4) \uadf8\ub7fc \uac12\ub4e4\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<br>Then the values \u200b\u200bare as follows.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \uc804\uccb4 \ubc30\uc5f4 \/ full array\n\n{ 0x02,0x00, &#91;0x00, 0x00, 0x00, 0x00,] 0x06, 0x04,0x00, 0x00, 0x00, 0x00,0x00, 0x07 }\n\n# pong.insert(pong.end(), payload_buf_.begin() + 2, payload_buf_.begin() + 6);\n# poing.insert(pong.end(),start, end); --&gt; start\ubd80\ud130 end\uae4c\uc9c0  \/ From start to end\n# \ubc14\ub85c \uc704\uc758 \ucf54\ub4dc\uac00 \uc2e4\ud589\ub420\ub584 pong\uc5d0 \ucd94\uac00\ub418\ub294 \ubc30\uc5f4\n# Array added to pong when the code immediately above is executed\n\n&#91;0x00, 0x00, 0x00, 0x00,]<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f AMF0 Command<\/p>\n\n\n\n<p>&#8212; \ub098\uc911\uc5d0 \ub530\ub85c \uc124\uba85\ud569\ub2c8\ub2e4.<br>This will be explained separately later.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>else if (cur_msg_type_ == 20) {\n        handle_command();\n}<\/code><\/pre>\n\n\n\n<p>\u2714\ufe0f Audio Data<\/p>\n\n\n\n<p>&#8212; flv_write.cpp\uc5d0\uc11c \ub530\ub85c \uc124\uba85\ud569\ub2c8\ub2e4.<br>This is explained separately in flv_write.cpp.<\/p>\n\n\n\n<p>\u2714\ufe0f Video Data<\/p>\n\n\n\n<p>&#8212; flv_write.cpp\uc5d0\uc11c \ub530\ub85c \uc124\uba85\ud569\ub2c8\ub2e4.<br>This is explained separately in flv_write.cpp.<\/p>\n\n\n\n<p>&#8212; \ud398\uc774\ub85c\ub4dc\uc5d0 \ub2f4\uae30\ub294 \ubaa8\ub4e0 \uac83\uc740 \ubc14\uc774\ud2b8(0~255\uc758 \uc22b\uc790 \uac12) \uc785\ub2c8\ub2e4.<br>Everything contained in the payload is a byte (numerical value from 0 to 255).<\/p>\n\n\n\n<p>&#8212; \uc774\ub7f0 \uc22b\uc790\ub4e4\uc740 \ud504\ub85c\ud1a0\ucf5c\uc5d0 \ub530\ub77c \uc601\uc0c1\ud30c\uc77c\ub85c \ud30c\uc2f1\ub429\ub2c8\ub2e4.<br>These numbers are parsed into an image file according to the protocol.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>else if (cur_msg_type_ == 9) {\n        if (payload_buf_.size() &gt;= 1 &amp;&amp; (payload_buf_&#91;0] &amp; 0x0F) == 7) {\n            flv_writer_-&gt;write_tag(0x09, cur_msg_timestamp_, payload_buf_);\n        }\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>type \uc774\ub984\/Name \uc758\ubbf8\/Description 1 Set Chunk Size chunk_size_in_ \ubcc0\uacbd. \uae30\ubcf8 128 \u2192 \ub354 \ud070 \uac12\uc73c\ub85c \/ Change chunk_size_in_. Default 128 \u2192 to a larger value 3 Acknowledgement \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc804\uc1a1\ud55c \ub370\uc774\ud130\uc591\uc744 \uc54c\ub9bc \/ Notify the amount of data sent by the client 4 User Control Ping\/Pong, \uc2a4\ud2b8\ub9bc \uc81c\uc5b4 \/ stream control 5 Window Ack Size Ack [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,1],"tags":[],"class_list":["post-5773","post","type-post","status-publish","format-standard","hentry","category-cpp","category-uncategorized","missing-thumbnail"],"_links":{"self":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5773","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=5773"}],"version-history":[{"count":4,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5773\/revisions"}],"predecessor-version":[{"id":5777,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/5773\/revisions\/5777"}],"wp:attachment":[{"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=5773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=5773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.freelifemakers.org\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=5773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}