A method and system for monitoring the integrity of transmitted data
By opening an additional verification channel and comparing verification values during audio data transmission, the problem of the inability to detect the integrity of USB audio data transmission in existing technologies is solved, and real-time integrity detection in real-world application scenarios is achieved.
Patent Information
- Application Number
- CN202211479768.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-24
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2042-11-24
AI Technical Summary
Existing technologies cannot effectively monitor the integrity of USB audio data transmission in real-world application scenarios, especially in detecting data loss or tampering, particularly when consecutively lost bytes of 256 bytes (in multiples of the same length) are not detected.
During audio data transmission, an additional channel is opened to load a checksum, which is transmitted to the host along with the audio data. The checksum is then compared on the host, and the randomness of the audio data is used for real-time integrity detection.
It enables the detection of audio data transmission integrity in real-world application scenarios, and can detect data loss or tampering, especially the loss of the entire data packet, thus solving the problem that existing technologies cannot detect.
Smart Images

Figure CN115883525B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data integrity monitoring, and in particular to a method and system for monitoring the integrity of transmitted data. BACKGROUND
[0002] Currently, the monitoring of the integrity of data transmission of UAC (USB Audio Class) is generally performed by a characteristic data (test data) analysis method. The slave device sends continuous data of 0-255 to the host device in a loop, and the host device judges the continuity of the data after receiving the data, thereby determining whether there is data loss and tampering in the transmission, so as to monitor the integrity of the transmission.
[0003] However, the USB device sends characteristic data using the above method, rather than real audio data. Therefore, this method can only be used for laboratory evaluation in essence, and the system performs data transmission for a limited time to infer the integrity of the transmission. However, when real audio data is used in a real application environment and runs for a long time, it is impossible to monitor whether the data transmission is complete. The characteristic data is sent in a loop of 0-255 (256 bytes), that is, 0 1 2... 253 254 255 0 12... 253 254 255. If the length of the continuously lost data is an integer multiple of 256 bytes, the above method cannot detect the data loss. As shown in the figure, the host device will find that the data is still continuous when it monitors the data in the blocks, and thus determine that there is no data loss. Figure 1
[0004] The defect of the above method is caused by the implementation principle of the method. By sending characteristic data to the host device in a loop, only the data integrity during the test can be guaranteed. In a real application scenario, there is no monitoring mechanism to detect the data integrity. The coupling degree between the data blocks of the looped data of 0 to 255 is too high, and there is no characteristic identifier or data block count. Any continuous data loss of an integer multiple of 256 bytes cannot be detected.
[0005] Based on the above defects, the test duration can be increased to ensure the data transmission integrity as much as possible, but this cannot fundamentally solve the real-time audio transmission data integrity detection. Alternatively, the bit width of the characteristic data can be increased, such as using 32-bit width, which can count from 0 to 4,294,967,295, thereby solving the strong coupling problem between the data blocks. However, if there is an integer multiple of 4,294,967,295 data loss, it is still impossible to detect it. SUMMARY
[0006] In view of the above problems, the present application aims to provide a method and system for monitoring the integrity of transmitted data. Due to the randomness of audio data, if real-time data in a real application scenario is used, the host cannot know whether data loss or alteration has occurred without any guarantee. Considering the randomness of audio data, this feature can be fully utilized to check each frame of audio data, an additional channel is opened to load the check value, which is transmitted to the host together with the audio data. After receiving the audio data, the host checks each frame of data in the same way as the slave, and then compares the received check value. If the check values are consistent, it can be determined that the received data is complete. Because it is a synchronous check of transmitted data in a real application scenario, the above-mentioned defects of similar technologies are fundamentally solved.
[0007] The above application object of the present application is achieved by the following technical scheme:
[0008] A method for monitoring the integrity of transmitted data, comprising the following steps:
[0009] S1: At the USB device end, check each channel of each frame of audio data to be transmitted respectively, obtain the check values of all the channels, and transmit the check values to the USB host end together with the audio data;
[0010] S2: The USB host end receives the audio data transmitted by the USB device end, and calculates the check values of each channel in the same way as the USB device end;
[0011] S3: For each channel of each frame of audio data, the check values transmitted by the USB device end and the check values calculated by the USB host end are compared respectively. If the two check values are consistent, the data of the corresponding channel is complete, otherwise the data of the channel has been lost or altered.
[0012] Further, in step S1, further comprising:
[0013] Each channel is checked by using a method including CRC check to obtain the check values of all the channels.
[0014] Further, in step S1, further comprising:
[0015] An additional channel is opened on each frame of the audio data to load the check value of the audio data;
[0016] The check value is loaded in the head and tail of the channel, and the middle position is filled with 0.
[0017] Further, in step S1, further comprising:
[0018] For each frame of the audio data ready for transmission, a count package of the audio data is loaded on the channel for loading the check value of the audio data, for accumulating the frame number of the audio data transmission;
[0019] The count value of the count package is increased by 1 for each frame of the audio data transmitted.
[0020] Further, in step S3, further comprising:
[0021] The head and tail of the channel for loading the check value of the audio data are compared, and if the head and tail data are inconsistent, data loss or alteration of one frame of the audio data in this transmission occurs.
[0022] Further, in step S3, further comprising:
[0023] It is judged whether the count value of the count package of each frame is equal to the count value of the last frame increased by 1, if the equation is established, the audio data of the current frame is complete, otherwise data loss of the audio data package occurs.
[0024] A system for monitoring the integrity of transmission data for performing the method of monitoring the integrity of transmission data as described above, comprising:
[0025] A device-side check module for checking each channel of each frame of audio data ready for transmission at the USB device side respectively, obtaining the check values of all the channels, and transmitting the check values to the USB host side together with the audio data;
[0026] A host-side check module for providing the USB host side to receive the audio data transmitted by the USB device side, and calculating the check value of each channel in the same way as the USB device side;
[0027] A check value comparison module for comparing the check value transmitted by the USB device side with the check value calculated by the USB host side for each channel of each frame of the audio data respectively, if the two check values are consistent, the data of the corresponding channel is complete, otherwise data loss or alteration of the data of the channel occurs.
[0028] Further, the system for monitoring the integrity of transmission data further comprises:
[0029] The check value channel opening module is configured to open another channel for loading the check value of the audio data on the audio data of each frame, load the check value at the head and tail of the channel, and fill 0 in the middle position.
[0030] A computer device comprises a memory and one or more processors, the memory stores computer code, and the computer code is executed by the one or more processors to make the one or more processors execute the method as described above.
[0031] A computer readable storage medium stores computer code, and the computer code is executed to execute the method as described above.
[0032] Compared with the prior art, the present application has at least one of the following beneficial effects:
[0033] (1) The method for monitoring the integrity of transmission data comprises the following steps: S1: checking each channel of each frame of audio data ready for transmission at the USB device end, obtaining the check value of all the channels, and transmitting the check value to the USB host end together with the audio data; S2: the USB host end receives the audio data transmitted by the USB device end, and calculates the check value of each channel in the same way as the USB device end; S3: for each channel of each frame of audio data, the check value transmitted by the USB device end is compared with the check value calculated by the USB host end, if the two check values are consistent, the data of the corresponding channel is complete, otherwise the data of the channel has been lost or tampered. The above technical solution makes full use of the randomness of audio data, checks each frame of audio data, opens an additional channel to load the check value, and transmits the check value to the host together with the audio data. After receiving the audio data, the host checks each frame of data in the same way as the slave, and then compares the received check value. If the check values are consistent, it can be judged that the received data is complete. Because it is a synchronous check of transmission data in a real application scenario, the defects of similar technologies in the background technology are fundamentally solved.
[0034] (2) For each frame of audio data ready for transmission, the count package of the audio data is loaded on the channel for loading the check value of the audio data, which is used to accumulate the number of frames of the audio data transmission; the count value of the count package is incremented by 1 for each frame of audio data transmitted. The above technical method can detect whether the entire packet of audio data is lost by calculating each frame of audio data.
[0035] (3) By comparing the head and tail of the channel for loading the check value of the audio data, if the head and tail data are inconsistent, the frame of the audio data transmitted this time has data loss or tampering. The above technical solution can detect whether the frame of the audio data transmitted this time has data loss or tampering. BRIEF DESCRIPTION OF DRAWINGS
[0036] Figure 1 For the schematic diagram of data loss in the background art;
[0037] Figure 2 For the overall flowchart of the method for monitoring the integrity of the transmitted data in the first embodiment of the application;
[0038] Figure 3 For the detailed flowchart of the method for monitoring the integrity of the transmitted data in the first embodiment of the application;
[0039] Figure 4 For the schematic diagram of the data packet before adding the check value channel in the first embodiment of the application;
[0040] Figure 5 For the schematic diagram of the data packet after adding the check value channel in the first embodiment of the application;
[0041] Figure 6 For the overall structure diagram of the system for monitoring the integrity of the transmitted data in the second embodiment of the application. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme of the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0043] Those skilled in the art can understand that, unless specifically stated otherwise, the singular forms "a", "an" and "the" used herein also include the plural forms. It should be further understood that the use of the word "comprise" in the specification of the present application means that the features, integers, steps, operations, elements and / or groups exist, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, groups and / or their combinations.
[0044] First embodiment
[0045] As Figure 2 and 3As shown, the embodiment provides a method for monitoring the integrity of transmitted data, comprising the following steps:
[0046] S1: at the USB device end, a check is performed on each channel of each frame of audio data to be transmitted, the check values of all the channels are obtained, and the check values are transmitted to the USB host end together with the audio data.
[0047] Specifically, in the embodiment, a check is first performed on each channel of each frame of audio data to be transmitted at the USB device end, and the check value of each channel is obtained. Subsequently, the check value is packaged and encapsulated together with the audio data and sent to the USB host end.
[0048] As for the storage method of the check value, the method in the embodiment is as follows: Figure 4 and Figure 5 In each frame of the audio data, another channel is opened for loading the check value of the audio data. Considering the uncertainty of data loss, the loss may occur in the channel for transmitting the check value, so the check value is loaded at the head and tail of the channel, and the middle position is filled with 0. Because the check value is transmitted in a separate channel, the USB host can directly discard the channel data in the case of tight computing power or high real-time requirement, without checking, but only checking for a limited time in the project acceptance stage to verify the integrity of data transmission. The effect is equivalent to the similar technology described above. However, this is not the only way to store the check value in the embodiment. In this way, the check values of the channels of the audio data are placed on an extra channel and transmitted to the host through the USB interface together with the audio data. Because an extra channel is added, higher requirements are placed on the throughput of data transmission. For this purpose, another feasible solution can be adopted, that is, the check value and the count value described below can be sent to the USB host through other data transmission means. In this way, the burden of USB transmission is not increased, but an additional transmission means is required, which is not available in many application scenarios. Moreover, the audio data and the check value are transmitted separately, which may cause a data synchronization problem.
[0049] Further, the calculation method of the check value is not specifically specified in the embodiment, and appropriate calculation methods can be adopted at the USB device end and the USB host end according to the actual situation, such as using CRC as the method for calculating the check value, because some USB host ends have hardware modules supporting fast CRC calculation.
[0050] Furthermore, considering the possibility of losing all data during a single transmission, for each frame of audio data to be transmitted, a counter packet for the audio data is simultaneously loaded on the channel used to load the checksum of the audio data, to accumulate the number of frames transmitted; for each frame of audio data transmitted, the count value of the counter packet is incremented by 1 (e.g., ...). Figure 5 ).
[0051] S2: The USB host receives the audio data transmitted by the USB device and calculates the check value for each channel in the same way as the USB device.
[0052] Specifically, after receiving a transmission of audio data, the USB host calculates the checksum using the same method as the USB device, while storing the data for each channel.
[0053] S3: For each channel of each frame of audio data, compare the check value transmitted from the USB device with the check value calculated by the USB host. If the two check values are consistent, the data of the corresponding channel is complete; otherwise, the data of the channel has been lost or altered.
[0054] Furthermore, the header and tail of the channel used to load the check value of the audio data are compared. If the header and tail data are inconsistent, then the audio data of the frame transmitted in this transmission has been lost or altered.
[0055] Furthermore, it is determined whether the count value of the counting packet in each frame is equal to the count value of the previous frame plus 1. If the equation is true, the audio data of the current frame is complete; otherwise, the entire audio data packet has been lost. For example, assuming the count value is Ccnt, it is determined whether it is equal to the previous transmission count Pcnt plus 1, i.e., Ccnt = Pcnt + 1. If the equation is not true, it can be determined that the entire packet (i.e., channel 1 to n+1) of data was lost during transmission.
[0056] Second Embodiment
[0057] like Figure 6 As shown, this embodiment provides a system for monitoring the integrity of transmitted data, used to perform the method for monitoring the integrity of transmitted data as described in the first embodiment, comprising:
[0058] Device-side verification module 1 is used to verify each channel of each frame of audio data to be transmitted on the USB device side, obtain the verification value of all the channels, and transmit the verification value and the audio data together to the USB host side.
[0059] The host-side check module 2 is configured to provide the USB host side with the audio data transmitted by the USB device side, and calculate the check value of each channel in the same way as the USB device side.
[0060] The check value comparison module 3 is configured to compare the check value transmitted by the USB device side with the check value calculated by the USB host side for each channel of each frame of the audio data, and if the two check values are consistent, the data of the corresponding channel is complete, otherwise, the data of the channel has been lost or tampered.
[0061] Further, the system for monitoring the integrity of the transmitted data further comprises:
[0062] The check value channel opening module 4 is configured to open another channel for loading the check value of the audio data on each frame of the audio data, and load the check value in the head and tail of the channel, and fill 0 in the middle position.
[0063] A computer readable storage medium stores computer code, when the computer code is executed, the above method is executed. Those skilled in the art can understand that all or part of the steps of the above method can be completed by a program instructing the related hardware, and the program can be stored in a computer readable storage medium, and the storage medium can include a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0064] The above is only the preferred embodiment of the present application, and the protection scope of the present application is not limited to the above embodiment. Any technical solution falling within the concept of the present application shall be considered as falling within the protection scope of the present application. It should be noted that, for those skilled in the art, some improvements and refinements can be made without departing from the principles of the present application, and these improvements and refinements shall also be considered as falling within the protection scope of the present application.
[0065] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combinations of the technical features do not exist contradictions, they shall be considered as falling within the scope of the present application.
[0066] It should be noted that the above embodiments can be freely combined as needed. The above only describes the preferred embodiments of the present application, and it should be pointed out that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should also be considered as the protection scope of the present application.
Claims
1. A method of monitoring the integrity of transmitted data, characterized by, The method comprises the following steps: S1: at the USB device end, checking each channel of each frame of audio data to be transmitted respectively, obtaining the check values of all the channels, and transmitting the check values to the USB host end together with the audio data; In step S1, further comprising: on the audio data of each frame, additionally opening a channel for loading the check values of the audio data; loading the check values in the head and tail of the channel, and filling 0 in the middle position; S2: the USB host end receives the audio data transmitted by the USB device end, and calculates the check values of each channel in the same way as the USB device end; S3: for each channel of each frame of audio data, the check values transmitted by the USB device end and the check values calculated by the USB host end are compared respectively, if the two check values are consistent, the data of the corresponding channel is complete, otherwise the data of the channel is lost or tampered; Each channel is checked by using a method including CRC check to obtain the check values of all the channels.
2. The method of claim 1, wherein, In step S1, further comprising: For each frame of audio data to be transmitted, a count package of the audio data is loaded on the channel for loading the check values of the audio data at the same time, for accumulating the frame number of the audio data transmission; The count value of the count package is increased by 1 every time a frame of audio data is transmitted.
3. The method of claim 1, wherein, In step S3, further comprising: The head and tail of the channel for loading the check values of the audio data are compared, if the head and tail data are inconsistent, a frame of the audio data transmitted this time is lost or tampered.
4. The method of claim 2, wherein, In step S3, further comprising: It is judged whether the count value of each frame of the count package is equal to the count value of the last frame plus 1, if the equation is established, the audio data of the current frame is complete, otherwise the data loss of the entire audio data package occurs.
5. A system for performing the method of monitoring the integrity of transmitted data according to any one of claims 1 to 4, characterized in that Comprise: A device end check module for checking each channel of each frame of audio data to be transmitted at the USB device end, obtaining the check values of all the channels, and transmitting the check values to the USB host end together with the audio data; A host end check module for providing the USB host end to receive the audio data transmitted by the USB device end, and calculating the check values of each channel in the same way as the USB device end; A check value comparison module for comparing the check values transmitted by the USB device end and the check values calculated by the USB host end for each channel of each frame of audio data respectively, if the two check values are consistent, the data of the corresponding channel is complete, otherwise the data of the channel is lost or tampered.
6. The system for monitoring integrity of transmitted data according to claim 5, wherein, Further comprising: A check value channel opening module for additionally opening a channel for loading the check values of the audio data on the audio data of each frame; The check value is loaded in the head and the tail of the channel, with 0 in between.
7. A computer device comprising a memory and one or more processors, the memory having stored therein computer code, which, when executed by the one or more processors, causes the one or more processors to perform the method of any one of claims 1 to 4.
8. A computer-readable storage medium having stored therein computer code, which, when executed, performs the method of any one of claims 1 to 4.
Citation Information
Patent Citations
Multi-channel audio processing method, audio playback terminal and audio receiving device
CN102867525A
Method and device for judging whether transmission data is interfered or not and storage medium
CN113923274A