Method for switching data transmission link and electronic device

By recording the data frame sequences of the initial and target links, obtaining the frame buffer queue type and switching judgment conditions, and constructing the frame buffer queue, seamless switching of data transmission links is achieved. This solves the problem of link switching affecting data quality in existing technologies, ensuring the continuity of data transmission and user experience.

CN116828031BActive Publication Date: 2026-03-27HANGZHOU HUACHENG SOFTWARE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-25
Publication Date
2026-03-27

Smart Images

  • Figure CN116828031B_ABST
    Figure CN116828031B_ABST
Patent Text Reader

Abstract

The application discloses a data transmission link switching method and an electronic device. The data transmission link switching method comprises the following steps: recording a frame sequence of data frames transmitted in an initial link to obtain an initial link frame sequence; obtaining a frame sequence of data frames transmitted in a target link in response to successful creation of the target link; obtaining a frame buffer queue type and a switching judgment condition matched with a comparison result by comparing the initial link frame sequence with the target link frame sequence; constructing a frame buffer queue based on the frame buffer queue type; and switching the initial link to the target link in response to the frame buffer queue satisfying the switching judgment condition, so as to realize seamless switching between links and ensure continuity of data frame transmission.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication, in particular to a data transmission link switching method and electronic equipment. BACKGROUND

[0002] At present, there are many types of links for data transmission, and the selection of data transmission link is generally made according to the actual situation of data transmission.

[0003] For example, in the field of security monitoring, when the client obtains video stream data from the monitoring device, the peer-to-peer (P2P) link is usually selected for streaming, but the P2P link establishment needs the participation of the P2P server and the link needs to be established for a certain time, which will cause the video stream data to be pulled slowly, resulting in poor user experience. Therefore, when the P2P link is not created, other types of links can be selected for video stream data acquisition, such as selecting a media transcoding server (MTS) link for video stream data acquisition, which can ensure the timeliness of the video display of the client. After the P2P link is successfully created, the MTS link can be switched to the P2P link.

[0004] However, the current link switching method is relatively rough, which is generally directly switched from the current link to another link, which may affect the quality of the data to be transmitted. For example, when the data to be transmitted is video stream data, directly switching from the current link to another link may cause problems such as mosaic, second skipping, video rollback, etc. SUMMARY

[0005] The present application provides at least a data transmission link switching method and electronic equipment.

[0006] The first aspect of the present application provides a data transmission link switching method, comprising: recording the frame sequence of the data frames transmitted in the initial link to obtain an initial link frame sequence; in response to the successful creation of a target link, obtaining the frame sequence of the data frames transmitted in the target link to obtain a target link frame sequence; comparing the initial link frame sequence and the target link frame sequence to obtain a frame buffer queue type and a switching judgment condition matched with the comparison result; constructing a frame buffer queue based on the frame buffer queue type, and in response to the frame buffer queue meeting the switching judgment condition, switching the initial link to the target link.

[0007] In an embodiment, the initial link frame sequence comprises a frame sequence of a latest data frame in the initial link, and the target link frame sequence comprises a frame sequence of a first data frame in the target link; the comparison between the initial link frame sequence and the target link frame sequence is performed to obtain a frame buffer queue type and a switching judgment condition matched with the comparison result, including: obtaining a comparison result by comparing the sequence order between the frame sequence of the latest data frame in the initial link and the frame sequence of the first data frame in the target link; and obtaining the frame buffer queue type and the switching judgment condition matched with the comparison result.

[0008] In an embodiment, the obtaining of the frame buffer queue type and the switching judgment condition matched with the comparison result includes: if the comparison result indicates that the frame sequence of the latest data frame in the initial link is less than the frame sequence of the first data frame in the target link, taking the target link frame type as the frame buffer queue type matched with the comparison result and taking the target link frame switching condition as the switching judgment condition matched with the comparison result; and if the comparison result indicates that the frame sequence of the latest data frame in the initial link is greater than the frame sequence of the first data frame in the target link, taking the initial link frame type as the frame buffer queue type matched with the comparison result and taking the initial link frame switching condition as the switching judgment condition matched with the comparison result.

[0009] In an embodiment, the target link frame buffer queue is constructed based on the target link frame type, and the initial link is switched to the target link in response to the target link frame buffer queue satisfying the target link frame switching condition, including: constructing the target link frame buffer queue based on the data frames transmitted in the target link, and the data frames cached in the target link frame buffer queue are sorted according to the frame sequence; obtaining the frame sequence of the latest data frame in the initial link and obtaining the frame sequence of the first data frame in the target link frame buffer queue; and if the frame sequence of the latest data frame in the initial link is the same as the frame sequence of the first data frame in the target link frame buffer queue, the target link frame buffer queue satisfies the target link frame switching condition, and the initial link is switched to the target link.

[0010] In an embodiment, the switching of the initial link to the target link includes: extracting all the data frames in the target link frame buffer queue; performing frame application processing on all the data frames in the target link frame buffer queue, and switching the initial link to the target link.

[0011] In an embodiment, the method further includes: if the frame sequence of the latest data frame in the initial link is not the same as the frame sequence of the first data frame in the target link frame buffer queue, performing frame application processing on the latest data frame in the initial link.

[0012] In an embodiment, the initial link frame buffer queue is constructed based on the initial link frame type, and the initial link is switched to the target link in response to the initial link frame buffer queue satisfying an initial link frame switching condition, including: constructing the initial link frame buffer queue based on data frames in the initial link, the data frames cached in the initial link frame buffer queue being sorted according to frame sequences; obtaining a frame sequence of a latest data frame in the target link, and obtaining a frame sequence of a first data frame in the initial link frame buffer queue; if the frame sequence of the latest data frame in the target link is the same as the frame sequence of the first data frame in the initial link frame buffer queue, the initial link frame buffer queue satisfies the initial link frame switching condition, and the initial link is switched to the target link.

[0013] In an embodiment, the initial link frame buffer queue is constructed based on data frames in the initial link, including: obtaining a cached frame quantity corresponding to the initial link frame buffer queue; if the cached frame quantity is equal to a frame quantity threshold, performing frame application processing on the first data frame in the initial link frame buffer queue, deleting the first data frame in the initial link frame buffer queue, and adding the data frame transmitted in the initial link to the initial link frame buffer queue; if the cached frame quantity is less than the frame quantity threshold, adding the data frame transmitted in the initial link to the initial link frame buffer queue.

[0014] In an embodiment, the initial link is switched to the target link, including: extracting the first data frame in the initial link frame buffer queue; performing frame application processing on the first data frame in the initial link frame buffer queue, and switching the initial link to the target link.

[0015] The second aspect of the present application provides a switching device of a data transmission link, including: an initial frame sequence obtaining module, configured to record frame sequences of data frames transmitted in an initial link to obtain an initial link frame sequence; a target frame sequence obtaining module, configured to obtain frame sequences of data frames transmitted in a target link to obtain a target link frame sequence in response to the target link being successfully created; a comparison module, configured to compare the initial link frame sequence and the target link frame sequence to obtain a frame buffer queue type and a switching judgment condition matched with a comparison result; and a switching module, configured to construct a frame buffer queue based on the frame buffer queue type, and switch the initial link to the target link in response to the frame buffer queue satisfying the switching judgment condition.

[0016] The third aspect of the present application provides an electronic device, including a memory and a processor, the processor being configured to execute program instructions stored in the memory to implement the above-mentioned switching method of a data transmission link.

[0017] The fourth aspect of the present application provides a computer readable storage medium, having program instructions stored thereon, the program instructions being executed by a processor to implement the above-mentioned switching method of a data transmission link.

[0018] The scheme records the frame sequence of the data frames transmitted in the initial link to obtain an initial link frame sequence, acquires the frame sequence of the data frames transmitted in the target link in response to the successful creation of the target link, obtains a frame buffer queue type and a switching judgment condition matched with the comparison result by comparing the initial link frame sequence and the target link frame sequence, constructs a frame buffer queue based on the frame buffer queue type, and switches the initial link to the target link in response to the frame buffer queue satisfying the switching judgment condition, so as to realize seamless switching between links and ensure the continuity of data frame transmission.

[0019] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, rather than limiting the present application. BRIEF DESCRIPTION OF DRAWINGS

[0020] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the technical solutions of the present application.

[0021] Figure 1 is a schematic diagram of an implementation environment involved in the present application;

[0022] Figure 2 is a flowchart of a switching method of a data transmission link according to an example embodiment of the present application;

[0023] Figure 3 is a comparison diagram of an initial link frame sequence and a target link frame sequence according to an example embodiment of the present application;

[0024] Figure 4 is a construction diagram of a target link frame buffer queue according to an example embodiment of the present application;

[0025] Figure 5 is a flowchart of link switching according to an example embodiment of the present application;

[0026] Figure 6 is a construction diagram of an initial link frame buffer queue according to an example embodiment of the present application;

[0027] Figure 7 is a flowchart of link switching according to another example embodiment of the present application;

[0028] Figure 8 is a schematic diagram of link switching according to an example embodiment of the present application;

[0029] Figure 9 is a flowchart of link switching according to another example embodiment of the present application;

[0030] Figure 10is a block diagram of a switching device of a data transmission link according to an example embodiment of the present application;

[0031] Figure 11 is a structural schematic diagram of an electronic device according to an example embodiment of the present application;

[0032] Figure 12 is a structural schematic diagram of a computer readable storage medium according to an example embodiment of the present application. DETAILED DESCRIPTION

[0033] The scheme of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0034] In the following description, specific details such as specific system structures, interfaces, techniques, etc. are presented in order to provide a thorough understanding of the present application for the sake of explanation, but not for the sake of limitation.

[0035] The term "and / or" herein is merely a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the three cases of existence of A alone, existence of A and B simultaneously, and existence of B alone. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects. In addition, "multiple" herein means two or more than two. In addition, the term "at least one" herein means any one of multiple or any combination of at least two of multiple, for example, including at least one of A, B and C can mean including any one or more elements selected from the set consisting of A, B and C.

[0036] The data transmission link switching method provided by the embodiments of the present application will be described below.

[0037] Please refer to Figure 1 , Figure 1 is a schematic diagram of an implementation environment related to the data transmission link switching method in the present application. As Figure 1 shown, the implementation environment includes a data providing end 110, a data receiving end 120 and a link control end 130, the data providing end 110 and the data receiving end 120 can be directly or indirectly connected through wired or wireless communication mode, and the link control end 130 manages the connection between the data providing end 110 and the data receiving end 120.

[0038] The data providing end 110, the data receiving end 120 and the link control end 130 can be a terminal or a server.

[0039] The terminal can be a mobile phone, a computer, a smart home appliance, a vehicle-mounted terminal, a flying device, a camera, and the like, but is not limited thereto. The server can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and basic cloud computing services such as big data and artificial intelligence platforms.

[0040] Exemplarily, the data receiving end 120 sends a data acquisition request to the data providing end 110, the data providing end 110 determines the to-be-transmitted data based on the data acquisition request, the to-be-transmitted data is composed of multiple data frames, then the data providing end 110 establishes an initial link between the data providing end 110 and the data receiving end 120 based on the link control end 130, the data providing end 110 sends the to-be-transmitted data frame by frame based on the initial link, the data receiving end 120 receives the data frames transmitted in the initial link, and the link control end 130 records the frame sequence of the data frames transmitted in the initial link in the data transmission process to obtain an initial link frame sequence. If the link control end 130 detects that the target link is successfully created, the data providing end 110 can send the to-be-transmitted data frame by frame based on the initial link and the target link at the same time, the link control end 130 can obtain the frame sequence of the data frames transmitted in the target link to obtain a target link frame sequence, then compare the initial link frame sequence and the target link frame sequence, create frame buffer queues of different types based on the comparison result, and switch according to the frame buffer queues of different types to determine whether the frame buffer queues meet the switching judgment condition, and if so, switch the initial link to the target link.

[0041] In some embodiments, the link control end 130 can be separately arranged from the data providing end 110 and the data receiving end 120, or can be integrally arranged with the data providing end 110 or the data receiving end 120, which is not limited in the present application.

[0042] It can be understood that in the specific embodiments of the present application, data such as data frames and the like are involved, and when the above embodiments of the present application are applied to specific products or technologies, the permission or consent of the user needs to be obtained, and the collection, use and processing of the related data need to comply with the relevant laws, regulations and standards of the country and region.

[0043] Please refer to Figure 2 , Figure 2 is a flowchart of a data transmission link switching method according to an exemplary embodiment of the present application. The data transmission link switching method can be applied to Figure 1The illustrated implementation environment, and by the link control end in the implementation environment. It should be understood that the method can also be applied to other exemplary implementation environments, and by the device in other implementation environments, the embodiment does not limit the implementation environment to which the method is applied.

[0044] The data transmission link switching method proposed in the embodiment of the application is described in detail below with the link control end as the specific execution subject.

[0045] Please refer to Figure 2 , Figure 2 The flowchart of the data transmission link switching method shown in an exemplary embodiment of the application is shown in FIG. 2. As Figure 2 shown, in an exemplary embodiment, the data transmission link switching method comprises at least steps S210 to S240, which are described in detail as follows:

[0046] Step S210: Record the frame sequence of the data frames transmitted in the initial link to obtain the initial link frame sequence.

[0047] The data frames are obtained based on the to-be-transmitted data in the data providing end. The to-be-transmitted data can be video data, audio data, etc., which is not limited by the application.

[0048] For example, if the to-be-transmitted data is video data, the data frame is an image frame, and if the to-be-transmitted data is audio data, the data frame is an audio frame.

[0049] The frame sequence is used to describe the position of the data frame in the to-be-transmitted data. For example, if the to-be-transmitted data is video data, the data frame is an image frame, and the frame sequence can be obtained based on the frame number, the picture group (GOP) in which the frame is located, the offset value of the frame in the GOP, etc.

[0050] The initial link is created in advance between the data providing end and the data receiving end, and the data providing end transmits data frames to the data receiving end through the initial link. The link control end records the frame sequence of the data frames transmitted in the initial link to obtain the initial link frame sequence. The initial link frame sequence can be the frame sequence of all data frames transmitted in the initial link, or the frame sequence of the latest data frame transmitted in the initial link, which is not limited by the application.

[0051] Step S220: In response to the successful creation of the target link, obtain the frame sequence of the data frames transmitted in the target link to obtain the target link frame sequence.

[0052] The data frames transmitted in the target link correspond to the same to-be-transmitted data as the data frames transmitted in the initial link.

[0053] The target link can be created based on the link switching request.

[0054] Exemplarily, the data providing end or the data receiving end can initiate the link switching request to request switching the initial link to the target link. For example, the data providing end and the data receiving end adopt the initial link to transmit data frames, the data receiving end side receives a link switching operation performed by a user, sends a link switching request to the data providing end, the data providing end sends a creation request of the target link to the link control end based on the link switching request, the link control end creates the target link based on the creation request of the target link, records a frame sequence of the data frames transmitted in the initial link to obtain an initial link frame sequence, and then, in response to successful creation of the target link, obtains a frame sequence of the data frames transmitted in the target link to obtain a target link frame sequence.

[0055] Exemplarily, the link control end can also store a link creation strategy, and can determine a corresponding link creation strategy based on data transmission services between the data providing end and the data receiving end. For example, the data providing end and the data receiving end need to transmit video data, and the corresponding link creation strategy is to create an MTS link as an initial link for video frame transmission, record a frame sequence of the data frames transmitted in the initial link to obtain an initial link frame sequence, and create a P2P link at the same time. After detecting successful creation of the P2P link, the P2P link is used as a target link to obtain a target link frame sequence.

[0056] Step S230: Comparing the initial link frame sequence and the target link frame sequence, obtaining a frame buffer queue type and a switching judgment condition matched with the comparison result.

[0057] Since the data frames transmitted after successful creation of the target link and the data frames transmitted in the initial link can not be continuous, the initial link frame sequence and the target link frame sequence need to be compared. The comparison result is used to reflect the difference between the data frames transmitted in the target link and the initial link, so as to determine different frame buffer queue types and switching judgment conditions according to different difference conditions.

[0058] Step S240: Constructing a frame buffer queue based on the frame buffer queue type, and switching the initial link to the target link in response to the frame buffer queue satisfying the switching judgment condition.

[0059] The frame buffer queues constructed by different frame buffer queue types are used to buffer data frames of different links.

[0060] After the frame buffer queue is constructed, the data frames in the corresponding link are added to the frame buffer queue, and it is periodically judged whether the frame buffer queue satisfies the switching judgment condition. If the frame buffer queue satisfies the switching judgment condition, the initial link is switched to the target link, so as to realize seamless switching between links and guarantee the continuity of the data frames received by the data receiving end.

[0061] In some embodiments, the initial link frame sequence comprises the frame sequence of the latest data frame in the initial link, and the target link frame sequence comprises the frame sequence of the first data frame in the target link; the frame buffer queue type and the switching judgment condition matched with the comparison result are obtained by comparing the initial link frame sequence and the target link frame sequence, comprising: comparing the sequence order between the frame sequence of the latest data frame in the initial link and the frame sequence of the first data frame in the target link to obtain the comparison result; and obtaining the frame buffer queue type and the switching judgment condition matched with the comparison result.

[0062] For example, when a data frame in the initial link arrives, the frame sequence of the data frame is recorded to obtain the initial link frame sequence, and when a new data frame in the initial link arrives, the frame sequence of the new data frame replaces the original sequence value of the initial link frame sequence.

[0063] After the target link is successfully created, the first data frame transmitted in the target link is obtained, and the frame sequence of the first data frame is recorded. Then, the sequence order between the frame sequence of the latest data frame in the initial link and the frame sequence of the first data frame in the target link is compared to obtain a comparison result, and the frame buffer queue type and the switching judgment condition are determined according to the comparison result.

[0064] For example, the frame buffer queue type and the switching judgment condition matched with the comparison result are obtained, comprising: if the comparison result represents that the frame sequence of the latest data frame in the initial link is less than the frame sequence of the first data frame in the target link, the target link frame type is taken as the frame buffer queue type matched with the comparison result, and the target link frame switching condition is taken as the switching judgment condition matched with the comparison result; if the comparison result represents that the frame sequence of the latest data frame in the initial link is greater than the frame sequence of the first data frame in the target link, the initial link frame type is taken as the frame buffer queue type matched with the comparison result, and the initial link frame switching condition is taken as the switching judgment condition matched with the comparison result.

[0065] For example, please refer to Figure 3 , Figure 3 The comparison diagram of the initial link frame sequence and the target link frame sequence shown in the exemplary embodiment of the present application is as follows: Figure 3As shown, taking an example that the to-be-transmitted data is video data, the initial link is an MTS link, and the target link is a P2P link, the latest data frame of the MTS link is acquired, the frame sequence value of the latest data frame is recorded as M, and the latest data frame is subjected to frame application processing. Then, it is detected that the P2P link is successfully created, the first data frame of the P2P link is acquired, the frame sequence value of the first data frame is recorded as P0, it is judged whether P0 is greater than M, if P0 is greater than M, the frame buffer queue type is the target link frame type, a target link frame buffer queue is created, that is, a P2P link frame buffer queue is created, which is used to store the data frames transmitted in the P2P link, and the switching judgment condition is the target link frame switching condition, so as to judge whether to perform link switching according to the target link frame switching condition; if P0 is not greater than M, it is judged whether P0 is equal to M, if P0 is equal to M, it is indicated that the first data frame in the P2P link is continuous with the latest data frame of the MTS link, and the P2P link is directly switched to; if P0 is not equal to M, the frame buffer queue type is the initial link frame type, an initial link frame buffer queue is created, that is, an MTS link frame buffer queue is created, which is used to store the data frames transmitted in the MTS link, and the switching judgment condition is the initial link frame switching condition, so as to judge whether to perform link switching according to the initial link frame switching condition.

[0066] The frame application processing includes but is not limited to sending to a data receiving end, data frame decoding, etc.

[0067] In some embodiments, the target link frame buffer queue is constructed based on the target link frame type, and the initial link is switched to the target link in response to the target link frame buffer queue satisfying the target link frame switching condition, including: the target link frame buffer queue is constructed based on the data frames transmitted in the target link, and the data frames cached in the target link frame buffer queue are sorted according to frame sequences; the frame sequence of the latest data frame in the initial link is acquired, and the frame sequence of the first data frame in the target link frame buffer queue is acquired; if the frame sequence of the latest data frame in the initial link is the same as the frame sequence of the first data frame in the target link frame buffer queue, the target link frame buffer queue satisfies the target link frame switching condition, and the initial link is switched to the target link.

[0068] If the frame sequence of the latest data frame in the initial link is less than the frame sequence of the first data frame in the target link, it is indicated that there is a data gap between the data frames transmitted in the target link and the data frames transmitted in the initial link. For example, refer to Figure 4 , Figure 4 The construction schematic diagram of the target link frame buffer queue shown in the example embodiment of the present application is as shown in Figure 4As shown, at T1 moment, the frame sequence of the latest data frame in the initial link is 3, and the frame sequence of the first data frame in the target link is 6, so there is a data gap, the target link frame buffer queue is created to buffer the data frames transmitted in the target link, and the initial link still continuously transmits the data frames, and each time the initial link updates the latest data frame, the frame sequence of the latest data frame in the initial link is compared with the frame sequence of the first data frame in the target link frame buffer queue, for example, at T2 moment, it is detected that the frame sequence of the latest data frame in the initial link is the same as the frame sequence of the first data frame in the target link frame buffer queue, so it is indicated that the data gap has been eliminated, the target link frame switching condition is met, and the initial link is switched to the target link.

[0069] In some embodiments, switching the initial link to the target link comprises: extracting all the data frames in the target link frame buffer queue; performing frame application processing on all the data frames in the target link frame buffer queue, and switching the initial link to the target link.

[0070] Please refer to Figure 5 , Figure 5 The flow chart of the link switching shown in an exemplary embodiment of the present application is shown in Figure 5 , taking the to-be-transmitted data as video data, the initial link as an MTS link, the target link as a P2P link, and the target link frame buffer queue as a P2P link frame buffer queue as an example, the P2P link frame buffer queue construction process comprises: obtaining the latest data frame transmitted in the P2P link, judging whether the P2P link frame buffer queue is in a full state, if not, adding the latest data frame transmitted in the P2P link to the P2P link frame buffer queue; if yes, popping out the first data frame in the P2P link frame buffer queue and discarding it, and adding the latest data frame transmitted in the P2P link to the P2P link frame buffer queue. The link switching process based on the P2P link frame buffer queue comprises: obtaining the frame sequence of the latest data frame in the MTS link as M, obtaining the frame sequence of the first data frame in the P2P link frame buffer queue as P0, judging whether M is equal to P0, if M is equal to P0, popping out all the data frames in the P2P link frame buffer queue, performing frame application processing on these data frames, then destroying the P2P link frame buffer queue, and switching the MTS link to the P2P link.

[0071] In addition, if the frame sequence of the latest data frame in the initial link is not the same as the frame sequence of the first data frame in the target link frame buffer queue, frame application processing is performed on the latest data frame in the initial link, as shown in Figure 5 , if M is not equal to P0, frame application processing is performed on the latest data frame in the MTS link to ensure that the data receiving end can timely receive the data frame.

[0072] In some implementations, an initial link frame buffer queue is constructed based on the initial link frame type, and the initial link is switched to the target link in response to the initial link frame buffer queue meeting the initial link frame switching condition. This includes: constructing an initial link frame buffer queue based on the data frames in the initial link, wherein the data frames buffered in the initial link frame buffer queue are sorted according to the frame sequence; obtaining the frame sequence of the latest data frame in the target link, and obtaining the frame sequence of the first data frame in the initial link frame buffer queue; if the frame sequence of the latest data frame in the target link is the same as the frame sequence of the first data frame in the initial link frame buffer queue, then the initial link frame buffer queue meets the initial link frame switching condition, and the initial link is switched to the target link.

[0073] If the frame sequence of the latest data frame in the initial link is greater than the frame sequence of the first data frame in the target link, it indicates that the data frame transmission progress in the target link is slower than that in the initial link. For example, please refer to [link to relevant documentation]. Figure 6 , Figure 6 This is a schematic diagram illustrating the construction of an initial link frame buffer queue, as shown in an exemplary embodiment of this application. Figure 6 As shown, at time T3, the frame sequence of the latest data frame in the initial link is 5, and the frame sequence of the first data frame in the target link is 3. An initial link frame buffer queue needs to be created to buffer the data frames transmitted in the initial link. Subsequent data frames transmitted in the initial link are stored in this initial link frame buffer queue. Then, each time the target link updates its latest data frame, the frame sequence of the latest data frame in the target link is compared with the frame sequence of the first data frame in the initial link frame buffer queue. For example, at time T4, if the frame sequence of the latest data frame in the target link is found to be the same as the frame sequence of the first data frame in the initial link frame buffer queue (both are 5), it indicates that the data frame transmission progress of the target link is the same as that of the initial link, satisfying the target link frame switching condition, and the initial link is switched to the target link. Between times T3 and T4, data frames in the target link whose frame sequence is different from the first data frame in the initial link frame buffer queue are discarded.

[0074] In some implementations, constructing an initial link frame buffer queue based on data frames in the initial link includes: obtaining the number of cached frames corresponding to the initial link frame buffer queue; if the number of cached frames is equal to a frame number threshold, performing frame application processing on the first data frame in the initial link frame buffer queue, deleting the first data frame in the initial link frame buffer queue, and adding the data frames transmitted in the initial link to the initial link frame buffer queue; if the number of cached frames is less than the frame number threshold, adding the data frames transmitted in the initial link to the initial link frame buffer queue.

[0075] The frame quantity threshold is used to limit the quantity of the cacheable data frames in the initial link frame buffer queue. If the quantity of the cached frames is equal to the frame quantity threshold, it indicates that the initial link frame buffer queue is in a full state. The first data frame in the initial link frame buffer queue needs to be popped out and frame application processing is performed. The latest data frame transmitted in the subsequent initial link is added to the initial link frame buffer queue. Otherwise, the latest data frame transmitted in the subsequent initial link is directly added to the initial link frame buffer queue.

[0076] In some embodiments, switching the initial link to the target link comprises: extracting the first data frame in the initial link frame buffer queue; performing frame application processing on the first data frame in the initial link frame buffer queue, and switching the initial link to the target link.

[0077] Please refer to Figure 7 , Figure 7 The flow chart of the link switching shown in another exemplary embodiment of the present application is shown in Figure 7 The initial link is an MTS link, the target link is a P2P link, the initial link frame buffer queue is an MTS link frame buffer queue, and the MTS link frame buffer queue construction process comprises: obtaining the latest data frame transmitted in the MTS link, judging whether the MTS link frame buffer queue is in a full state, if not, adding the latest data frame transmitted in the MTS link to the MTS link frame buffer queue; if yes, popping out the first data frame in the MTS link frame buffer queue and performing frame application processing, and adding the latest data frame transmitted in the MTS link to the MTS link frame buffer queue. The process of switching the link based on the MTS link frame buffer queue comprises: obtaining the frame sequence of the latest data frame in the P2P link as P, obtaining the frame sequence of the first data frame in the MTS link frame buffer queue as M0, judging whether M0 is equal to P, if M0 is equal to P, popping out the first data frame in the MTS link frame buffer queue for frame application processing, then destroying the MTS link frame buffer queue, and switching the MTS link to the P2P link.

[0078] In some embodiments, the quantity of the cacheable data frames in the frame buffer queue can be pre-set or flexibly calculated. For example, the transmission rate of the data frames in the initial link, the transmission rate of the data frames in the target link, and the sequence gap between the initial link frame sequence and the target link frame sequence are obtained. The quantity of the cacheable data frames in the frame buffer queue is calculated based on at least one of the transmission rate of the data frames in the initial link, the transmission rate of the data frames in the target link, and the sequence gap.

[0079] For example, the frame buffer queue is the initial link frame buffer queue. The size of the initial link frame buffer queue affects the time it takes for the target link to catch up with the data frame transmission progress. A larger initial link frame buffer queue results in a longer waiting time, while a smaller initial link frame buffer queue results in a shorter waiting time. If the waiting time is too long, the data receiver will not receive data frames for an extended period; if the waiting time is too short, the target link will not be able to catch up with the initial link's data frame transmission progress in time. Therefore, by combining the transmission rate of data frames in the initial link, the transmission rate of data frames in the target link, and the sequence difference between the initial link frame sequence and the target link frame sequence, the number of data frames that can be buffered in the initial link frame buffer queue is calculated.

[0080] The size of the frame buffer queue is flexibly calculated to ensure the efficiency of link switching and the data reception effect at the data receiving end.

[0081] Please see Figure 8 , Figure 8 This is a schematic diagram illustrating link switching as shown in an exemplary embodiment of this application, such as... Figure 8 As shown, the data provider is a device with video recording capabilities, such as a security camera or video recorder; the data receiver is a user access terminal, which can acquire video data collected by the data provider; the link control end is a connection management platform, equipped with P2P service, signaling service, and MTS service. The signaling service provides registration, login, and control services for the data provider; the P2P service enables point-to-point traversal between the data provider and data receiver based on P2P signaling, and establishes a P2P link after successful traversal; the MTS service creates an MTS link for video data forwarding. Before a P2P link is successfully established, the MTS link is used preferentially for video data forwarding; after a P2P link is successfully established, the system switches to the P2P link.

[0082] In some implementations, please refer to Figure 9 , Figure 9 A flowchart illustrating link switching as another exemplary embodiment of this application is shown, such as Figure 9As shown, each link is provided with a priority, which can be determined according to the communication quality of the link, the communication mode of the link, etc. The two links created successfully first are taken to obtain a candidate link set, the two links in the candidate link set are switched based on the above switching method, to keep the link with high priority in the candidate link set as the final connected link. Then, it is checked whether the link switching is successful, if yes, the current link is updated to the link with high priority in the candidate link set; if not, the current link is kept as the link with low priority in the candidate link set. Further, it is periodically checked whether there is a link with higher priority than the current link, if yes, the current link and the link with higher priority than the current link are taken to obtain a new candidate link set, and the link switching is performed. Through the above method, the switching between multiple links can be realized.

[0083] The switching method of the data transmission link provided by the present application records the frame sequence of the data frames transmitted in the initial link to obtain an initial link frame sequence, acquires the frame sequence of the data frames transmitted in the target link in response to the successful creation of the target link, obtains a target link frame sequence, compares the initial link frame sequence and the target link frame sequence, acquires the frame buffer queue type and the switching judgment condition matched with the comparison result, constructs a frame buffer queue based on the frame buffer queue type, and switches the initial link to the target link in response to the frame buffer queue satisfying the switching judgment condition, to realize the seamless switching between links and ensure the continuity of data frame transmission.

[0084] Figure 10 is a block diagram of the switching device of the data transmission link shown in an exemplary embodiment of the present application. As Figure 10 shown, the exemplary switching device of the data transmission link 1000 includes an initial frame sequence acquisition module 1010, a target frame sequence acquisition module 1020, a comparison module 1030, and a switching module 1040. Specifically:

[0085] The initial frame sequence acquisition module 1010 is configured to record the frame sequence of the data frames transmitted in the initial link to obtain an initial link frame sequence.

[0086] The target frame sequence acquisition module 1020 is configured to acquire the frame sequence of the data frames transmitted in the target link in response to the successful creation of the target link to obtain a target link frame sequence.

[0087] The comparison module 1030 is configured to compare the initial link frame sequence and the target link frame sequence, and acquire the frame buffer queue type and the switching judgment condition matched with the comparison result.

[0088] The switching module 1040 is configured to construct a frame buffer queue based on the frame buffer queue type, and switch the initial link to the target link in response to the frame buffer queue satisfying the switching judgment condition.

[0089] In the switching device of the exemplary data transmission link, the frame buffer queue type and the switching judgment condition matched with the comparison result are obtained by comparing the initial link frame sequence and the target link frame sequence, the frame buffer queue is constructed based on the frame buffer queue type, and the initial link is switched to the target link in response to the frame buffer queue satisfying the switching judgment condition, so as to realize seamless switching between links and ensure the continuity of data frame transmission.

[0090] The functions of each module can be referred to the embodiments of the data transmission link switching method, which will not be repeated here.

[0091] Please refer to Figure 11 , Figure 11 is a structural schematic diagram of an embodiment of the electronic device of the present application. The electronic device 1100 includes a memory 1101 and a processor 1102, and the processor 1102 is configured to execute program instructions stored in the memory 1101 to implement the steps in any of the above data transmission link switching method embodiments. In a specific implementation scenario, the electronic device 1100 can include but is not limited to a microcomputer, a server, and in addition, the electronic device 1100 can also include a notebook computer, a tablet computer, and the like, without limitation.

[0092] Specifically, the processor 1102 is configured to control itself and the memory 1101 to implement the steps in any of the above data transmission link switching method embodiments. The processor 1102 can also be referred to as a central processing unit (CPU). The processor 1102 can be an integrated circuit chip having a processing capability. The processor 1102 can also be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. In addition, the processor 1102 can be implemented by an integrated circuit chip together.

[0093] Please refer to Figure 12 , Figure 12 is a structural schematic diagram of an embodiment of the computer readable storage medium of the present application. The computer readable storage medium 1200 stores program instructions 1210 capable of being executed by a processor, and the program instructions 1210 are configured to implement the steps in any of the above data transmission link switching method embodiments.

[0094] In some embodiments, the apparatus provided by the embodiments of the present disclosure has functions or includes modules that can be used to perform the methods described in the above method embodiments, and the specific implementation can be referred to the description of the above method embodiments. For brevity, details are not repeated here.

[0095] The above description of various embodiments tends to emphasize the differences between various embodiments, and the same or similar parts can be mutually referred to, and for brevity, details are not repeated here.

[0096] In several embodiments provided in the present application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the above-described apparatus embodiments are merely schematic, for example, the division of modules or units is only a logical function division, and actual implementation can have another division manner, for example, units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0097] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit. When the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that makes a contribution to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor execute all or part of the steps of the various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various program codes that can be stored in the medium.

Claims

1. A method for switching data transmission links, characterized in that, The method includes: The frame sequence of data frames transmitted in the initial link is recorded to obtain the initial link frame sequence, which includes the frame sequence of the latest data frame in the initial link; In response to the successful creation of the target link, the frame sequence of the data frames transmitted in the target link is obtained to obtain the target link frame sequence, which includes the frame sequence of the first data frame in the target link; If the frame sequence of the latest data frame in the initial link is less than the frame sequence of the first data frame in the target link, then the frame type of the target link is used as the matching frame buffer queue type. The switching condition for matching is that the frame sequence of the latest data frame in the initial link is the same as the frame sequence of the first data frame in the frame buffer queue. If the frame sequence of the latest data frame in the initial link is greater than the frame sequence of the first data frame in the target link, then the frame type of the initial link is used as the matching frame buffer queue type, and the switching judgment condition for matching is that the frame sequence of the latest data frame in the target link is the same as the frame sequence of the first data frame in the frame buffer queue. A frame buffer queue is constructed based on the frame buffer queue type, and in response to the frame buffer queue satisfying the switching judgment condition, the initial link is switched to the target link.

2. The method according to claim 1, characterized in that, Constructing a target link frame buffer queue based on the target link frame type, and in response to the target link frame buffer queue satisfying the switching judgment condition, switching the initial link to the target link, including: A target link frame buffer queue is constructed based on the data frames transmitted in the target link, and the data frames buffered in the target link frame buffer queue are sorted according to the frame sequence; Obtain the frame sequence of the latest data frame in the initial link, and obtain the frame sequence of the first data frame in the target link frame buffer queue; If the frame sequence of the latest data frame in the initial link is the same as the frame sequence of the first data frame in the target link frame buffer queue, then the target link frame buffer queue satisfies the switching judgment condition, and the initial link is switched to the target link.

3. The method according to claim 2, characterized in that, The step of switching the initial link to the target link includes: Extract all data frames from the target link frame buffer queue; Perform frame application processing on all data frames in the target link frame buffer queue, and switch the initial link to the target link.

4. The method according to claim 2, characterized in that, The method further includes: If the frame sequence of the latest data frame in the initial link is different from the frame sequence of the first data frame in the target link frame buffer queue, then the latest data frame in the initial link is subjected to frame application processing.

5. The method according to claim 1, characterized in that, An initial link frame buffer queue is constructed based on the initial link frame type, and in response to the initial link frame buffer queue satisfying the handover judgment condition, the initial link is switched to the target link, including: An initial link frame buffer queue is constructed based on the data frames in the initial link, and the data frames buffered in the initial link frame buffer queue are sorted according to the frame sequence; Obtain the frame sequence of the latest data frame in the target link, and obtain the frame sequence of the first data frame in the initial link frame buffer queue; If the frame sequence of the latest data frame in the target link is the same as the frame sequence of the first data frame in the initial link frame buffer queue, then the initial link frame buffer queue satisfies the switching judgment condition, and the initial link is switched to the target link.

6. The method according to claim 5, characterized in that, The step of constructing an initial link frame buffer queue based on data frames in the initial link includes: Obtain the number of cached frames corresponding to the initial link frame cache queue; If the number of cached frames is equal to the frame number threshold, then the first data frame in the initial link frame cache queue is processed by frame application, the first data frame in the initial link frame cache queue is deleted, and the data frames transmitted in the initial link are added to the initial link frame cache queue. If the number of cached frames is less than the frame number threshold, then the data frames transmitted in the initial link are added to the initial link frame cache queue.

7. The method according to claim 5, characterized in that, The step of switching the initial link to the target link includes: Extract the first data frame from the initial link frame buffer queue; The first data frame in the initial link frame buffer queue is processed for frame application, and the initial link is switched to the target link.

8. An electronic device, characterized in that, The electronic device includes a memory and a processor, the processor being configured to execute program instructions stored in the memory to implement the steps of the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Predictable deterministic scheduling method and device suitable for quasi-dynamic link

    CN113206724A

  • Image transmission method and device based on double links, electronic equipment and storage medium

    CN115988179A