Data playback method and related device
By loading the drone detection data into the cache queue and pushing it to the requesting end through the subscription channel, the problems of data playback delay and lag in the prior art are solved, and efficient data playback is achieved.
Patent Information
- Application Number
- CN202411811853.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-25
AI Technical Summary
When replaying historical drone data in the prior art, there are problems such as long data delay time and screen lag.
By loading the drone detection data into the cache queue, and sending the data in the cache queue to the subscription channel according to the playback request, and finally pushing it to the requesting terminal through the subscription channel.
Improve the efficiency of data playback and avoid stuttering of data playback screen.
Smart Images

Figure CN119892927A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data processing technology, and in particular to a data playback method and related devices. Background Art
[0002] The anti-UAV control and command system can detect, control and display the detected UAVs and detection equipment information. By replaying the detection data, the anti-UAV control and command system can store the trajectory of the UAV detected by the detection equipment and the detection equipment information in real time, and play the flight trajectory of the UAV with the same situation at any time to achieve comprehensive recording and analysis of the detection data. Although the anti-UAV system can display the situation of the invading UAV and the current operating status of the anti-UAV equipment in real time, the amount of data of the historical invading UAV is very large, and it is difficult to repeatedly replay the historical records. Even if there is offline data, it cannot intuitively and effectively show the scene at that time.
[0003] At present, in response to the above problems, the existing technical solution is that the front-end controls the pulling and rendering of data, and the relevant logic is directly implemented on the front-end device. The front-end device (such as the user's computer, mobile phone or tablet) is responsible for interacting with the user. The front-end device will present the data to the user using appropriate rendering technology based on the format and content of the data. Since the existing technical solution is to actively pull data from the front-end device through the requesting end, even if the request is made in time slices, the requesting end needs to wait for the front-end device to respond to the request and obtain and splice the data. The whole process is time-consuming and the data delay time is long. Therefore, the existing technical solution has the defect that the data playback screen is prone to freeze. Summary of the invention
[0004] The embodiment of the present application provides a data playback method and related devices, which loads drone detection data into a cache queue; sends the drone detection data in the cache queue to a subscription channel according to a playback request; and pushes the drone detection data to the requesting end through the subscription channel. The present application can improve the efficiency of data playback and avoid freezing of the data playback screen.
[0005] The embodiments of the present application provide the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a data playback method, the method comprising:
[0007] Obtain drone detection data and store the drone detection data in a database table;
[0008] After receiving the playback request sent by the request end, the drone detection data is loaded from the database table into the cache queue;
[0009] According to the playback request, the drone detection data in the cache queue is sent to the subscription channel;
[0010] Push drone detection data to the requesting end through the subscription channel.
[0011] In some embodiments, obtaining drone detection data and storing the drone detection data in a database table includes:
[0012] Get drone detection data and the timestamp corresponding to the drone detection data;
[0013] According to the timestamp, the drone detection data is routed and fragmented to obtain the fragmented drone detection data;
[0014] The sharded drone detection data is stored in a database table of the block buffer, and an index of the sharded drone detection data is established, wherein the index is used to store the block address corresponding to the sharded drone detection data.
[0015] In some embodiments, the method further comprises:
[0016] Monitor the amount of drone detection data in the cache queue to determine whether the ratio of the amount of drone detection data in the cache queue to the capacity of the cache queue is less than a preset ratio threshold;
[0017] If the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is less than the preset ratio threshold, the drone detection data in the database table will be loaded into the cache queue until the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is greater than or equal to the preset ratio threshold.
[0018] In some embodiments, the playback request includes a playback multiple, and according to the playback request, the drone detection data in the cache queue is sent to the subscription channel, including:
[0019] Get the playback multiple in the playback request;
[0020] According to the playback multiple, determine a first quantity corresponding to the playback multiple, and obtain the first quantity of drone detection data from the cache queue;
[0021] The first number of drone detection data are sent to the subscription channel at fixed time intervals through the timer.
[0022] In some embodiments, the method further comprises:
[0023] Receive a stop command sent by the requesting end;
[0024] In response to the stop command, the timer is turned off and the push of drone detection data to the requesting end is stopped.
[0025] In some embodiments, the method further comprises:
[0026] Receive a pause instruction sent by the requesting end;
[0027] The drone detection data, the current playback multiple, and the time interval of the current timer in the current cache queue are saved to obtain the first drone detection data, the first playback multiple, and the first time interval;
[0028] In response to the pause instruction, the time interval of the timer is set to infinity to temporarily stop sending the drone detection data in the cache queue to the subscription channel.
[0029] In some embodiments, the method further comprises:
[0030] Receive the pause and resume instruction sent by the requesting end;
[0031] In response to the pause resume instruction, obtaining first drone detection data, a first playback multiple, and a first time interval;
[0032] According to the pause and resume instruction, the time interval of the cache queue data is set to a first time interval;
[0033] The first drone detection data is sent to a subscription channel according to the first playback multiple and the first time interval.
[0034] In a second aspect, an embodiment of the present application provides a data playback system, the system comprising:
[0035] A front-end module is used to communicate with the request end and the back-end module, and the front-end module is used to receive a playback request sent by the request end;
[0036] The back-end module is connected to the front-end module in communication. The back-end module is used to obtain drone detection data and store the drone detection data in a database table. After receiving the playback request sent by the request end, the drone detection data is loaded from the database table to the cache queue. According to the playback request, the drone detection data in the cache queue is sent to the subscription channel. Through the subscription channel, the drone detection data is pushed to the request end.
[0037] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0038] at least one processor; and,
[0039] a memory communicatively connected to at least one processor; wherein,
[0040] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the data playback method according to the first aspect.
[0041] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is executed, the data playback method of the first aspect is implemented.
[0042] The beneficial effects of the implementation methods of the present application are: different from the prior art, the implementation methods of the present application provide a data playback method and related devices, and the data playback method includes: obtaining drone detection data and storing the drone detection data in a database table; after receiving a playback request sent by the requesting end, loading the drone detection data from the database table to a cache queue; according to the playback request, sending the drone detection data in the cache queue to a subscription channel; and pushing the drone detection data to the requesting end through the subscription channel.
[0043] By loading the drone detection data into the cache queue; sending the drone detection data in the cache queue to the subscription channel according to the playback request; and pushing the drone detection data to the requesting end through the subscription channel, this application can improve the efficiency of data playback and avoid data playback screen freezes. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] One or more embodiments are exemplarily described by corresponding drawings, which do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and the figures in the drawings do not constitute proportional limitations unless otherwise stated.
[0045] Figure 1 It is a schematic diagram of an application environment of a data playback method provided in an embodiment of the present application;
[0046] Figure 2 It is a flowchart of a data playback method provided in an embodiment of the present application;
[0047] Figure 3 yes Figure 2 A detailed flow chart of step S201 in FIG.
[0048] Figure 4 yes Figure 2 A detailed flow chart of step S202 in FIG.
[0049] Figure 5 It is a flow chart of determining whether the ratio of the amount of drone detection data in a cache queue to the capacity of the cache queue is less than a preset ratio threshold value provided by an embodiment of the present application;
[0050] Figure 6 yes Figure 2 A detailed flow chart of step S203 in FIG.
[0051] Figure 7 It is a flowchart of a stop instruction sent by a requesting end provided in an embodiment of the present application;
[0052] Figure 8 It is a flowchart of a method of receiving a pause instruction sent by a requesting end provided in an embodiment of the present application;
[0053] Fig. 9 It is a flowchart of a method of receiving a pause instruction sent by a requesting end provided in an embodiment of the present application;
[0054] Fig.10 It is a flowchart of a method for receiving a playback multiple modification instruction sent by a requesting end provided in an embodiment of the present application;
[0055] Fig.11 It is a schematic diagram of a process for exporting drone detection data provided by an embodiment of the present application;
[0056] Fig.12 yes Fig.11 A detailed flowchart of step S1102 in FIG.
[0057] Fig.13 It is a structural diagram of a data playback system provided in an embodiment of the present application;
[0058] Fig.14 This is a schematic diagram of the interaction timing between a front-end module and a back-end module provided in an embodiment of the present application;
[0059] Fig.15 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0060] Description of Figure Numbers:
[0061] Label name Label name 100 Application Environment 10 Sending Side 20 Requester 130 Data playback system 1301 Front-end module 1302 Backend module 150 Electronic devices 1501 processor 1502 Memory DETAILED DESCRIPTION
[0062] In order to facilitate the understanding of the present application, the present application is described in more detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that when an element is described as "fixed to" another element, it can be directly on the other element, or there can be one or more centered elements therebetween. When an element is described as "connected to" another element, it can be directly connected to the other element, or there can be one or more centered elements therebetween. The terms "vertical", "horizontal", "left", "right" and similar expressions used in this specification are for illustrative purposes only.
[0063] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in this specification and in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.
[0064] The technical solution of the present application is described in detail below in conjunction with the accompanying drawings:
[0065] See also Figure 1 , Figure 1 It is a schematic diagram of an application environment of a data playback method provided in an embodiment of the present application;
[0066] like Figure 1 As shown, the application environment 100 includes: a sending end 10 and a requesting end 20, wherein the types of the sending end 10 and the requesting end 20 include but are not limited to electronic devices or servers. Exemplarily, when the sending end 10 and / or the requesting end 20 are electronic devices, the electronic devices may be mobile phones, tablet computers, laptop computers, PDAs, vehicle-mounted electronic devices, wearable devices, ultra-mobile personal computers (ultra-mobile personal computers, UMPCs), netbooks or personal digital assistants (personal digital assistants, PDAs), etc., and non-mobile electronic devices may be servers, network attached storage (Network Attached Storage, NAS), personal computers (personal computers, PCs), televisions (television, TVs), etc. When the sending end 10 and / or the requesting end 20 are servers, the servers include but are not limited to cloud servers, streaming media servers or CDN servers. The embodiments of the present application are not specifically limited. In actual applications, the application scenario may include multiple sending ends and multiple requesting ends. Figure 1 In the example, a sending end and a requesting end are used. Specifically, the sending end 10 is connected to the requesting end 20 through a network communication, wherein the network includes a wired network and / or a wireless network. It can be understood that the network includes wireless networks such as 2G, 3G, 4G, 5G, wireless LAN, Bluetooth, etc., and may also include wired networks such as serial cables and network cables.
[0067] In an embodiment of the present application, the sending end 10 is used to receive a playback request sent by the requesting end; obtain drone detection data, and load the drone detection data into a cache queue; according to the playback request, send the drone detection data in the cache queue to a subscription channel; and push the drone detection data to the requesting end through the subscription channel.
[0068] In an embodiment of the present application, the requesting end 20 is used to send a playback request to the sending end 10, or to send a stop instruction, a pause instruction, a pause resume instruction and a play multiple modification instruction to the sending end 10.
[0069] In an embodiment of the present application, the sending end 10 is also used to receive a stop instruction sent by the requesting end; in response to the stop instruction, turn off the timer and stop pushing the drone detection data to the requesting end, or receive a pause instruction sent by the requesting end; save the drone detection data in the current cache queue, the current playback multiple and the time interval of the current timer to obtain the first drone detection data, the first playback multiple and the first time interval; in response to the pause instruction, set the time interval of the timer to infinity to temporarily stop sending the drone detection data in the cache queue to the subscription channel, or receive a pause resume instruction sent by the requesting end; in response to the pause Resume instruction, obtain the first UAV detection data, the first playback multiple and the first time interval; according to the pause resume instruction, set the time interval of the cache queue data to the first time interval; according to the first playback multiple and the first time interval, send the first UAV detection data to the subscription channel, or receive the modification playback multiple instruction sent by the request end, wherein the modification playback multiple instruction includes a second playback multiple; determine whether the second playback multiple is the same as the current playback multiple; if the second playback multiple is different from the current playback multiple, set the current playback multiple to the second playback multiple; according to the second playback multiple, push the UAV detection data to the request end.
[0070] Please refer to Figure 2 , Figure 2 It is a flowchart of a data playback method provided in an embodiment of the present application;
[0071] like Figure 2 As shown, the process of the data playback method includes:
[0072] Step S201: Acquire drone detection data and store the drone detection data in a database table;
[0073] For details, please refer to Figure 3 , Figure 3 yes Figure 2 A detailed flow chart of step S201 in FIG.
[0074] like Figure 3 As shown, step S201: obtaining drone detection data and storing the drone detection data in a database table, including:
[0075] Step S211: Obtain drone detection data and a timestamp corresponding to the drone detection data;
[0076] Specifically, the anti-UAV system will record various data during the flight of the UAV, including UAV detection data and the timestamp corresponding to the UAV detection data, wherein the timestamp corresponding to the UAV detection data indicates the time when the UAV detection data is acquired.
[0077] Step S212: performing routing segmentation on the drone detection data according to the timestamp to obtain segmented drone detection data;
[0078] Specifically, routing sharding refers to dividing the drone detection data into multiple segments in chronological order. This helps to better manage and analyze data when processing large amounts of data. The process of routing sharding includes: first determining the time length of each shard, for example, determining the time length of the shard to be every hour or every day, and then sorting the drone detection data according to the timestamp, and then traversing the sorted drone detection data, dividing the data belonging to the same time segment into one shard, and recording the start and end timestamps of the shard to obtain the sharded drone detection data.
[0079] Step S213: storing the fragmented drone detection data in a database table of the block buffer, and establishing an index of the fragmented drone detection data;
[0080] Specifically, the electronic device includes a block buffer, which is a storage area of the electronic device in blocks. The database table is the basic storage unit in the database, which is used to store data in an organized manner. It is similar to a spreadsheet and consists of rows (also called records or tuples) and columns (also called fields or attributes). Each row represents a specific data instance, and each column represents a specific attribute or feature of the data. Considering the requirement that the playback detection data runs at a frequency of about 100ms, the storage and transmission of the playback data should minimize the operation of large blocks of data. For example, drone detection data is large blocks of high-frequency data. The sharded drone detection data is stored in the database table of the block buffer, and an index of the sharded drone detection data is established, wherein the index is used to store the block address corresponding to the sharded drone detection data.
[0081] Step S202: after receiving the playback request sent by the requesting end, loading the drone detection data from the database table into the cache queue;
[0082] In an embodiment of the present application, the electronic device includes a front-end module and a back-end module. The front-end module is communicatively connected to the requesting end. The front-end module receives a playback request sent by the requesting end and sends the playback request to the back-end module.
[0083] For details, please refer to Figure 4 , Figure 4 yes Figure 2A detailed flow chart of step S202 in FIG.
[0084] like Figure 4 As shown, step S202: after receiving the playback request sent by the request end, the drone detection data is loaded from the database table into the cache queue, including:
[0085] Step S221: Create a message queue and a cache queue;
[0086] Specifically, a message queue and a cache queue are created, where a message queue is a technology used to decouple and coordinate communication between different components in a distributed system. It allows the sender to send messages to the queue, and the receiver to read messages from the queue. This mechanism allows producers and consumers to work at different times and at different rates without directly relying on each other. The cache queue is mainly used to improve the speed and efficiency of data access. It is usually located between the application and the persistent data storage (such as a database) to store frequently accessed data in order to quickly respond to data requests. In an embodiment of the present application, the message queue is used to store indexes, and the cache queue is used to store drone detection data corresponding to the indexes.
[0087] Step S222: adding a preset number of indexes to the message queue;
[0088] Specifically, the message queue is used to store indexes, and a preset number of indexes are added to the message queue according to time priority. Time priority refers to the stored data queue using the detection time as the index of the priority queue, so that the index corresponding to the earlier drone detection data is placed in front of the message queue to meet the same timing as playback and situation detection. The preset number can be set according to actual needs. For example, the preset number is set to 1024.
[0089] Step S223: Load the drone detection data corresponding to the index into the cache queue through the index in the message queue;
[0090] Specifically, through the index in the message queue, the drone detection data corresponding to the index is loaded into the cache queue according to the arrangement order of the index in the message queue, so as to facilitate the subsequent acquisition of the drone detection data from the cache queue.
[0091] Please refer to Figure 5 , Figure 5 It is a flowchart of determining whether the ratio of the amount of drone detection data in a cache queue to the capacity of the cache queue is less than a preset ratio threshold value provided by an embodiment of the present application;
[0092] like Figure 5As shown, the process of determining whether the ratio of the amount of drone detection data in the cache queue to the capacity of the cache queue is less than a preset ratio threshold includes:
[0093] Step S501: Obtain the amount of drone detection data in the cache queue;
[0094] Specifically, the number of drone detection data in the current cache queue is obtained to facilitate real-time control of the number of drone detection data in the cache queue.
[0095] Step S502: monitoring the amount of drone detection data in the cache queue to determine whether the ratio of the amount of drone detection data in the cache queue to the capacity of the cache queue is less than a preset ratio threshold;
[0096] Specifically, a monitoring task is created, which is used to monitor the number of drone detection data in the cache queue, and determine whether the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is less than a preset ratio threshold. If the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is less than the preset ratio threshold, enter step S503; if the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is greater than or equal to the preset ratio threshold, enter step S504.
[0097] Step S503: loading the drone detection data in the database table into the cache queue until the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is greater than or equal to a preset ratio threshold;
[0098] Specifically, the capacity of the cache queue refers to the maximum number of drone detection data that the cache queue can accommodate. If the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is less than a preset ratio threshold, it means that the drone detection data in the database table needs to be loaded into the cache queue. In this case, the drone detection data in the database table is loaded into the cache queue until the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is greater than or equal to the preset ratio threshold, wherein the preset ratio threshold can be set according to actual needs, for example, the preset ratio threshold is set to 20%.
[0099] Step S504: Do not load the drone detection data in the database table into the cache queue;
[0100] Specifically, if the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is greater than or equal to a preset ratio threshold, the drone detection data in the database table is not loaded into the cache queue.
[0101] Step S203: sending the drone detection data in the cache queue to the subscription channel according to the playback request;
[0102] For details, please refer to Figure 6 , Figure 6 yes Figure 2 A detailed flow chart of step S203 in FIG.
[0103] like Figure 6 As shown, step S203: according to the playback request, the drone detection data in the cache queue is sent to the subscription channel, including:
[0104] Step S231: Obtain the playback multiple in the playback request;
[0105] Specifically, the playback request sent by the requesting end includes a playback multiple, and the playback multiple is used to indicate the rate of video playback. It is understandable that the playback multiple includes but is not limited to 1x, 2x, 3x, and 4x.
[0106] Step S232: determining a first quantity corresponding to the playback multiple according to the playback multiple, and obtaining a first quantity of drone detection data from a cache queue;
[0107] Specifically, the first quantity refers to the amount of drone detection data per unit time. For example, assuming that the current total playback time is 1 minute, the unit time is 1 second, the playback multiple is 1, and the total amount of drone detection data required is 600, then the first quantity is 10. The first number of drone detection data are obtained from the cache queue. It can be understood that if the playback multiple is changed to 2, the first quantity becomes 20.
[0108] Step S233: Sending the first number of drone detection data to the subscription channel at fixed time intervals through a timer;
[0109] Specifically, a timer task is set, and the timer task is used to send a first number of drone detection data to a subscription channel at fixed time intervals through a timer, wherein the fixed time interval can be set according to actual needs, for example, the fixed time interval is set to 1 second.
[0110] Step S204: Pushing the drone detection data to the requesting end through the subscription channel;
[0111] Specifically, a subscription channel (Topic) in device subscription refers to a specific channel or channel, which is used to realize message transmission and communication between the device and the server. The requester receives messages of interest by subscribing to the Topic, while the sender pushes the drone detection data to the requester through the subscription channel.
[0112] Please refer to Figure 7 , Figure 7 It is a flowchart of a stop instruction sent by a requesting end provided in an embodiment of the present application;
[0113] like Figure 7 As shown, the process of receiving the stop instruction sent by the requesting end includes:
[0114] Step S701: receiving a stop instruction sent by a requesting end;
[0115] Specifically, the front-end module of the sending end receives a stop command sent by the requesting end, and the stop command is used to terminate the current playback of the drone detection data. It can be understood that after the stop command sent by the requesting end, it indicates that the current data playback has been terminated. If the requesting end needs to start the next data playback, the requesting end needs to send a playback request to the sending end again.
[0116] Step S702: In response to the stop instruction, the timer is turned off and the push of the drone detection data to the requesting end is stopped;
[0117] Specifically, the back-end module of the sending end responds to the stop instruction, turns off the timer and stops pushing the drone detection data to the requesting end.
[0118] Please refer to Figure 8 , Figure 8 It is a flowchart of a method of receiving a pause instruction sent by a requesting end provided in an embodiment of the present application;
[0119] like Figure 8 As shown, the process of receiving the pause instruction sent by the requesting end includes:
[0120] Step S801: receiving a pause instruction sent by a requesting end;
[0121] Specifically, the front-end module of the sending end receives the pause command sent by the requesting end, which is used to pause the current playback of the drone detection data. It can be understood that after the pause command sent by the requesting end, it indicates that the data playback has been paused. If the requesting end needs to start the data playback again, the requesting end needs to re-send a pause resume command to the sending end.
[0122] Step S802: The drone detection data, the current playback multiple, and the time interval of the current timer in the current cache queue are saved to obtain the first drone detection data, the first playback multiple, and the first time interval;
[0123] Specifically, after the back-end module of the sending end receives the pause instruction sent by the requesting end, the drone detection data, the current playback multiple and the current timer time interval in the current cache queue are saved to obtain the first drone detection data, the first playback multiple and the first time interval, wherein the first drone detection data, the first playback multiple and the first time interval are used to resume data playback after the subsequent receipt of the pause and resume instruction sent by the requesting end, so as to improve the efficiency of data playback.
[0124] Step S803: In response to the pause instruction, the time interval of the timer is set to infinity to temporarily stop sending the drone detection data in the cache queue to the subscription channel;
[0125] Specifically, after saving the current first drone detection data, the first playback multiple and the first time interval, the back-end module responds to the pause instruction and sets the time interval of the timer to infinity to temporarily stop sending the drone detection data in the cache queue to the subscription channel, and waits for the requesting end to send a pause resume instruction.
[0126] Please refer to Fig. 9 , Fig. 9 It is a flowchart of a method of receiving a pause instruction sent by a requesting end provided in an embodiment of the present application;
[0127] like Fig. 9 As shown, the process of receiving the pause instruction sent by the requesting end includes:
[0128] Step S901: receiving a pause and resume instruction sent by a requesting end;
[0129] Specifically, the front-end module of the sending end receives the pause and resume instruction sent by the requesting end, and the pause and resume instruction is used to resume the drone detection data, playback multiple and time interval in the buffer queue before the pause.
[0130] Step S902: In response to the pause and resume instruction, obtaining first drone detection data, a first playback multiple, and a first time interval;
[0131] Specifically, in response to the pause resume instruction, the first drone detection data, the first playback multiple, and the first time interval saved before the pause are obtained.
[0132] Step S903: according to the pause and resume instruction, the time interval for caching queue data is set to a first time interval;
[0133] Specifically, according to the pause and resume instruction, the time interval of the current cache queue data is set to the first time interval, so that the playing rate before and after the pause is the same.
[0134] Step S904: sending the first drone detection data to a subscription channel according to the first playback multiple and the first time interval;
[0135] Specifically, at every first time interval, the first drone detection data is sent to the subscription channel according to the first playback multiple. For example, assuming that the first playback multiple is 2 times, the first drone detection data is sent to the subscription channel at a rate of 2 times, so that the requesting end can obtain the drone detection data before the pause through the subscription channel.
[0136] Please refer to Fig.10 , Fig.10 It is a flowchart of a method for receiving a playback multiple modification instruction sent by a requesting end provided in an embodiment of the present application;
[0137] like Fig.10 As shown, the process of receiving the instruction to modify the playback multiple sent by the requesting end includes:
[0138] Step S1001: receiving a playback multiple modification instruction sent by a requesting end;
[0139] Specifically, the front-end module of the sending end receives the instruction for modifying the playback multiple sent by the requesting end, and the instruction for modifying the playback multiple is used to modify the current playback multiple, wherein the instruction for modifying the playback multiple includes the second playback multiple.
[0140] Step S1002: Determine whether the second playback multiple is the same as the current playback multiple;
[0141] Specifically, it is determined whether the second playback magnification is the same as the current playback magnification. If the second playback magnification is the same as the current playback magnification, the process proceeds to step S1003; if the second playback magnification is different from the current playback magnification, the process proceeds to step S1004.
[0142] Step S1003: Do not modify the current playback multiple;
[0143] Specifically, if the second playback magnification is the same as the current playback magnification, it means that there is no need to modify the playback magnification, and the current playback magnification is not modified.
[0144] Step S1004: setting the current playback multiple to the second playback multiple;
[0145] Specifically, if the second playback multiple is different from the current playback multiple, it means that there is no need to modify the playback multiple, then obtain the second playback multiple in the instruction to modify the playback multiple, and set the current playback multiple to the second playback multiple. For example, assuming that the first playback multiple is 2 times and the second playback multiple is 4 times, then modify the current playback multiple to the second playback multiple.
[0146] Step S1005: Pushing the drone detection data to the requesting end according to the second playback multiple;
[0147] Specifically, after the current playback multiple is modified to the second playback multiple, the drone detection data is pushed to the requesting end according to the second playback multiple.
[0148] Please refer to Fig.11 , Fig.11 It is a schematic diagram of a process for exporting drone detection data provided by an embodiment of the present application;
[0149] like Fig.11 As shown in the figure, the process of exporting drone detection data includes:
[0150] Step S1101: Obtain a data export request;
[0151] Specifically, a data export request is obtained, wherein the export request is used to export the drone detection data stored at the sending end to obtain an export file.
[0152] Step S1102: according to the time range, the drone detection data corresponding to the time range is exported to obtain an export file;
[0153] For details, please refer to Fig.12 , Fig.12 yes Fig.11 A detailed flowchart of step S1102 in FIG.
[0154] like Fig.12 As shown, step S1102: according to the time range, the drone detection data corresponding to the time range is exported to obtain an export file, including:
[0155] Step S1121: Obtain the time range of the exported data;
[0156] Specifically, the data export request includes the time range for exporting data. For example, if the time range for exporting data corresponding to the data export request is 30 days, then the drone detection data within 30 days needs to be exported.
[0157] Step S1122: determining whether the time range of the exported data is within a preset time range threshold;
[0158] Specifically, the types of exported files include database files and compressed files. In an embodiment of the present application, the type of exported file is determined based on the time range of the exported data to save storage space, and it is determined whether the time range of the exported data is within the preset time range threshold. If the time range of the exported data is within the preset time range threshold, step S1123 is entered; if the time range of the exported data is not within the preset time range threshold, step S1124 is entered. It should be noted that the preset time range threshold can be set according to actual conditions. For example, the preset time range threshold is set to 3 months.
[0159] Step S1123: Save the exported data as a database file;
[0160] Specifically, if the time range of the exported data is within a preset time range threshold, the exported data is saved as a database file.
[0161] Step S1124: Save the exported data as a compressed file;
[0162] Specifically, if the time range of the exported data is not within the preset time range threshold, the exported data is saved as a compressed file. It can be understood that saving the old data as a compressed file can save the memory space of the storage device.
[0163] Step S1103: verifying the export file by using a hash algorithm to determine whether the export file is generated correctly;
[0164] Specifically, after obtaining the export file, the total data amount and the file format will be verified through a hash algorithm to determine whether the export file is generated correctly, wherein the hash algorithm includes the md5 algorithm. If the export file is generated correctly, step S1104 is entered; if the export file is not generated correctly, step S1105 is entered.
[0165] Step S1104: deleting the drone detection data corresponding to the time range from the database table;
[0166] Specifically, if the export file is correctly generated, the drone detection data corresponding to the time range is deleted from the database table to save storage space on the sending end.
[0167] Step S1105: regenerate the export file;
[0168] Specifically, if the export file is not generated correctly, the drone detection data is re-acquired and the export file is generated according to the time range of the exported data, and the re-generated export file is then verified until the export file verification is successful.
[0169] In an embodiment of the present application, a data playback method is provided, which includes: obtaining drone detection data and storing the drone detection data in a database table; after receiving a playback request sent by the requesting end, loading the drone detection data from the database table into a cache queue; sending the drone detection data in the cache queue to a subscription channel according to the playback request; and pushing the drone detection data to the requesting end through the subscription channel. By loading the drone detection data into the cache queue; sending the drone detection data in the cache queue to the subscription channel according to the playback request; and pushing the drone detection data to the requesting end through the subscription channel, the present application can improve the efficiency of data playback and avoid freezing of the data playback screen.
[0170] Please refer to Fig.13 , Fig.13 It is a structural diagram of a data playback system provided in an embodiment of the present application;
[0171] like Fig.13 As shown, the data playback system includes a front-end module 1301 and a back-end module 1302;
[0172] The front-end module 1301 is communicatively connected to the requesting end and the back-end module 1302, and the front-end module 1301 is used to receive a playback request sent by the requesting end; specifically, the front-end module 1301 is communicatively connected to the requesting end, and the front-end module 1301 receives the playback request sent by the requesting end and sends the playback request to the back-end module 1302.
[0173] The back-end module 1302 is communicatively connected to the front-end module 1301. The back-end module 1302 is used to obtain drone detection data and store the drone detection data in a database table; after receiving a playback request sent by the requesting end, the drone detection data is loaded from the database table into a cache queue; according to the playback request, the drone detection data in the cache queue is sent to the subscription channel; through the subscription channel, the drone detection data is pushed to the requesting end; specifically, after receiving the playback request sent by the requesting end, the back-end module 1302 creates a message queue and a cache queue, wherein the message queue is a technology for decoupling and coordinating communications between different components in a distributed system, which allows the sender to send messages to the queue and the receiver to read messages from the queue. This mechanism enables producers and consumers to work at different times and at different rates without directly relying on each other, and the cache queue is mainly used to improve the speed and efficiency of data access, and is usually located between an application and a persistent data storage (such as a database) to store frequently accessed data in order to quickly respond to data requests. In an embodiment of the present application, the message queue is used to store indexes, and the cache queue is used to store drone detection data corresponding to the indexes. The message queue is used to store indexes, and a preset number of indexes are added to the message queue according to the time priority. The time priority refers to the stored data queue using the detection time as the index of the priority queue. The drones detected earlier are placed in the front of the queue to meet the same timing of playback and situation detection. The preset number can be set according to actual needs. For example, the preset number is set to 1024, and then the playback multiple in the playback request is obtained; according to the playback multiple, the first number corresponding to the playback multiple is determined, and the first number of drone detection data is obtained from the cache queue; through the timer, the first number of drone detection data is sent to the subscription channel at fixed time intervals, wherein the subscription channel (Topic) in the device subscription refers to a specific channel or channel, which is used to realize message transmission and communication between the device and the server. The requesting end receives messages of interest by subscribing to the Topic. Finally, the sending end pushes the drone detection data to the requesting end through the subscription channel.
[0174] In some embodiments, the back-end module 1302 is also used to monitor the number of drone detection data in the cache queue, and determine whether the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is less than a preset ratio threshold; if the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is less than the preset ratio threshold, the drone detection data in the database table is loaded into the cache queue until the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is greater than or equal to the preset ratio threshold.
[0175] In an embodiment of the present application, the front-end module and the back-end module are separated by utilizing the front-end and back-end separation technology, so that the front-end module is responsible for obtaining playback requests and displaying and rendering drone detection data, and the back-end module is responsible for obtaining, storing, loading, flow control and pushing drone detection data, thereby making full use of the rendering advantages of the front-end module and the advantages of back-end processing logic, calculation, and data storage. The present application can effectively utilize the CPU and memory resources of electronic devices.
[0176] In an embodiment of the present application, a data playback system is provided, which includes: a front-end module, a communication connection request end and a back-end module, the front-end module is used to receive a playback request sent by the request end; a back-end module, a communication connection front-end module, the back-end module is used to obtain drone detection data, and store the drone detection data in a database table; after receiving the playback request sent by the request end, the drone detection data is loaded from the database table to a cache queue; according to the playback request, the drone detection data in the cache queue is sent to a subscription channel; through the subscription channel, the drone detection data is pushed to the request end. By loading the drone detection data into the cache queue; according to the playback request, the drone detection data in the cache queue is sent to the subscription channel; through the subscription channel, the drone detection data is pushed to the request end, the present application can improve the efficiency of data playback and avoid the data playback screen from freezing.
[0177] Please refer to Fig.14 , Fig.14 This is a schematic diagram of the interaction timing between a front-end module and a back-end module provided in an embodiment of the present application;
[0178] like Fig.14As shown, the back-end module includes a back-end instruction processing unit and a back-end data processing unit. Specifically, the back-end instruction processing unit is used to respond to the playback request, pause instruction, pause resume instruction, and stop instruction sent by the front-end module. The back-end data processing unit is used to push the drone detection data to the requesting end. When the front-end module of the sending end receives the playback request sent by the requesting end, it sends the playback request to the back-end module, wherein the playback request can be understood as a request to start playback; the back-end module obtains the drone detection data, and stores the drone detection data in a database table. According to the timestamp, the drone detection data is routed and fragmented to obtain the fragmented drone detection data, and the fragmented drone detection data is sent to the back-end module. The drone detection data after sharding is stored in a database table of the block buffer, and an index of the drone detection data after sharding is established. After receiving the playback request sent by the request end, the drone detection data is loaded from the database table to the cache queue through the index; the playback multiple in the playback request is obtained; according to the playback multiple, a first quantity corresponding to the playback multiple is determined, and a first number of drone detection data is obtained from the cache queue; a timer is started to send the first number of drone detection data to the subscription channel at fixed time intervals; the drone detection data is pushed to the request end through the subscription channel, for example, the drone detection data is pushed to the request end through the WebSocket protocol.
[0179] When the front-end module of the transmitting end receives the pause instruction sent by the requesting end, the pause instruction is used to pause the current playback of the drone detection data. It can be understood that after the pause instruction sent by the requesting end, it indicates that the data playback has been paused. If the requesting end needs to restart the data playback, the requesting end needs to resend a pause and resume instruction to the transmitting end. After the back-end module of the transmitting end receives the pause instruction sent by the requesting end, the drone detection data, the current playback multiple and the time interval of the current timer in the current cache queue are saved to obtain the first drone detection data, the first playback multiple and the first time interval, wherein the first drone detection data, the first playback multiple and the first time interval are used to resume the data playback after receiving the pause and resume instruction sent by the requesting end in the future, so as to improve the efficiency of data playback. After saving the current first drone detection data, the first playback multiple and the first time interval, the back-end module responds to the pause instruction and sets the time interval of the timer to infinity to temporarily stop sending the drone detection data in the cache queue to the subscription channel, and waits for the requesting end to send the pause and resume instruction.
[0180] When the front-end module of the transmitting end receives the pause and resume instruction sent by the requesting end, the pause and resume instruction is used to resume the drone detection data, playback multiple and time interval in the buffer queue before the pause. In response to the pause and resume instruction, the first drone detection data, the first playback multiple and the first time interval saved before the pause are obtained; according to the pause and resume instruction, the time interval of the current cache queue data is set to the first time interval so that the playback rate before and after the pause is the same; the first drone detection data is sent to the subscription channel at the first playback multiple. For example, assuming that the first playback multiple is 2 times, the first drone detection data is sent to the subscription channel at a rate of 2 times, so that the requesting end can obtain the drone detection data before the pause through the subscription channel.
[0181] When the front-end module of the sending end receives the stop command sent by the requesting end, the stop command is used to terminate the current playback of the drone detection data. It can be understood that after the stop command sent by the requesting end, it means that the current data playback has been terminated. If the requesting end needs to start the next data playback, the requesting end needs to resend a playback request to the sending end. The back-end module of the sending end responds to the stop command, turns off the timer and deletes the push task to stop pushing the drone detection data to the requesting end.
[0182] Please refer to Fig.15 , Fig.15 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0183] like Fig.15 As shown, Fig.15 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0184] like Fig.15 As shown, the electronic device 150 includes one or more processors 1501 and a memory 1502. Fig.15 A processor 1501 is taken as an example.
[0185] The processor 1501 and the memory 1502 may be connected via a bus or other means. Fig.15 The example of connecting through bus is taken in the following.
[0186] Processor 1501 is used to provide computing and control capabilities to control the electronic device 150 to perform corresponding tasks, for example, to control the electronic device 150 to perform the data playback method in any of the above method embodiments, the data playback method including: receiving a playback request sent by the requesting end; obtaining drone detection data, and loading the drone detection data into a cache queue; sending the drone detection data in the cache queue to a subscription channel according to the playback request; and pushing the drone detection data to the requesting end through the subscription channel.
[0187] By loading the drone detection data into the cache queue; sending the drone detection data in the cache queue to the subscription channel according to the playback request; and pushing the drone detection data to the requesting end through the subscription channel, this application can improve the efficiency of data playback and avoid data playback screen freezes.
[0188] Processor 1501 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a hardware chip or any combination thereof; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0189] The memory 1502, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the data playback method in the embodiment of the present application. The processor 1501 can implement the data playback method in any of the following method embodiments by running the non-transitory software programs, instructions and modules stored in the memory 1502. Specifically, the memory 1502 may include a volatile memory (volatile memory, VM), such as a random access memory (random access memory, RAM); the memory 1502 may also include a non-volatile memory (non-volatile memory, NVM), such as a read-only memory (read-only memory, ROM), a flash memory (flash memory), a hard disk drive (hard disk drive, HDD) or a solid-state drive (solid-state drive, SSD) or other non-transitory solid-state storage device; the memory 1502 may also include a combination of the above-mentioned types of memory.
[0190] The memory 1502 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 1502 may optionally include a memory remotely arranged relative to the processor 1501, and these remote memories may be connected to the processor 1501 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0191] One or more modules are stored in the memory 1502, and when executed by one or more processors 1501, the data playback method in any of the above method embodiments is executed, for example, the data playback method described above is executed. Figure 2 The steps shown can also be implemented Fig.13 The functions of each module or unit.
[0192] In the embodiment of the present application, the electronic device 150 may also have components such as a wired or wireless network interface, a keyboard, and an input / output interface for input and output. The electronic device 150 may also include other components for realizing device functions, which will not be described in detail here.
[0193] The present application also provides a non-volatile computer-readable storage medium, such as a memory including a program code, and the program code can be executed by a processor to complete the data playback method in the above embodiment. For example, the non-volatile computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), a magnetic tape, a floppy disk, and an optical data storage device.
[0194] The embodiment of the present application also provides a computer program product, which includes one or more program codes, and the program codes are stored in a non-volatile computer-readable storage medium. The processor of the electronic device reads the program code from the non-volatile computer-readable storage medium, and the processor executes the program code to complete the method steps of the data playback method provided in the above embodiment.
[0195] A person skilled in the art will appreciate that all or part of the steps for implementing the above embodiments may be accomplished by hardware or by hardware associated with a program code, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0196] Through the description of the above implementation methods, a person of ordinary skill in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, can also be implemented by hardware. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the non-volatile computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0197] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as mentioned above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A data playback method, characterized in that: The method comprises: Acquire drone detection data, and store the drone detection data in a database table; After receiving the playback request sent by the requesting end, loading the drone detection data from the database table into the cache queue; According to the playback request, the drone detection data in the cache queue is sent to the subscription channel; The drone detection data is pushed to the requesting end through the subscription channel.
2. The method according to claim 1, characterized in that The obtaining of drone detection data and storing the drone detection data in a database table includes: Obtaining drone detection data and a timestamp corresponding to the drone detection data; According to the timestamp, the drone detection data is routed and fragmented to obtain fragmented drone detection data; The fragmented drone detection data is stored in a database table of a block buffer, and an index of the fragmented drone detection data is established, wherein the index is used to store a block address corresponding to the fragmented drone detection data.
3. The method according to claim 1, characterized in that The method further comprises: Monitoring the amount of drone detection data in the cache queue to determine whether a ratio of the amount of drone detection data in the cache queue to the capacity of the cache queue is less than a preset ratio threshold; If the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is less than a preset ratio threshold, the drone detection data in the database table is loaded into the cache queue until the ratio of the number of drone detection data in the cache queue to the capacity of the cache queue is greater than or equal to the preset ratio threshold.
4. The method according to claim 1, characterized in that: The playback request includes a playback multiple, and sending the drone detection data in the cache queue to a subscription channel according to the playback request includes: Obtaining the playback multiple in the playback request; According to the playback multiple, determining a first quantity corresponding to the playback multiple, and obtaining a first quantity of drone detection data in the cache queue; The first number of drone detection data are sent to the subscription channel at fixed time intervals through a timer.
5. The method according to claim 4, characterized in that The method further comprises: receiving a stop instruction sent by the requesting end; In response to the stop instruction, the timer is turned off and the push of the drone detection data to the requesting end is stopped.
6. The method according to claim 4, characterized in that The method further comprises: Receiving a pause instruction sent by the requesting end; The drone detection data, the current playback multiple, and the time interval of the current timer in the current cache queue are saved to obtain the first drone detection data, the first playback multiple, and the first time interval; In response to the pause instruction, the time interval of the timer is set to infinity to temporarily stop sending the drone detection data in the cache queue to the subscription channel.
7. The method according to claim 6, characterized in that The method further comprises: Receiving a pause and resume instruction sent by the requesting end; In response to the pause and resume instruction, acquiring the first drone detection data, the first playback multiple, and the first time interval; According to the pause and resume instruction, setting the time interval of the cache queue data to a first time interval; The first drone detection data is sent to the subscription channel according to the first playback multiple and the first time interval.
8. A data playback system, characterized in that: The system comprises: A front-end module, which is communicatively connected to the request end and the back-end module, and is used to receive a playback request sent by the request end; A back-end module is communicatively connected to the front-end module, and is used to obtain drone detection data and store the drone detection data in a database table; after receiving a playback request sent by the requesting end, the drone detection data is loaded from the database table to a cache queue; according to the playback request, the drone detection data in the cache queue is sent to a subscription channel; and the drone detection data is pushed to the requesting end through the subscription channel.
9. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data playback method according to any one of claims 1 to 7.
10. A non-volatile computer-readable storage medium, characterized in that: The non-volatile computer storage medium stores a computer program or instruction, and when the computer program or instruction is executed, the data playback method according to any one of claims 1 to 7 is implemented.