Network video stream reconnection method and device, electronic equipment and storage medium
By obtaining the thread running flag bits regularly, determining a new thread, and initializing the video stream to reconnect, the problem of reconnecting automatically after the RTSP network video stream client is disconnected from the server, and the automatic reconnection of the video stream is realized .
Patent Information
- Application Number
- CN202411711093.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-02-18
AI Technical Summary
In the RTSP network video streaming model, after the network video streaming client is disconnected from the server, the connection cannot be automatically re-established.
By obtaining the thread running flag of the network video stream playback for each preset time interval, determining the new thread, initializing the network video stream, and establishing the network video stream based on the thread running flag of the new thread and the initialized network video stream, the network video stream is established. connect.
It realizes that when the network video streaming client disconnects from the server, it automatically re-establishes the connection of the video stream, solving the problem that it cannot automatically reconnect after disconnection.
Smart Images

Figure CN119484613A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a network video stream reconnection method, device, electronic equipment and storage medium. Background Art
[0002] There are a large number of different video stream transmission methods in the optoelectronics field, among which RTSP network video stream has the characteristics of high compression rate, low loss and convenient transmission, especially in the network video transmission model with embedded hardware as RTSP network video stream server and host computer software as RTSP network video stream client. However, in this model, after the network video stream client is disconnected from the server, it cannot automatically re-establish the connection.
[0003] Based on this, there is an urgent need for a network video stream reconnection method, device, electronic device and storage medium to solve the technical problem of how to reconnect the video stream when the network video stream client is disconnected from the server. Summary of the invention
[0004] In order to solve the technical problem of how to reconnect a video stream after a network video stream client is disconnected from a server, the embodiments of this specification provide a network video stream reconnection method, device, electronic device and storage medium.
[0005] In a first aspect, an embodiment of the present specification provides a method for reconnecting a network video stream, including:
[0006] At every preset time interval, obtain the thread running flag of the network video stream playback;
[0007] Based on the thread running flag, determine a new thread for playing the network video stream;
[0008] Based on the new thread, determine to initialize the network video stream;
[0009] Based on the thread running flag of the new thread and the initialized network video stream, a reconnection of the network video stream is established.
[0010] In a second aspect, the embodiments of the present specification further provide a network video stream reconnection device, including:
[0011] A data acquisition module is used to obtain the thread running flag of the network video stream playback at intervals of a preset time duration;
[0012] A first data processing module, used for determining a new thread for playing the network video stream based on the thread running flag;
[0013] A second data processing module, used for determining to initialize a network video stream based on the new thread;
[0014] The third data processing module is used to establish a reconnection of the network video stream based on the thread running flag of the new thread and the initialized network video stream.
[0015] In a third aspect, an embodiment of this specification further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any embodiment of this specification is implemented.
[0016] In a fourth aspect, an embodiment of the present specification further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute the method described in any embodiment of the present specification.
[0017] The embodiments of this specification provide a network video stream reconnection method, device, electronic device and storage medium. First, the thread running flag of the network video stream playback is obtained at intervals of a preset time; then, based on the thread running flag, a new thread for the network video stream playback is determined; then, based on the new thread, the network video stream is initialized; finally, based on the thread running flag of the new thread and the initialized network video stream, the network video stream is reconnected. Therefore, the above scheme can solve the technical problem of how to reconnect the video stream when the network video stream client is disconnected from the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 This is a flow chart of a network video stream reconnection method provided in an embodiment of this specification;
[0020] Figure 2 It is a hardware architecture diagram of an electronic device provided in an embodiment of this specification;
[0021] Figure 3 This is a structural diagram of a network video stream reconnection device provided in one embodiment of this specification. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solutions and advantages of the embodiments of this specification clearer, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this specification.
[0023] Please refer to Figure 1 , an embodiment of the present specification provides a method for reconnecting a network video stream, the method comprising:
[0024] Step 100: Obtaining a thread running flag for playing the network video stream at intervals of a preset time length;
[0025] Step 102: Determine a new thread for playing the network video stream based on the thread running flag;
[0026] Step 104: Based on the new thread, determine to initialize the network video stream;
[0027] Step 106: Based on the thread running flag of the new thread and the initialization of the network video stream, a reconnection of the network video stream is established.
[0028] In the embodiment of this specification, a specific time interval is first set, and this time interval is predetermined, for example, it can be every 5 minutes, 10 minutes, etc. (the specific duration is determined according to the actual application scenario requirements). After such a preset time interval, the thread running flag of the network video stream playback is obtained. The thread running flag is usually an identification information used to indicate the current state of the thread (such as running, paused, ended, etc.), which can be a Boolean value (such as True means running, False means stopped running, etc.), or it may be a specific numerical value or character code, and further judgment is made based on the obtained thread running flag. If it is found that the current thread running flag shows that the thread has an abnormal situation (for example, the thread has stopped running, the state that does not meet the normal playback requirements such as the freeze time is too long), then it is necessary to determine a new thread for network video streaming playback. The process of determining a new thread involves creating a brand new thread object and configuring corresponding parameters, such as setting the connection method of the thread with the video stream source, setting the priority of the thread, etc., so that it can have the ability to play the network video stream normally. When there is a new thread, the network video stream must be initialized. This means that various parameters and resources related to the network video stream need to be reconfigured, such as resetting the encoding format, resolution and other parameters of the video stream (different network video streams may have different format requirements, and it is necessary to ensure that the new thread can be adapted to correctly parse and play the video stream during initialization), and at the same time, an initial connection with the video stream source must be established, and a series of operations such as preparing to receive video data are required, just like making preliminary preparations for playing the video, ensuring that the video stream can be in the new thread, and finally, combining the thread running flag of the new thread and the initialized network video stream to establish a reconnection of the network video stream. Therefore, the present invention can solve the technical problem of how to establish a reconnection of the video stream after the network video stream client is disconnected from the server.
[0029] Described below Figure 1 How the various steps are performed.
[0030] For step 100:
[0031] In one embodiment of the present specification, a reconnection timer can be set, whose function is to perform a network video stream thread start operation at a certain period. When the connection has been established, it will directly exit, and when the connection has not been established, it will enter the thread start operation. The specific code logic is to create a reconnection timer reconnect_timer, and when the thread flag running_ is false in the response function corresponding to the timer, call start() to create a network video stream thread function, call reconnect_timer->start(3000) to start the reconnection timer, and reconnect once every 3000ms.
[0032] Regarding step 102:
[0033] In one embodiment of the present specification, when the thread running flag is true, it returns directly; when the thread running flag is false, the thread pool enters a blocked state waiting for all threads to exit; then the existing thread is removed from the thread pool; and finally a new thread for playing the network video stream is created in the thread pool. The specific code logic is to judge the thread flag running_; when running_ is true, it returns directly; when running_ is false, the thread pool threads_ enters a blocked state waiting for all threads to exit until all threads exit; then the opened thread thread_ is removed from the thread pool; then create_thread is called to open the RTSP network video stream thread, and the thread handle thread_ is returned.
[0034] Regarding step 104:
[0035] In one embodiment of the present specification, initializing the network video stream is determined by the following steps:
[0036] Get the address of the network video stream and the RTSP interrupt callback function;
[0037] Initialize the network video stream based on the address of the network video stream, the RTSP interrupt callback function and the new thread.
[0038] In the embodiment of this specification, first, the connection timeout parameters and connection mode of the network video stream are set, and the video stream address is set to open the network video stream. When the network address cannot be opened, it will time out and return; then register the RTSP interrupt callback function; find and open the decoder corresponding to the video code stream. If it is found and opened successfully, the decoder open flag position is set to true, and resources such as video packet space, video frame space, color space conversion context, image buffer array, etc. are allocated. The specific code logic is to initialize the decoder context resources and open the decoder, initialize the relevant data structure for receiving the video stream, call avformat_network_init() to enable the FFmpeg module to support network video streams, call av_dict_set(&options,"stimeout","1000000",0) to set the parameter timeout parameter to 1000000us, call av_dict_set(&options,"rtsp_transport",tcp,0) to set the connection mode to TCP, and call avformat_alloc_context() to allocate context resources; then set the video stream address in_path, and call avformat_open_input to open the video stream address. When the function return value is 0, it means that the address opening failed, set the thread flag running_ to false and return. If the function return value is not 0, it means that the address opening is successful, and continue to set the context callback function to rtsp_interrupt_callback; and call avformat_find_stream_info Get the video stream information. If the acquisition fails, set the thread flag running_ to false and return; then call avcodec_alloc_context3 to allocate the decoder context space, and use the code stream information in the video stream to find the corresponding decoder. If there is a corresponding decoder, call avcodec_open2 to open it. If the corresponding decoder is not found or the decoder fails to be opened, set running_ to false and return. If the decoder is successfully opened, set the flag g_tv_is_avcodec_open to true; continue to call av_frame_alloc to allocate space resources for video frames m_pFrame and m_pFrameYUV, call av_packet_alloc to allocate space resources for video packets m_pPacket, and call av_malloc to allocate space resources for video buffer array m_out_buffer; then call sws_getContext to set parameters for the color space conversion context m_img_convert_ctx. Here, the decoded video frame is converted to NV12 format through the color space conversion module. At this point, the resources are initialized.
[0039] In one embodiment of the present specification, the RTSP interrupt callback function is obtained by the following steps:
[0040] Obtain a first parameter monitored by a timeout counter and a second parameter monitored by a timeout timer;
[0041] When the first parameter is greater than a first preset threshold, determining whether the second parameter is greater than a second preset threshold;
[0042] If yes, the first parameter is reset to zero and an error status code is performed; wherein, when the error status code is performed, the network video stream will not be read further;
[0043] If so, the second parameter is reset and a correct status code is performed; wherein, when the correct status code is performed, the network video stream will continue to be read.
[0044] In the embodiment of this specification, a timeout counter and a timeout timer are initialized, and the timeout counter is first incremented in the function; then, in order to prevent the counter from incrementing and returning to an abnormal state before the resource initialization is completed after the registration callback function, it is necessary to increase whether the decoder resources have been initialized, and if the decoder is not opened, the counter is set to zero; next, the counter and the timer are used to determine whether it is an abnormal blocking state, and whether the timeout counter is greater than the counting threshold. If it is greater than the set counting threshold, it is determined whether the timeout timer is greater than the timing threshold. If it is greater than the set timing threshold, the counter is cleared and an error status code is returned; if it is not greater than the set counting threshold, the timeout timer is restarted and the correct status code is returned. After returning the correct status code, the RTSP video stream reading related module continues to execute normally, and after returning the error status code, the RTSP video stream reading related module is forced to exit. The specific code logic is to establish a callback function rtsp_interrupt_callback, initialize the timeout counter g_tv_timeout_count and the timeout timer g_tv_callback_time outside the function, first increase g_tv_timeout_count in the function, then judge the decoding success flag g_tv_is_avcodec_open, and set g_tv_timeout_count to 0 when it is false, otherwise judge whether the timeout counter g_tv_timeout_count is greater than the threshold 30, if it is greater, then judge the timeout timer g_tv_callback_time according to the last start time, if it is greater than the threshold 90ms, then set g_tv_timeout_count to 0 and return the error status code 1; if g_tv_timeout_count is not greater than 30, then restart g_tv_callback_time and return the correct status code 0.
[0045] Regarding step 106:
[0046] In one embodiment of the present specification, step 106 may specifically include:
[0047] Based on the thread running state of the new thread, determine the reading state of the stream packet of the initialized network video stream;
[0048] When the read status is blocked, the RTSP interrupt callback function is called to adjust the read status to the correct status code and enter the stream pulling loop to reconnect the network video stream.
[0049] In one embodiment of the present invention, when an abnormal exit connection operation occurs, the operation of reading the code stream package will be blocked, and the thread will enter a blocked state and cannot return. At this time, the RTSP interrupt callback function will return an abnormal status code and forcibly return the blocked operation. The video stream will be reconnected through a timer until the video stream initialization resources are successfully initialized and enter a stream pulling loop to establish a reconnection of the network video stream.
[0050] In the embodiment of the present specification, when an abnormal exit connection operation occurs, the video stream reading function av_read_frame will be blocked and will not return any value. At this time, the thread is in a blocked state, but the interrupt function rtsp_interrupt_callback is still being called. Through the dual judgment of the timeout counter and the timeout timer in the function, the function will trigger the branch of the abnormal state return and return the abnormal status code. After returning the code, the video stream reading function av_read_frame will be forced to exit, and then the thread flag running_ will be set to false, and the relevant resources will be unloaded to exit the thread, waiting for the timer to pull the stream again.
[0051] In one embodiment of the present invention, the thread running state is set to true, and the video stream pulling loop is entered; first, the code stream packet is read from the context, and the result is judged according to the return code. If the reading fails, it proves that the current stream has been read or the stream is closed, and the thread running state is set to false, and the context resources, decoder resources and the allocated storage space are unloaded; if the reading is successful, the code stream packet is filtered, and if the current code stream packet is a video code stream packet, it means that the correct code stream data has been received, and the timeout count in the RTSP interrupt callback function is set to zero; then the code stream packet is sent to the decoder that has been opened, and the decoding is judged according to the return code of the decoding process. If the decoding is successful, the decoded data frame is obtained from the decoder. If the acquisition is successful, the video frame is placed in the color space conversion module and converted to the required pixel format. At this point, the code stream is successfully converted into a displayable image frame. When a normal exit connection operation occurs, the status code returned by the code stream packet reading operation is the corresponding error code, and then the thread running state is set to false, and the context resources, decoder resources and the allocated storage space are unloaded.The specific code logic is that when running_ is true, the stream pulling loop is entered. First, av_read_frame is called to read the code stream data from m_pInFormatCtx to m_pPacket. If the return value is greater than or equal to 0, it means that the reading failed, and running_ is set to false. Then sws_freeContext is called to unload the color space conversion module m_img_convert_ctx, av_free is called to unload the video buffer array m_out_buffer, av_frame_free is called to unload the video frame m_pFrameYUV and m_pFrame, avcodec_close is called to close the decoder m_pInCodecCtx, avformat_close_input is called to close the code stream context m_pInFormatCtx, and the decoder initialization success flag g_tv_is_ is set. avcodec_open is set to false; when the return value is less than 0, it means that the reading is successful, then the timeout counter g_tv_timeout_count is set to 0, and avcodec_send_packet is called to send the m_pPacket data packet to the decoder m_pInCodecCtx for decoding. If the return value is 0, it means that the decoding is successful. Then avcodec_receive_frame is called to send the decoded data to m_pFrame. If the return value is 0, it means that the reception is successful. Then sws_scale is called to convert the m_pFrame data to color space, and the converted data is copied to the m_pFrameYUV video frame. At this point, m_pFrameYUV has been filled with the corresponding NV12 data after the video code stream is decoded. Then av_packet_unref is called to release the reference to the video packet m_pPacket. When a normal exit connection operation occurs, the video code stream reading function av_read_frame will return a value greater than or equal to 0, and then the thread sets the thread flag running_ to false, unloads related resources and exits the thread, waiting for the timer to pull the stream again.
[0052] like Figure 2 , Figure 3 As shown, the embodiment of this specification provides a network video stream reconnection device. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. From the hardware level, Figure 2 As shown, it is a hardware architecture diagram of an electronic device where a network video stream reconnection device provided in an embodiment of this specification is located, except Figure 2In addition to the processor, memory, network interface, and non-volatile memory shown, the electronic device in the embodiment may also include other hardware, such as a forwarding chip responsible for processing messages, etc. Taking software implementation as an example, Figure 3 As shown, as a device in a logical sense, the CPU of the electronic device in which it is located reads the corresponding computer program in the non-volatile memory into the internal memory and runs it.
[0053] like Figure 3 As shown, this embodiment provides a network video stream reconnection device, the device comprising:
[0054] An acquisition module 300 is used to acquire a thread running flag of the network video stream playback at intervals of a preset time duration;
[0055] A first data processing module 302 is used to determine a new thread for playing the network video stream based on the thread running flag;
[0056] A second data processing module 304 is used to determine to initialize a network video stream based on the new thread;
[0057] The third data processing module 306 is used to establish a reconnection of the network video stream based on the thread running flag of the new thread and the initialized network video stream.
[0058] In the embodiment of the present specification, the acquisition module 300 can be used to execute step 100 in the above method embodiment, the association analysis module 302 can be used to execute step 102 in the above method embodiment, the regression modeling module 304 can be used to execute step 104 in the above method embodiment, and the interpretation module 306 can be used to execute step 106 in the above method embodiment.
[0059] In one embodiment of the present specification, initializing the network video stream is determined by the following steps:
[0060] Get the address of the network video stream and the RTSP interrupt callback function;
[0061] The network video stream is initialized based on the address of the network video stream, the RTSP interrupt callback function and the new thread.
[0062] In one embodiment of the present specification, the RTSP interrupt callback function is obtained by the following steps:
[0063] Obtain a first parameter monitored by a timeout counter and a second parameter monitored by a timeout timer;
[0064] When the first parameter is greater than a first preset threshold, determining whether the second parameter is greater than a second preset threshold;
[0065] If yes, the first parameter is reset to zero and an error status code is performed; wherein, when the error status code is performed, the network video stream will not be read further;
[0066] If so, reset the second parameter and perform a correct status code; wherein, when the correct status code is performed, the network video stream will continue to be read.
[0067] In one embodiment of the present specification, the reconnection of the network video stream is established based on the thread running state of the new thread and the initialized network video stream, including:
[0068] Determine the read status of the bitstream packet of the initialized network video stream based on the thread running status of the new thread;
[0069] When the reading state is blocked, the RTSP interrupt callback function is called to adjust the reading state to the correct state code, and enter a stream pulling loop to reconnect the established network video stream.
[0070] It is to be understood that the structures illustrated in the embodiments of this specification do not constitute a specific limitation on a network video stream reconnection device. In other embodiments of this specification, a network video stream reconnection device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0071] Since the information interaction, execution process and other contents between the modules in the above-mentioned device are based on the same concept as the method embodiments of this specification, the specific contents can be found in the description of the method embodiments of this specification and will not be repeated here.
[0072] An embodiment of the present specification also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, a network video stream reconnection method in any embodiment of the present specification is implemented.
[0073] An embodiment of the present specification further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes a network video stream reconnection method in any embodiment of the present specification.
[0074] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.
[0075] In this case, the program code itself read from the storage medium can realize the function of any one of the above embodiments, and thus the program code and the storage medium storing the program code constitute part of this specification.
[0076] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.
[0077] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0078] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0079] It should be noted that, in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0080] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.
[0081] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this specification, rather than to limit them. Although this specification has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of this specification.
Claims
1. A method for reconnecting a network video stream, characterized in that: include: At every preset time interval, obtain the thread running flag of the network video stream playback; Based on the thread running flag, determine a new thread for playing the network video stream; Based on the new thread, determine to initialize the network video stream; Based on the thread running flag of the new thread and the initialized network video stream, a reconnection of the network video stream is established.
2. The method according to claim 1, characterized in that: Initialize the network video stream by following these steps: Get the address of the network video stream and the RTSP interrupt callback function; The network video stream is initialized based on the address of the network video stream, the RTSP interrupt callback function and the new thread.
3. The method according to claim 2, characterized in that Construct the RTSP interrupt callback function by following the steps below: Obtain a first parameter monitored by a timeout counter and a second parameter monitored by a timeout timer; When the first parameter is greater than a first preset threshold, determining whether the second parameter is greater than a second preset threshold; If yes, the first parameter is reset to zero and an error status code is performed; wherein, when the error status code is performed, the network video stream will not be read further; If so, reset the second parameter and perform a correct status code; wherein, when the correct status code is performed, the network video stream will continue to be read.
4. The method according to claim 3, characterized in that The reconnection of the network video stream based on the thread running state of the new thread and the initialized network video stream comprises: Determine the read status of the bitstream packet of the initialized network video stream based on the thread running status of the new thread; When the reading state is blocked, the RTSP interrupt callback function is called to adjust the reading state to the correct state code, and enter a stream pulling loop to reconnect the established network video stream.
5. A network video stream reconnection device, characterized in that: The invention is characterized by comprising: A data acquisition module is used to obtain the thread running flag of the network video stream playback at intervals of a preset time duration; A first data processing module, used for determining a new thread for playing the network video stream based on the thread running flag; A second data processing module, used for determining to initialize a network video stream based on the new thread; The third data processing module is used to establish a reconnection of the network video stream based on the thread running flag of the new thread and the initialized network video stream.
6. The device according to claim 5, characterized in that Initialize the network video stream by following these steps: Get the address of the network video stream and the RTSP interrupt callback function; The network video stream is initialized based on the address of the network video stream, the RTSP interrupt callback function and the new thread.
7. The device according to claim 6, characterized in that Construct the RTSP interrupt callback function by following the steps below: Obtain a first parameter monitored by a timeout counter and a second parameter monitored by a timeout timer; When the first parameter is greater than a first preset threshold, determining whether the second parameter is greater than a second preset threshold; If yes, the first parameter is reset to zero and an error status code is performed; wherein, when the error status code is performed, the network video stream will not be read further; If so, reset the second parameter and perform a correct status code; wherein, when the correct status code is performed, the network video stream will continue to be read.
8. The device according to claim 7, characterized in that The reconnection of the network video stream based on the thread running state of the new thread and the initialized network video stream comprises: Determine the read status of the bitstream packet of the initialized network video stream based on the thread running status of the new thread; When the reading state is blocked, the RTSP interrupt callback function is called to adjust the reading state to the correct state code, and enter a stream pulling loop to reconnect the established network video stream.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 4.