Equipment synchronization method and device, electronic equipment and readable storage medium
By adding timestamps between audio devices or using a time server to synchronize audio devices, the problem of poor audio device synchronization is solved, ensuring seamless audio connection and reducing latency, and is suitable for audio device synchronization needs in a variety of scenarios.
Patent Information
- Application Number
- CN202411183968.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-10-11
AI Technical Summary
In scenes such as film and television production, animation production, and video conferencing, the synchronization effect between multiple audio devices is poor, resulting in sound delays, echoes, or breaks, affecting user experience.
By adding time stamps for synchronization between the first device and the second device based on a designated master clock source, a time server is used to achieve unified time synchronization in a scenario where multiple audio devices are located in the same wide area network.
Ensure seamless audio connection, minimize unnecessary communication overhead and delays, improve synchronization effects, and are suitable for network conditions and data processing needs in different scenarios.
Smart Images

Figure CN118764128A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the technical field of electronic devices, and more specifically, relates to a device synchronization method and apparatus, an electronic device, and a readable storage medium. Background Art
[0002] In scenarios such as film and television production, animation production, video conferencing, distance education or live performances, multiple audio devices (such as microphones, audio interfaces, audio workstations, etc.) need to work synchronously. If the synchronization between multiple audio devices is poor, problems such as sound delay, echo or interruption will occur, affecting the user experience. Summary of the invention The purpose of the present disclosure is to provide a device synchronization method and apparatus, an electronic device, and a readable storage medium to improve the synchronization effect of audio devices.
[0003] A first aspect of an embodiment of the present disclosure provides a device synchronization method, including: In response to the first device being applied to a first type of scenario, a timestamp is added to data sent by the first device based on a designated master clock source; the timestamp is used to achieve synchronization between the first device and the second device; in the first type of scenario, any data sent by the first device is used to be spliced with data sent by the second device to obtain target data; In response to the first device being applied to a second type of scenario, synchronization of the first device with a third device is achieved based on a time server; in the second type of scenario, both the first device and the third device are communicatively connected to the time server.
[0004] A second aspect of an embodiment of the present disclosure provides a device synchronization apparatus, including: A first synchronization module, configured to add a timestamp to data sent by the first device based on a specified master clock source in response to the first device being applied to a first type of scenario; the timestamp is used to achieve synchronization between the first device and the second device; in the first type of scenario, any data sent by the first device is used to be spliced with data sent by the second device to obtain target data; The second synchronization module is used to synchronize the first device with a third device based on a time server in response to the first device being applied to a second type of scenario; in the second type of scenario, both the first device and the third device are in communication connection with the time server.
[0005] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the above-mentioned device synchronization method when executing the computer program.
[0006] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned device synchronization method are implemented.
[0007] The device synchronization method and apparatus, electronic device, and readable storage medium provided by the embodiments of the present disclosure have the following beneficial effects: In the embodiments of the present disclosure, the first type of scenario may be a scenario such as audio production or film production, where the audio recorded by different devices (including the first device and the second device) needs to be accurately spliced together. In this scenario, synchronization based on timestamps can ensure seamless audio connection. The second type of scenario may be a large-scale enterprise audio broadcasting system, a cross-regional band performance, etc. In this scenario, multiple audio devices (including the first device and the third device) are located in the same wide area network, and multiple scattered audio devices are connected through a time server to achieve unified time synchronization.
[0008] In the embodiments of the present disclosure, the synchronization method that best suits the current scenario is selected based on the network conditions and data processing requirements of different scenarios, which can minimize unnecessary communication overhead, reduce latency, and improve the synchronization effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0010] Figure 1 A schematic diagram of a process flow of a device synchronization method provided by an embodiment of the present disclosure; Figure 2 A structural block diagram of a device synchronization apparatus provided by an embodiment of the present disclosure; Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0011] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.
[0012] In order to make the purpose, technical solutions and advantages of the present disclosure more clear, specific embodiments will be described below in conjunction with the accompanying drawings.
[0013] Please refer to Figure 1 , Figure 1 A schematic diagram of a process flow of a device synchronization method provided by an embodiment of the present disclosure, the method is applied to a first device, and includes: S101: In response to the first device being applied to a first type of scenario, a timestamp is added to data sent by the first device based on a designated master clock source; the timestamp is used to achieve synchronization between the first device and the second device; in the first type of scenario, data sent by any first device is used to be spliced with data sent by the second device to obtain target data.
[0014] In this embodiment, the first device may be one of the devices in an audio system composed of multiple audio devices, the first type of scenario may be a scenario such as audio production, film production, etc. In such a scenario, the audio system may include devices such as a microphone, an audio interface, an audio workstation, etc., and the second device may be another device in the audio system. The designated master clock source may be a professional clock generator or a GPS (Global Positioning System) receiver to provide a high-precision time reference. The time information provided by the master clock source is regarded as an accurate standard, and the clocks of all audio devices need to be consistent with the master clock source.
[0015] In the first scenario, the audio recorded by different devices (including the first device and the second device) needs to be accurately spliced. At this time, timestamps can be added to the data sent by the first device and the second device (and other audio devices) based on the specified master clock source to ensure that all audio devices have a consistent benchmark for data generation and processing time. Therefore, synchronization of audio devices based on the timestamps of each audio data can ensure seamless audio connection.
[0016] Among them, timestamp refers to a unique mark or record of a specific point in time. It is usually a numerical value that represents the total length of time from a fixed starting point (usually a specific moment in the past) to that point in time. In computer science, a timestamp is usually the number of seconds or milliseconds calculated from the UNIX epoch (i.e., January 1, 1970 00:00:00 UTC). This timestamp system is widely used in file systems, database systems, network communications and other fields to record and track the time when events occur. Taking the first device as an example, the first device will periodically synchronize time with the master clock source, and when the first device sends data, the current time is used to generate a timestamp.
[0017] S102: In response to the first device being applied to the second type of scenario, synchronization of the first device with the third device is achieved based on a time server; in the second type of scenario, both the first device and the third device are in communication connection with the time server.
[0018] In this embodiment, the second type of scenario may be an audio broadcasting system of a large enterprise, a cross-regional band performance, and the like. In such scenarios, the audio system may include devices such as microphones, speakers, and audio processors. The first device may be one of the devices in the above audio systems, and the third device may be another device in the above audio systems.
[0019] In the second scenario, multiple audio devices (including the first device and the third device) are located in the same wide area network, that is, the first device and the third device are both connected to the time server. A stable and reliable server or computer can be selected as the time server, and multiple audio devices communicate with the time server through the Network Time Protocol (NTP) or the Simple Network Time Protocol (SNTP). When an audio device (such as the first device) needs to obtain time, it sends a request to the time server and receives the current time information.
[0020] By synchronizing with a time server, multiple audio devices can be timed according to the same time, thereby achieving synchronization between the audio devices.
[0021] It can be concluded from the above that in this embodiment, the first type of scenario can be a scenario such as audio production and film production, which requires accurate splicing of audio recorded by different devices (including the first device and the second device). In this scenario, synchronization based on timestamps can ensure seamless connection of audio. The second type of scenario can be a scenario such as an audio broadcasting system of a large enterprise or a cross-regional band performance. In this scenario, multiple audio devices (including the first device and the third device) are located in the same wide area network, and multiple scattered audio devices are connected through a time server to achieve unified time synchronization.
[0022] In the embodiments of the present disclosure, the synchronization method that best suits the current scenario is selected based on the network conditions and data processing requirements of different scenarios, which can minimize unnecessary communication overhead, reduce latency, and improve the synchronization effect.
[0023] In one embodiment of the present disclosure, the device synchronization method further includes: In response to the first device being applied to the third type of scenario, the clock signal of the first device is determined based on the clock signal of the designated master device to achieve synchronization between the first device and the fourth device; in the third type of scenario, the first device and the fourth device work synchronously in the same local area network, and the designated master device is any device in the local area network.
[0024] In this embodiment, the third type of scenario may be a small distributed audio system, such as a home theater system or a small performance system. In this type of scenario, the audio system may be a combination of multiple mobile audio devices, the first device may be one of the devices in the above audio system, and the fourth device may be another device in the audio system.
[0025] In the third scenario, one of the devices in the above audio system can be designated as the master device, and the other devices can be designated as slave devices to receive the clock signal of the master device. The clock signal of the master device can be sent to the slave devices through physical connection or wireless transmission to achieve synchronization.
[0026] In this embodiment, a master device is designated as a clock source based on the network structure of the distributed audio system, which can simplify the synchronization process and reduce costs.
[0027] In one embodiment of the present disclosure, the device synchronization method further includes: In response to the first device being applied to the first type of scenario, and a first error between the timestamp of the first device and an average timestamp value is greater than a first threshold, the frequency of adding timestamps of the first device is increased; the average timestamp value is an average of timestamps of all synchronization devices corresponding to the first device.
[0028] In this embodiment, in the first type of scenario, the synchronization of the timestamp of the first device and the timestamp of other devices in the audio system can be periodically detected. For example, the average value of the timestamps of all audio devices in the audio system at the same time point can be calculated as the timestamp average value, and then the timestamp of the first device at the same time point is compared with the timestamp average value to obtain a first error. If the first error is within the first set range (that is, less than the first threshold), it indicates that the synchronization of the first device with the other audio devices is good; otherwise, if the first error exceeds the first set range (that is, greater than the first threshold), it indicates that the synchronization effect of the first device with the other audio devices is poor and needs to be adjusted in time.
[0029] Considering that the first device will perform time synchronization with the master clock source each time a timestamp is added, increasing the frequency of adding timestamps can more finely capture the time changes of audio data and reduce the accumulation of synchronization errors. Therefore, the synchronization between the first device and the master clock source can be improved by increasing the frequency of adding timestamps of the first device, thereby improving the synchronization between the first device and other audio devices.
[0030] From the above, it can be concluded that this embodiment periodically detects the synchronization between the timestamp of the first device and the timestamp of other devices in the audio system, and when the synchronization effect deteriorates, the timestamp of the first device is adjusted in time by increasing the frequency of adding the timestamp of the first device, thereby ensuring the synchronization accuracy between the audio devices.
[0031] In one embodiment of the present disclosure, the device synchronization method further includes: An upper limit value of a frequency of adding a timestamp of the first device is determined based on a CPU occupancy rate of the first device and a data transmission speed of the first device.
[0032] The frequency of adding the timestamp of the first device is adjusted based on the upper limit value of the frequency of adding the timestamp of the first device.
[0033] In this embodiment, considering that too high a frequency of timestamp addition will increase the computing burden of the first device, thereby affecting the overall working performance of the first device, to avoid this problem, the upper limit of the frequency of timestamp addition can be determined according to the working status of the first device. If the frequency of timestamp addition of the first device reaches the upper limit, it will not continue to increase.
[0034] Specifically, considering that when the CPU occupancy rate is high, it may not be able to support a too high timestamp adding frequency, that is, when the CPU occupancy rate is high, it is necessary to reduce the upper limit value of the timestamp adding frequency of the first device. At the same time, considering that when the data transmission rate of the first device is slow, too high timestamp adding frequency may cause data accumulation or loss, that is, when the data transmission rate of the first device is fast, the upper limit value of the timestamp adding frequency of the first device can be increased. Therefore, this embodiment determines the working state of the first device based on the CPU occupancy rate of the first device and the data transmission speed of the first device, and then determines the upper limit value of the timestamp adding frequency according to the working state of the first device. The upper limit value of the timestamp adding frequency of the first device can be calculated using the following formula:
[0035] in, represents the upper limit value of the frequency of adding the timestamp of the first device, is a preset constant, indicating the reference value of the upper limit value; Indicates CPU usage. Indicates the data transmission rate, is a preset constant, indicating a reference value of the data transmission rate; and are all preset coefficients. and The specific value of can be set according to actual needs.
[0036] It can be concluded from the above that this embodiment determines the upper limit of the frequency of adding timestamps based on the working state of the first device, which can prevent the overall working performance of the first device from being affected by an excessively high frequency of adding timestamps.
[0037] In one embodiment of the present disclosure, considering that the working performance of the CPU may be affected by the temperature of the first device, the CPU may be controlled based on the temperature of the first device. The specific value of is adjusted, and the adjusted calculation formula is as follows:
[0038] in, is a preset constant, indicating the reference value of temperature. Indicates the upper limit of temperature, Indicates the lower limit of temperature.
[0039] In this embodiment, based on the temperature of the first device The specific value of is adjusted so that the upper limit value of the frequency of adding the timestamp of the first device is more in line with the actual working state of the first device. In one embodiment of the present disclosure, the device synchronization method further includes: In response to the first device being applied to the second type of scenario, the test data is sent to the time server at a first time interval, and the sending delay time is determined based on the time difference between the sending time of the test data and the information return time; the information return time is the time when the return information for the test data sent by the server is received; In response to the transmission delay time being greater than a second threshold, determining a synchronization time of the first device based on a local clock of the first device and calibration parameters; the calibration parameters are obtained based on historical calibration data. In this embodiment, in the second type of scenario, the first device can periodically (at a first time interval) send test data to the time server to determine the sending delay time based on the time difference between the test data sending time and the information return time. If the sending delay time is within the second set range (that is, less than the second threshold), it indicates that the communication status between the first device and the time server is normal. Otherwise, if the sending delay time exceeds the second set range (that is, greater than the second threshold), it indicates that there is a large communication delay between the first device and the time server. At this time, in order to avoid the time synchronization error between the first device and the time server caused by the communication delay, the synchronization time of the first device can be determined based on the local clock of the first device.
[0040] Specifically, the relationship curve between the local time (i.e., the time of the local clock) and the reference time can be fitted according to the historical calibration data of the local clock (including the one-to-one corresponding local time and the reference time sent by the time server), and then the calibration parameters can be obtained. When there is a large communication delay between the first device and the time server, the time sent by the time server will no longer be used as the synchronization time of the first device, but the calibration parameters will be used to calibrate the local time of the first device, and the calibrated local time will be used as the synchronization time of the first device.
[0041] For example, the relationship curve between the local time and the reference time obtained by fitting the historical calibration data of the local clock is y=kx+b, where y represents the reference time, x represents the local time, and k and b are calibration parameters. When there is a large communication delay between the first device and the time server, the current local time (for example, x1) can be calibrated based on the calibration parameters k and b, and then the calibrated local time x1 is used as the synchronization time of the first device.
[0042] From the above, it can be concluded that this embodiment can obtain the communication status between the first device and the time server by periodically detecting the sending delay time. When there is a large communication delay between the first device and the time server, the synchronization time of the first device is determined based on the local clock and calibration parameters to avoid network delays affecting the synchronization between devices.
[0043] In one embodiment of the present disclosure, the device synchronization method further includes: In response to the sending delay time being less than a second threshold, determining the synchronization time of the first device based on the clock information sent by the time server, and calibrating the local clock of the first device based on the clock information sent by the time server.
[0044] In this embodiment, if the sending delay time is within the second set range (that is, less than the second threshold), it indicates that the communication status between the first device and the time server is normal. At this time, the clock information sent by the time server can be used as the synchronization time of the first device, and the local clock can be calibrated based on the clock information sent by the time server to ensure the accuracy of the local clock.
[0045] It can be concluded from the above that, in this embodiment, when the network condition is good, the clock information is obtained from the time server, which can ensure the accurate synchronization between the first device and other audio devices. At the same time, according to the calibration of the local clock by obtaining the clock information from the time server, it can be ensured that when there is a large communication delay between the first device and the time server, the first device can still achieve accurate synchronization with other audio devices.
[0046] In one embodiment of the present disclosure, the device synchronization method further includes: In response to the first device being applied to the third type of scenario, the connection status of the main device is detected at a second time interval.
[0047] In response to the connection state of the master device being a first state, a backup master device is selected based on a backup connection list, and a clock signal of the first device is determined based on a clock signal of the backup master device; the first state is an abnormal connection state.
[0048] In this embodiment, in the third type of scenario, the first device can periodically (at the second time interval) detect the connection status of the master device. Specifically, a heartbeat data packet can be sent to the master device at the second time interval. If the heartbeat packet of the master device is not received within the preset time, it is considered that the master device is offline (that is, an abnormal connection state is detected).
[0049] A backup connection list may be pre-set in the first device, the backup connection list including the numbers of multiple audio devices, and the numbers of the multiple audio devices are arranged in order of priority. When an abnormal connection state of the master device is detected, the audio device with the highest priority may be selected from the backup connection list, the audio device may be determined as the backup master device, and the clock signal of the first device may be determined based on the clock signal of the backup master device to ensure accurate synchronization between the audio devices.
[0050] In one embodiment of the present disclosure, a method for determining the priorities of multiple audio devices may be described in detail as follows: A first ranking parameter of each audio device is determined based on a clock accuracy level of each audio device; the plurality of audio devices includes a first device and a third device.
[0051] A second ranking parameter of each audio device is determined based on a historical CPU occupancy rate of each audio device.
[0052] A third ranking parameter for each audio device is determined based on the first ranking parameter and the corresponding second ranking parameter of each audio device.
[0053] The third sorting parameter is adjusted based on the position information of each audio device to obtain a fourth sorting parameter.
[0054] The priority of each audio device is determined based on the size of the fourth sorting parameter.
[0055] In this embodiment, when calculating the first sorting parameter, each audio device may be sorted first according to the specific value of the clock accuracy of each audio device, and then the sorted audio devices may be grouped according to the first ratio, and the first sorting parameter may be determined based on the grouping result. For example, the first ratio may be set to 3:4:4, whereby the first 3 / 10 of the audio devices are taken as the first group, and the first sorting parameter corresponding to the first group is determined as the first value; the middle 4 / 10 of the audio devices are taken as the second group, and the first sorting parameter corresponding to the second group is determined as the second value; the last 4 / 10 of the audio devices are taken as the third group, and the first sorting parameter corresponding to the third group is determined as the third value. The first value, the second value, and the third value decrease in sequence.
[0056] When calculating the second ranking parameter, the historical CPU occupancy of each audio device may be calculated first. Specifically, taking the first device as an example, the average CPU occupancy of the first device within a set time may be used as the historical CPU occupancy of the first device.
[0057] On the basis of obtaining the historical CPU occupancy rate of the first device, the second ranking parameter of the first device may be calculated based on the following formula: ;in, represents a second sorting parameter of the first device, Indicates the historical CPU usage of the first device. It is a preset constant, which indicates the benchmark value of the historical CPU usage. is a preset constant representing a reference value of the second sorting parameter.
[0058] The same method may be used to calculate the second ranking parameters of other audio devices, thereby obtaining the second ranking parameters of each audio device.
[0059] On the basis of obtaining the first sorting parameter and the second sorting parameter, a weighted sum of the first sorting parameter and the corresponding second sorting parameter may be performed to obtain a third sorting parameter for each audio device.
[0060] Considering that when the third sorting parameter is the same, if a certain audio device is located close to the center of the network (a network composed of multiple audio devices), the path length and delay of the clock signal transmission can be reduced, and the audio device can be set to a higher priority. Therefore, this embodiment can adjust the third sorting parameter based on the location information of each audio device to obtain a fourth sorting parameter, and determine the priority of each audio device based on the size of the fourth sorting parameter.
[0061] Specifically, a location distribution map of multiple audio devices can be drawn based on the location information of each audio device, and each audio device has a corresponding location coordinate on the location distribution map. The center location coordinates of the network are determined based on the location coordinates of each audio device, and the first distance between each audio device and the center location of the network is calculated based on the location coordinates of each audio device and the center location coordinates of the network; then the average value of each first distance is calculated, and the ratio of the average value of each first distance to each first distance is used as an adjustment coefficient, and the third sorting parameter is adjusted based on the adjustment coefficient. Taking the first device as an example, the third sorting parameter of the first device can be adjusted using the following formula: ;in, represents the fourth sorting parameter, represents the third sorting parameter, represents the average value of each first distance, represents a first distance between the first device and a central location of the network, is the preset coefficient.
[0062] From the above, it can be concluded that this embodiment determines the priority of each audio device based on the clock accuracy level, CPU historical occupancy and location information of each audio device, and constructs a backup connection list in order of priority. When an abnormal connection state of the main device is detected, the audio device with the highest priority can be selected from the backup connection list as the backup main device, which can ensure the working performance of the selected backup main device. Corresponding to the device synchronization method of the above embodiment, Figure 2 This is a structural block diagram of a device synchronization apparatus provided by an embodiment of the present disclosure. For ease of description, only the parts related to the embodiment of the present disclosure are shown. Figure 2 The device synchronization apparatus 20 is applied to a first device and includes: a first synchronization module 21 and a second synchronization module 22 . Among them, the first synchronization module 21 is used to add a timestamp to the data sent by the first device based on the specified master clock source in response to the first device being applied to the first type of scenario; the timestamp is used to achieve synchronization between the first device and the second device; in the first type of scenario, the data sent by any first device is used to be spliced with the data sent by the second device to obtain the target data.
[0063] The second synchronization module 22 is used to synchronize the first device with the third device based on the time server in response to the first device being applied to the second type of scenario; in the second type of scenario, both the first device and the third device are in communication connection with the time server.
[0064] In one embodiment of the present disclosure, the device synchronization apparatus further includes: The third synchronization module 23 is used to determine the clock signal of the first device based on the clock signal of the designated master device in response to the first device being applied to the third type of scenario, so as to achieve synchronization between the first device and the fourth device; in the third type of scenario, the first device and the fourth device work synchronously in the same local area network, and the designated master device is any device in the local area network.
[0065] In an embodiment of the present disclosure, the first synchronization module 21 is specifically used for: In response to the first device being applied to the first type of scenario, and a first error between the timestamp of the first device and an average timestamp value is greater than a first threshold, the frequency of adding timestamps of the first device is increased; the average timestamp value is an average of timestamps of all synchronization devices corresponding to the first device.
[0066] In an embodiment of the present disclosure, the first synchronization module 21 is further configured to: An upper limit value of a frequency of adding a timestamp of the first device is determined based on a CPU occupancy rate of the first device and a data transmission speed of the first device.
[0067] The frequency of adding the timestamp of the first device is adjusted based on the upper limit value of the frequency of adding the timestamp of the first device.
[0068] In one embodiment of the present disclosure, the second synchronization module 22 is specifically used for: In response to the first device being applied to the second type of scenario, test data is sent to the time server at a first time interval, and the sending delay time is determined based on the time difference between the test data sending time and the information return time; the information return time is the time when the return information sent by the server for the test data is received.
[0069] In response to the transmission delay time being greater than a second threshold, determining a synchronization time of the first device based on a local clock of the first device and calibration parameters; the calibration parameters are obtained based on historical calibration data.
[0070] In one embodiment of the present disclosure, the second synchronization module 22 is further configured to: In response to the sending delay time being less than a second threshold, determining the synchronization time of the first device based on the clock information sent by the time server, and calibrating the local clock of the first device based on the clock information sent by the time server.
[0071] In one embodiment of the present disclosure, the third synchronization module 23 is specifically used to: In response to the first device being applied to the third type of scenario, the connection status of the main device is detected at a second time interval.
[0072] In response to the connection state of the master device being a first state, a backup master device is selected based on a backup connection list, and a clock signal of the first device is determined based on a clock signal of the backup master device; the first state is an abnormal connection state.
[0073] See also Figure 3 , Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present disclosure. Figure 3 The electronic device 300 in the embodiment shown may include: one or more processors 301, one or more input devices 302, one or more output devices 303 and one or more memories 304. The processors 301, input devices 302, output devices 303 and memories 304 communicate with each other via a communication bus 305. The memory 304 is used to store computer programs, which include program instructions. The processor 301 is used to execute the program instructions stored in the memory 304. The processor 301 is configured to call the program instructions to execute the functions of each module / unit in the above-mentioned device embodiments, such as Figure 2 The functions of modules 21 to 22 are shown.
[0074] It should be understood that in the embodiment of the present disclosure, the processor 301 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0075] The input device 302 may include a touch panel, a fingerprint collection sensor (for collecting the user's fingerprint information and fingerprint direction information), a microphone, etc., and the output device 303 may include a display (LCD, etc.), a speaker, etc.
[0076] The memory 304 may include a read-only memory and a random access memory, and provide instructions and data to the processor 301. A portion of the memory 304 may also include a non-volatile random access memory. For example, the memory 304 may also store information about the device type.
[0077] In a specific implementation, the processor 301, input device 302, and output device 303 described in the embodiments of the present disclosure can execute the implementation methods described in the first and second embodiments of the device synchronization method provided in the embodiments of the present disclosure, and can also execute the implementation methods of the electronic device described in the embodiments of the present disclosure, which will not be repeated here.
[0078] In another embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by the processor, all or part of the processes in the above-mentioned embodiment method are implemented, and the computer program can also be completed by instructing the relevant hardware through the computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0079] The computer-readable storage medium may be an internal storage unit of the electronic device of any of the aforementioned embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0080] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.
[0081] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the electronic devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0082] In the several embodiments provided in the present application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces or units, or it can be an electrical, mechanical or other form of connection.
[0083] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present disclosure.
[0084] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0085] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present disclosure, and these modifications or replacements should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A device synchronization method, applied to a first device, characterized in that: include: In response to the first device being applied to a first type of scenario, adding a timestamp to data sent by the first device based on a designated master clock source; The timestamp is used to achieve synchronization between the first device and the second device; In the first type of scenario, data sent by any of the first devices is used to be spliced with data sent by the second device to obtain target data; In response to the first device being applied to a second type of scenario, synchronization of the first device with a third device is achieved based on a time server; in the second type of scenario, both the first device and the third device are communicatively connected to the time server.
2. The device synchronization method according to claim 1, characterized in that: Also includes: In response to the first device being applied to the third type of scenario, determining a clock signal of the first device based on a clock signal of a designated master device to achieve synchronization between the first device and a fourth device; In the third type of scenario, the first device and the fourth device work synchronously in the same local area network, and the designated master device is any device in the local area network.
3. The device synchronization method according to claim 1, characterized in that: Also includes: In response to the first device being applied to a first type of scenario, and a first error between a timestamp of the first device and an average timestamp value is greater than a first threshold, increasing a frequency of adding timestamps of the first device; The timestamp average value is an average value of the timestamps of all synchronization devices corresponding to the first device.
4. The device synchronization method according to claim 3, characterized in that: Also includes: Determine an upper limit value of a frequency of adding a timestamp of the first device based on a CPU occupancy rate of the first device and a data transmission speed of the first device; The frequency of adding the timestamp of the first device is adjusted based on the upper limit value of the frequency of adding the timestamp of the first device.
5. The device synchronization method according to claim 1, characterized in that: Also includes: In response to the first device being applied to the second type of scenario, test data is sent to the time server at a first time interval, and a sending delay time is determined based on a time difference between a sending time of the test data and an information return time; the information return time is a time when return information for the test data sent by the server is received; In response to the sending delay time being greater than a second threshold, determining a synchronization time of the first device based on a local clock and a calibration parameter of the first device; The calibration parameters are obtained based on historical calibration data.
6. The device synchronization method according to claim 5, characterized in that: Also includes: In response to the sending delay time being less than a second threshold, determining the synchronization time of the first device based on the clock information sent by the time server, and calibrating the local clock of the first device based on the clock information sent by the time server.
7. The device synchronization method according to claim 2, characterized in that: Also includes: In response to the first device being applied to a third type of scenario, detecting a connection status of the master device at a second time interval; In response to the connection state of the master device being the first state, selecting a backup master device based on a backup connection list, and determining a clock signal of the first device based on a clock signal of the backup master device; The first state is an abnormal connection state.
8. A device synchronization apparatus, applied to a first device, characterized in that: include: A first synchronization module, configured to add a timestamp to data sent by the first device based on a designated master clock source in response to the first device being applied to a first type of scenario; The timestamp is used to achieve synchronization between the first device and the second device; In the first type of scenario, data sent by any of the first devices is used to be spliced with data sent by the second device to obtain target data; The second synchronization module is used to synchronize the first device with a third device based on a time server in response to the first device being applied to a second type of scenario; in the second type of scenario, both the first device and the third device are in communication connection with the time server.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Intelligent environment equipment control method and device based on wearable brain-computer interface equipment
CN120491503A
