Video data stream transmission method, transmission device, equipment and medium

UVC frame information is generated through the preset information acquisition component, directly generates frame head and frame end data, and performs packet processing when the video data stream reaches the threshold, solving the problems of high resource overhead and transmission delay in the prior art, and achieving further development Efficient video streaming.

CN119110132APending Publication Date: 2024-12-10HEFEI MACROSILICON TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411282610.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2024-12-10

AI Technical Summary

Technical Problem

Existing video streaming solutions lead to high resource overhead costs and transmission delays, and require high-performance CPUs to perform data packet processing.

Method used

UVC frame information is generated through the preset information acquisition component, directly generates frame head and end of frame data, and performs instant packet processing when the video data stream reaches the preset threshold, reducing the performance requirements and storage overhead of packet processing and avoiding packet transmission delays .

Benefits of technology

Reduces the resource cost and overhead of frame head and end of frame data generation, improves the real-time nature of packet transmission, reduces the complexity and delay of packet processing, and improves the transmission efficiency of video data streams.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119110132A_ABST
    Figure CN119110132A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and particularly discloses a video data stream transmission method and device, equipment and a medium. The method comprises the following steps: responding to received video time sequence information as frame starting information, generating first UVC frame information corresponding to the frame starting information through a preset information acquisition component, generating first frame header data according to the first UVC frame information, and sending the first frame header data to a USB host; under the condition that the data volume of the collected video data stream reaches a first preset threshold value, packaging the video data stream into a data packet, and sending the data packet to the USB host; and in response to the fact that the received video time sequence information is frame termination information, generating second UVC frame information corresponding to the frame termination information through the preset information acquisition component, generating frame tail data according to the second UVC frame information, and sending the frame tail data to the USB host. According to the method, the resource cost overhead required by video data stream transmission can be reduced, and the real-time transmission of the video data stream is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method for transmitting a video data stream, a device for transmitting a video data stream, an electronic device, and a computer-readable medium. Background Art

[0002] The Universal Serial Bus (USB) is a universal interface that can realize the transmission of video data streams. When transmitting video data streams, it is necessary to generate frame headers, frame trailers and data packets consisting of video data streams according to the USB Video Class (UVC) protocol and send them to the USB host.

[0003] At present, the video data stream transmission scheme generally adopts a combination of software and hardware. First, the central processing unit (CPU) obtains the collected video data stream and performs unified data packet encapsulation processing. Then, the software generates frame header and frame footer data in accordance with the UVC protocol standard, and finally transmits them together to the USB host.

[0004] The above-mentioned video data stream transmission method not only causes transmission delay, but also requires the CPU to have high data processing performance, and involves a large amount of storage resource overhead and software overhead, resulting in high resource overhead costs.

[0005] Public Content

[0006] To this end, the present disclosure provides a video data stream transmission method, a video data stream transmission device, an electronic device, and a computer-readable medium to solve the problems of high resource overhead cost and transmission delay in video data stream transmission in the prior art.

[0007] In order to achieve the above-mentioned object, the present disclosure provides a first aspect of a video data stream transmission method, comprising:

[0008] In response to the received video timing information being frame start information, generating first UVC frame information corresponding to the frame start information through a preset information acquisition component, generating first frame header data according to the first UVC frame information, and sending the first frame header data to a USB host;

[0009] When the amount of data in the collected video data stream reaches a first preset threshold, encapsulating the video data stream into a data packet and sending the data packet to the USB host;

[0010] In response to the received video timing information being frame termination information, second UVC frame information corresponding to the frame termination information is generated by a preset information acquisition component, frame tail data is generated according to the second UVC frame information, and the frame tail data is sent to the USB host.

[0011] In some embodiments, the preset information acquisition component includes a signal processing element; the UVC frame information includes a frame identifier for characterizing a video frame to which the video data stream belongs, and the first UVC frame information corresponding to the frame start information generated by the preset information acquisition component includes:

[0012] Get the frame identifier corresponding to the previous frame start information of the current frame start information;

[0013] The frame identifier corresponding to the previous frame start information is flipped according to the signal processing element to obtain the frame identifier corresponding to the current frame start information.

[0014] In some embodiments, the UVC frame information includes frame end flag information for indicating the end of a video frame, and the UVC frame information is generated in the following manner:

[0015] When the frame start information is received, the frame end flag information is set to a first preset value according to the signal processing element;

[0016] When the frame termination information is received, the frame end flag information is set to a second preset value according to the signal processing element.

[0017] In some embodiments, the preset information collection component further includes: a first counter;

[0018] The UVC frame information includes video frame clock information for representing the video frame capture time and source time clock information for representing the system clock of the video acquisition device. The UVC frame information is generated in the following manner:

[0019] cyclically counting the system clock of the video acquisition device according to the first counter to obtain a first count value, and using the first count value as the source time clock information;

[0020] When the frame start information is received, the video frame clock information is updated according to the first count value.

[0021] In some embodiments, the preset information collection component further includes: a second counter;

[0022] The UVC frame information includes token count information for characterizing a token value, and the UVC frame information is generated in the following manner:

[0023] The token sent by the USB host is cyclically counted according to the second counter to obtain a second count value, and the second count value is used as the token counting information.

[0024] In some embodiments, after encapsulating the video data stream into a data packet and sending the data packet to the USB host, the method further includes:

[0025] When the number of encapsulated data packets reaches a second preset threshold, the preset information acquisition component generates third UVC frame information corresponding to the current moment, generates second frame header data according to the third UVC frame information, and sends the second frame header data to the USB host.

[0026] In some embodiments, before the preset information collection component generates the second UVC frame information corresponding to the frame termination information, the method further includes:

[0027] In the case where there is a remaining video data stream that is not encapsulated as a data packet, encapsulating the remaining video data stream into a data packet of a short packet type, and sending the data packet of the short packet type to the USB host;

[0028] In the case that there is no remaining video data stream that is not encapsulated as a data packet, a data packet of a zero packet type is generated and sent to the USB host.

[0029] In a second aspect, an embodiment of the present disclosure provides a device for transmitting a video data stream, the device for transmitting a video data stream comprising:

[0030] A frame header processing module, for generating first UVC frame information corresponding to the frame start information by a preset information acquisition component in response to the received video timing information being frame start information, generating first frame header data according to the first UVC frame information, and sending the first frame header data by a USB host;

[0031] A data packet processing module, configured to encapsulate the video data stream into a data packet and send the data packet to the USB host when the data volume of the collected video data stream reaches a first preset threshold;

[0032] The frame tail processing module is used to generate second UVC frame information corresponding to the frame termination information through a preset information acquisition component in response to the received video timing information being frame termination information, generate frame tail data according to the second UVC frame information, and send the frame tail data to the USB host.

[0033] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:

[0034] One or more processors; a storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned video data stream transmission method;

[0035] One or more I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.

[0036] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, wherein the program implements the above-mentioned method for transmitting a video data stream when executed by a processor.

[0037] The present disclosure has the following advantages:

[0038] When the present invention is transmitting video data streams, on the one hand, when the data volume of the collected video data stream reaches a first preset threshold, real-time data packet processing is performed and data packet transmission is performed, which effectively avoids performing multiple packet processing at one time, reduces the performance requirements and storage overhead required for packet processing, and also avoids data packet transmission delays, thereby improving the real-time performance of data packet transmission. On the other hand, when the received video timing information is frame start information and frame end information, the present application can directly generate the first frame header data and frame tail data according to the preset information collection component, thereby avoiding the generation of frame header and frame tail data in the form of software development, which not only reduces the resource cost overhead required for the generation of frame header data and frame tail data, but also ensures the generation and transmission real-time performance of frame header and frame tail data. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings are used to provide further understanding of the present disclosure and constitute a part of the specification. They are used to explain the present disclosure together with the following detailed description, but do not constitute a limitation of the present disclosure.

[0040] Figure 1 A flowchart of a method for transmitting a video data stream provided by an embodiment of the present disclosure;

[0041] Figure 2 A flowchart of a method for transmitting a video data stream provided by an embodiment of the present disclosure;

[0042] Figure 3 A flowchart of a method for transmitting a video data stream provided by an embodiment of the present disclosure;

[0043] Figure 4 A schematic diagram of a method for transmitting a video data stream provided by an embodiment of the present disclosure;

[0044] Figure 5 A schematic diagram of a video data stream transmission device provided by an embodiment of the present disclosure;

[0045] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0046] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.

[0047] As used in this disclosure, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0048] The terms used in the present disclosure are only used to describe specific embodiments and are not intended to limit the present disclosure.As used in the present disclosure, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0049] When the terms “comprising” and / or “made of…” are used in the present disclosure, it specifies the existence of the stated features, integers, steps, operations, elements and / or components, but does not exclude the existence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0050] The embodiments described in the present disclosure may be described with reference to plan views and / or cross-sectional views by way of ideal schematic diagrams of the present disclosure. Therefore, the exemplary illustrations may be modified according to manufacturing techniques and / or tolerances.

[0051] Unless otherwise defined, all terms (including technical and scientific terms) used in this disclosure have the same meaning as those commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined in this disclosure.

[0052] In some related technologies, the current video data stream transmission scheme is to process the large amount of collected video data streams in a unified data packet through the CPU, and then generate corresponding frame header and frame tail data for the data packet through software according to the UVC protocol standard, and finally transmit the generated frame header, frame tail data and data packet to the USB host together, which will not only cause transmission delays, but also require the CPU to have high data processing performance, and involve a large amount of storage resource overhead and software overhead, resulting in high resource overhead costs.

[0053] In a first aspect, an embodiment of the present disclosure provides a method for transmitting a video data stream. Figure 1 FIG. 1 is a flow chart showing a method for transmitting a video data stream provided by an embodiment of the present disclosure. Figure 1 As shown, the method specifically includes:

[0054] Step S110: In response to the received video timing information being frame start information, first UVC frame information corresponding to the frame start information is generated by a preset information acquisition component, first frame header data is generated according to the first UVC frame information, and the first frame header data is sent to the USB host.

[0055] The video timing information is the timing information synchronously generated by the video acquisition device when acquiring the corresponding video data stream. The video timing information is used to represent the complete stage of the video data stream of a video frame from the start of acquisition to the completion of acquisition.

[0056] Specifically, the video timing information is frame start information, which is used to identify the start acquisition state of the video frame. For a certain video frame, when the video data stream corresponding to the video frame starts to be acquired, the corresponding video timing information generated is the frame start information. For example, when the video timing information is in a state of switching from a falling edge to a rising edge, the video timing information at this time is the frame start information.

[0057] The video timing information is frame continuity information, which is used to identify the continuous acquisition process of the video frame. In the process of acquiring the video data stream corresponding to the video frame, the corresponding generated video timing information is frame continuity information. For example, when the video timing information is continuously in the rising edge state, the video timing information is frame continuity information.

[0058] The video timing information is the frame termination information, which is used to identify the termination acquisition state of the video frame. When the video data stream corresponding to the video frame is acquired, the corresponding generated video timing information is the frame termination information. For example, when the video timing information is switched from the rising edge to the falling edge, the video timing information is the frame termination information.

[0059] It can be seen that the video timing information can fully reflect the different stages corresponding to the acquisition of the video data stream.

[0060] Therefore, when the received video timing information is the frame start information, it indicates that the video data stream corresponding to a video frame starts to be collected at this time. Accordingly, the first frame header data needs to be generated according to the UVC protocol and sent to the USB host.

[0061] The UVC frame information refers to the identification information that must be included in the frame header data and the frame footer data when transmitting the video data stream as specified by the UVC protocol, and is generated by a preset information collection component.

[0062] It should be noted that both the frame header data and the frame tail data contain the same UVC frame information. The main difference between the frame header data and the frame tail data is that the values ​​of the UVC frame information contained in the two are different.

[0063] Exemplarily, the UVC frame information includes: a data header length identifier header length for identifying the data header length, i.e., the frame header data and the frame tail data length, whose size is 1 byte; a frame identifier PTS (Presentation Time) for identifying the video frame to which the video data stream belongs, whose size is 4 bytes; a clock source SCR (Source Clock Reference) for identifying the video acquisition device, whose size is 6 bytes; a video data stream identifier BFH for identifying relevant information of the video data stream, whose size is 1 byte.

[0064] Furthermore, BFH specifically includes 8 1-bit identification information: EOH, ERR, STI, RES, SCR_EN, PTS_EN, EOF, and FID.

[0065] Among them, FID (Frame ID) is the frame identifier of the video frame to which the video data stream belongs; EOF (End of Frame) is the frame end flag information representing the end of the video frame; PTS_EN is the enable flag of PTS; SCR_EN is the enable flag of SCR (Source Clock Reference); RES is a specific bit; STI (Still Image) is a static picture flag; ERR (Error) is an error flag indication. If data loss or abnormality is found during the transmission process, the flag needs to be written to 1 to indicate that this is an erroneous data packet; EOH (End of header) is used to identify the last header group in the data packet.

[0066] Furthermore, the specific composition structure of SCR is as follows: SCR[31:0] is the source time clock information representing the system clock of the video acquisition device, SCR[42:32] is the token count information representing the Start Of Frame (SOF) token value, and SCR[47:43] is a reserved bit.

[0067] Therefore, the generated frame header data and frame tail data may include the above-mentioned type of UVC frame information.

[0068] The first UVC frame information corresponding to the frame start information is UVC frame information generated by a preset information acquisition component when the received video timing information is the frame start information.

[0069] Among them, the preset information collection component is a component set inside the video acquisition device for generating UVC frame information, such as a counter, a signal processing component, etc.

[0070] It should be noted that the preset information collection component may include multiple elements, each of which may be specifically used to generate one or more information included in the UVC frame information, which is not limited in this embodiment of the present disclosure.

[0071] Furthermore, the UVC frame information may contain a lot of information with fixed values, such as header length, PTS_EN, etc. Therefore, when generating UVC frame information with these fixed values ​​according to the preset information acquisition component, in order to improve the generation efficiency of the UVC frame information, the UVC frame information can be directly set to a preset value through the preset information acquisition component, thereby generating UVC frame information with fixed values.

[0072] Exemplarily, when generating UVC frame information with fixed values ​​such as header length, PTS_EN, SCR_EN, RES, STI, and EOH information, the preset information acquisition component can be used to assign and store these information, set these information to preset values, and store them in a preset storage space such as a register, so that when generating the first UVC frame information corresponding to the frame start information, the preset values ​​corresponding to these information can be directly obtained from the preset storage space.

[0073] When generating UVC frame information with dynamically changing values, such as FID, EOF, and PTS, the preset information acquisition component can be used to dynamically assign values ​​according to the information value change rules to achieve dynamic updating of the UVC frame information values.

[0074] For example, the UVC frame information ERR is used to indicate that an error is found during the transmission of the video data stream. Therefore, when the UVC frame information ERR is generated by the preset information collection component, the ERR can be set to a default value of 0 by the preset information collection component in the initial state, and when data loss, abnormality, etc. are detected during the transmission process, the ERR is set to 1.

[0075] It should also be noted that the first UVC frame information corresponding to the frame start information is the UVC frame information generated by the preset information collection component at the start time, wherein the start time is determined according to the reception time of the frame start information.

[0076] During the acquisition process of the video data stream, it may be necessary to acquire and transmit the video data streams of multiple video frames. Therefore, when the received video timing information is the frame start information, if the video data stream of the previous video frame has not been transmitted yet, the moment when the video data stream of the previous video frame is transmitted is determined as the start time. If the video data stream of the previous video frame has been transmitted, the moment when the received video timing information is the frame start information can be directly determined as the start time.

[0077] Therefore, by presetting the information acquisition component to generate the first UVC frame information corresponding to the frame start information at the start time, the data value specifically included in the first frame header data can be obtained.

[0078] Correspondingly, generating the first frame header data according to the first UVC frame information means: combining the values ​​of the first UVC frame information according to the format specified by the UVC protocol to obtain the first frame header data.

[0079] Exemplarily, the corresponding numerical values ​​of header length, BFH:{EOH, ERR, STI, RES, SCR_EN, PTS_EN, EOF, FID}, PTS, SCR generated by the preset information collection component are combined in sequence to generate the first frame header data.

[0080] After the first frame header data is generated, the generated first frame header data can be sent to a USB host at the receiving end of the video data stream to indicate the start of video data stream transmission of a video frame.

[0081] Step S120: When the data volume of the collected video data stream reaches a first preset threshold, the video data stream is encapsulated into a data packet, and the data packet is sent to the USB host.

[0082] The acquired video data stream refers to a video data stream that has been acquired by the video acquisition device and has not been sent to the USB host when the video timing information is frame duration information, and the video data stream corresponds to the same video frame.

[0083] In some optional implementations, in order to improve the statistical efficiency and statistical accuracy of the data volume of the video data stream, the data volume of the collected video data stream can be determined in the following manner: when the video timing information is frame duration information, in response to the data validity information being in a valid state, a preset counter is used to perform cyclic counting to obtain an updated count value, and the updated count value is used as the data volume of the collected video data stream.

[0084] Among them, cyclic counting through a preset counter means: when the video timing information is frame duration information, the initial value of the count value of the preset counter is set to 0, and the count value of the preset counter is increased by 1 each time valid data information in a valid state is received, and when the count value of the preset counter reaches a first preset threshold, the count value is cleared to 0 and counted again.

[0085] The data validity information is used to indicate whether the collected video data stream is a valid data stream. When the data validity information is in a valid state, the collected video data stream is a valid data stream.

[0086] The first preset threshold is a maximum data threshold contained in each data packet during video data stream transmission specified by the USB host, and can be stored in a preset storage space such as a register.

[0087] When the data volume of the collected video data stream reaches the first preset threshold, it means that the collected video data stream has reached the condition of packet transmission. Therefore, the video data stream can be directly encapsulated into a data packet and sent to the USB host.

[0088] The data packet is the encapsulation form of the video data stream specified by the UVC protocol, which can be divided into long packet type, short packet type and zero packet type. The data packet being a long packet type means that the data volume of the data packet reaches a first preset threshold, the data packet being a short packet type means that the data volume of the data packet is less than the first preset threshold, and the data packet being a zero packet type means that the data volume of the data packet is zero.

[0089] When the data volume of the collected video data stream reaches a first preset threshold, the data packet sent to the USB host is a data packet of a long packet type.

[0090] It should be noted that, since the captured video data stream is a video data stream that has been captured by the video capture device and has not been sent to the USB host, as long as the data volume of the video data stream reaches the first preset threshold, it can be encapsulated into a data packet. Therefore, for one video frame, it can correspond to multiple video data stream packetization operations, thereby corresponding to multiple encapsulated data packets, and the embodiments of the present disclosure do not limit this.

[0091] Step S130: In response to the received video timing information being frame termination information, second UVC frame information corresponding to the frame termination information is generated by a preset information acquisition component, frame tail data is generated according to the second UVC frame information, and the frame tail data is sent to the USB host.

[0092] The description of the frame termination information can be referred to above and will not be repeated here. The second UVC frame information corresponding to the frame termination information is the UVC frame information generated by the preset information acquisition component when the received video timing information is the frame termination information.

[0093] It should be noted that the second UVC frame information corresponding to the frame termination information is the UVC frame information generated by the preset information collection component at the termination time. The value corresponding to the second UVC frame information is the value of the UVC frame information at the termination time. The termination time is determined according to the reception time of the frame termination information.

[0094] During the transmission of a video data stream of a video frame, it may be necessary to transmit data packets corresponding to multiple video frames. Therefore, when the received video timing information is frame termination information, if there are data packets that have not been completely transmitted, the moment when the last data packet is transmitted is determined as the termination moment; if there are no data packets that have not been completely transmitted, the moment when the video timing information is received as frame termination information can be directly determined as the termination moment.

[0095] Therefore, by presetting the information collection component to generate the second UVC frame information corresponding to the frame termination information at the termination moment, the data value specifically included in the frame tail data can be obtained.

[0096] Correspondingly, generating the frame tail data according to the second UVC frame information means: combining the values ​​of the second UVC frame information according to the format specified by the UVC protocol to obtain the frame tail data.

[0097] Exemplarily, the corresponding numerical values ​​of header length, BFH:{EOH, ERR, STI, RES, SCR_EN, PTS_EN, EOF, FID}, PTS, SCR generated by the preset information collection component are combined in sequence to generate the frame tail data.

[0098] After the frame tail data is generated, it is sent to the USB host to indicate that the transmission of the video data stream of a video frame is completed.

[0099] It should be noted that the above step S120 may be repeatedly performed multiple times during the transmission of the video data stream of a video frame until the acquisition of the video data stream of a video frame is completed.

[0100] Exemplarily, when the data volume of the collected video data stream reaches a first preset threshold, the video data stream is encapsulated into the first data packet, and the data packet is sent to the USB host. After the data packet is sent, the data volume of the collected video data stream continues to be monitored. When the data volume of the collected video data stream reaches the first preset threshold, the video data stream is encapsulated into the second data packet, and the data packet is sent to the USB host.

[0101] It should also be noted that, since video data streams corresponding to multiple video frames may be collected during the video acquisition process, the above steps S110 to S130 may be executed repeatedly to achieve the transmission of video data streams corresponding to multiple video frames.

[0102] When the embodiment of the present disclosure transmits video data streams, on the one hand, when the data volume of the collected video data stream reaches a first preset threshold, real-time data packet processing is performed and data packet transmission is performed, which effectively avoids performing multiple packet processing at one time, reduces the performance requirements and storage overhead required for packet processing, and also avoids data packet transmission delays, thereby improving the real-time performance of data packet transmission. On the other hand, when the received video timing information is frame start information and frame end information, the present application can directly generate the first frame header data and frame tail data according to the preset information collection component, thereby avoiding the generation of frame header and frame tail data in the form of software development, which not only reduces the resource cost overhead required for the generation of frame header data and frame tail data, but also ensures the generation and transmission real-time performance of frame header and frame tail data.

[0103] In addition, in order to achieve better technical effects, those skilled in the art may also make various changes and modifications to the above embodiments:

[0104] In an optional implementation, the inventors found that the UVC frame information includes a frame identifier for characterizing a video frame to which a video data stream belongs, and the numerical change rule of the frame identifier is to flip and update according to the change of the video frame. Therefore, in order to improve the generation efficiency of the frame identifier and reduce software overhead, the frame identifier can be flipped through a signal processing element. Accordingly, the preset information acquisition component includes a signal processing element; the UVC frame information includes a frame identifier for characterizing a video frame to which a video data stream belongs, and then generating the first UVC frame information corresponding to the frame start information through the preset information acquisition component includes: obtaining the frame identifier corresponding to the previous frame start information of the current frame start information; flipping the frame identifier corresponding to the previous frame start information according to the signal processing element to obtain the frame identifier corresponding to the current frame start information.

[0105] The frame identifier corresponding to the previous frame start information of the current frame start information refers to the frame identifier value included in the first UVC frame information corresponding to the previous frame start information, which can be obtained from a preset storage space such as a register.

[0106] Among them, the signal processing element is used to set the reset, flip and other timing signals according to the timing logic to realize the update operations such as assignment and flip of data.

[0107] Accordingly, after obtaining the frame identifier corresponding to the previous frame start information, the frame identifier needs to be flipped, for example, a flip timing signal is set through a signal processing element, so that the flip operation of the frame identifier is realized under the control of the flip timing signal.

[0108] Exemplarily, the frame identifier is flipped from 0 to 1, thereby obtaining an updated frame identifier, which is the frame identifier corresponding to the current frame start information.

[0109] When the frame identifier corresponding to the previous frame start information is not obtained, it indicates that the video frame corresponding to the current frame start information is the first video frame. Therefore, it is necessary to set the frame identifier to a preset value through a signal processing element, and use the assigned frame identifier as the frame identifier corresponding to the current frame start information.

[0110] It should be noted that when the UVC frame information includes a frame identifier, since the frame identifier is only dynamically updated when the video frame switches, when the second UVC frame information corresponding to the frame termination information is generated by the preset information acquisition component, its frame identifier is the same as the value of the frame identifier in the first UVC frame information, and the value of the frame identifier in the second UVC frame information can be obtained by directly obtaining it from the preset storage space.

[0111] In an optional implementation, the inventor discovered that the UVC frame information includes frame end flag information for characterizing the end of a video frame, and the value change rule of the frame end flag information is to be updated at the beginning and end of a video frame. Therefore, in order to improve the generation efficiency of the frame end flag information and reduce software overhead, the frame end flag information can be numerically updated through a signal processing element. Accordingly, the UVC frame information includes frame end flag information for characterizing the end of a video frame, and the UVC frame information is generated in the following manner: when the frame start information is received, the frame end flag information is set to a first preset value according to the signal processing element; when the frame end information is received, the frame end flag information is set to a second preset value according to the signal processing element.

[0112] The first preset value is the value of the frame end flag information in the frame start state, such as 0. The second preset value is the value of the frame end flag information in the frame start state, such as 1.

[0113] Thus, when the frame start information is received, it indicates that this is the starting state of a video frame acquisition. Therefore, the assignment operation of the frame end flag information is performed according to the signal processing element, such as generating a corresponding timing signal, thereby controlling the value of the frame end flag information to be a first preset value according to the timing signal.

[0114] When the frame termination information is received, it indicates that the acquisition of a video frame is terminated at this time. Therefore, the frame end mark information is assigned a second preset value according to the signal processing component.

[0115] Exemplarily, when the frame information includes frame end flag information, in the first UVC frame information corresponding to the frame start information generated by the preset information acquisition component, the corresponding value of the frame end flag information is 0, and in the second UVC frame information corresponding to the frame termination information generated by the preset information acquisition component, the corresponding value of the frame end flag information is 1.

[0116] In an optional implementation, the inventor found that the UVC frame information includes video frame clock information for representing the video frame capture time and source time clock information for representing the system clock of the video acquisition device, and the value change rule of the source time clock information is to be updated in real time according to the system clock of the video acquisition device, and the value change rule of the video frame clock information is to be dynamically updated according to the system clock of the video acquisition device when the video frame is switched. Therefore, in order to improve the generation efficiency of the video frame clock information and the source time clock information and reduce the software overhead, the video frame clock information and the source time clock information can be numerically updated by a first counter. Accordingly, the preset information acquisition component includes: a first counter; the UVC frame information includes the video frame clock information for representing the video frame capture time and the source time clock information for representing the system clock of the video acquisition device, and the UVC frame information is generated in the following manner:

[0117] Circularly counting the system clock of the video acquisition device according to the first counter to obtain a first count value, and using the first count value as source time clock information;

[0118] When the frame start information is received, the video frame clock information is updated according to the first count value.

[0119] The first counter is used to count the number of clock cycles of the system clock of the video acquisition device in real time.

[0120] It should be noted that cyclically counting the system clock of the video acquisition device according to the first counter means: the initial count value of the first counter is 0, when a clock cycle of the system clock of the video acquisition device is monitored, the count value of the first counter is increased by 1, and when the count value of the first counter reaches the first counting threshold, the count value is cleared to 0 and the counting is restarted.

[0121] The first counting threshold of the first counter depends on the size of the storage space occupied by the count value of the first counter. For example, when the count value is 32 bits, the first counting threshold of the first counter is 2 32 -1.

[0122] Therefore, by cyclically counting the system clock of the video acquisition device through the first counter, a corresponding first count value can be obtained, and the count value can represent the real-time change of the system clock of the video acquisition device, so that the first count value can be directly used as the source time clock information in the UVC frame information.

[0123] It should also be noted that updating the video frame clock information according to the first count value means that when the first count value is different from the video frame clock information, the first count value is used as the video frame clock information.

[0124] When the frame start information is received, it indicates that the acquisition of the video frame is in the starting state. Therefore, the first count value at this time accurately represents the video frame capture time. Therefore, by assigning the first count value at this time to the video frame clock information, accurate video frame clock information can be obtained.

[0125] Correspondingly, in the first UVC frame information corresponding to the frame start information, the values ​​of the video frame clock information and the source time clock information contained therein are the values ​​corresponding to the video frame clock information and the source time clock information at the start time.

[0126] In the second UVC frame information corresponding to the frame termination information, the values ​​of the video frame clock information and the source time clock information contained therein are the values ​​corresponding to the video frame clock information and the source time clock information at the termination moment.

[0127] Among them, since the video frame clock information is updated only when the frame start information is received, the values ​​of the video frame clock information in the first UVC frame information and the second UVC frame information are the same. The source time clock information changes accordingly according to the clock cycle change of the system clock of the video acquisition device, so the values ​​of the source time clock information in the first UVC frame information and the second UVC frame information are different.

[0128] In an optional implementation, the inventor found that the UVC frame information includes token counting information for characterizing the token value, and the value change rule of the token counting information is to be updated in real time according to the SOF token sent by the USB host. Therefore, in order to improve the generation efficiency of the token counting information and reduce the software overhead, the token counting information can be numerically updated by a second counter. Accordingly, the preset information acquisition component also includes: a second counter; the UVC frame information includes token counting information for characterizing the token value, then the UVC frame information is generated in the following manner: according to the second counter, the token sent by the USB host is cyclically counted to obtain a second count value, and the second count value is used as the token counting information.

[0129] The token count information is used to represent the token value of the SOF token sent by the USB host.

[0130] The second counter is used to count the number of SOF tokens sent by the USB host in real time.

[0131] It should be noted that cyclic counting of the token sent by the USB host according to the second counter means: the initial count value of the second counter is 0, when it is recognized that the USB host sends a SOF token, the count value of the second counter is increased by 1, and when the count value of the second counter reaches the second counting threshold, the count value is cleared to 0 and counted again.

[0132] The second counting threshold of the second counter depends on the size of the storage space occupied by the count value of the second counter. For example, when the count value is 11 bits, the counting threshold of the first counter is 2 11 -1.

[0133] Therefore, by cyclically counting the SOF tokens sent by the USB host through the second counter, a corresponding second count value can be obtained, and the count value can represent the number of SOF tokens sent by the USB host, so that the second count value can be directly used as the token counting information in the UVC frame information.

[0134] Correspondingly, in the first UVC frame information corresponding to the frame start information, the value of the token count information contained therein is the value corresponding to the token count information at the start time.

[0135] In the second UVC frame information corresponding to the frame termination information, the value of the visual token count information contained therein is the value corresponding to the token count information at the termination moment.

[0136] In an optional implementation, when the data volume of a video data stream corresponding to a video frame is large, the number of data packets generated by encapsulation may exceed a threshold, thereby causing errors in data stream transmission. Therefore, the data volume of the encapsulated data packets can be counted, so that when the number of data packets reaches the threshold, second frame header data can be generated to achieve normal transmission of the video data stream.

[0137] Figure 2 The flowchart of a method for transmitting a video data stream provided by an embodiment of the present disclosure is as follows. Figure 2 As shown, the method specifically comprises:

[0138] Step S210: In response to the received video timing information being frame start information, first UVC frame information corresponding to the frame start information is generated by a preset information acquisition component, first frame header data is generated according to the first UVC frame information, and the first frame header data is sent to the USB host.

[0139] Step S220: When the data volume of the collected video data stream reaches a first preset threshold, the video data stream is encapsulated into a data packet, and the data packet is sent to the USB host.

[0140] Step S230: When the number of encapsulated data packets reaches the second preset threshold, the third UVC frame information corresponding to the current moment is generated by the preset information collection component, the second frame header data is generated according to the third UVC frame information, and the second frame header data is sent to the USB host.

[0141] The number of encapsulated data packets can be counted by a data packet counter.

[0142] Specifically, when counting the number of encapsulated data packets according to the data packet counter, the initial count value of the data packet counter can be set to 0. After monitoring an encapsulated data packet, the count value of the data packet counter is increased by 1. When the count value of the data packet counter reaches a second preset threshold, the count value of the data packet counter is cleared and counted again.

[0143] The current moment refers to the moment when it is determined that the number of encapsulated data packets reaches the second preset threshold.

[0144] The second preset threshold is the number of data packets that can be continuously transmitted when transmitting the video data stream, which is specified by the USB host and can be stored in a preset storage space such as a register.

[0145] The third UVC frame information corresponding to the current moment is the UVC frame information generated by the preset information acquisition component at the current moment. The value corresponding to the third UVC frame information is the value of the UVC frame information at the current moment.

[0146] Correspondingly, generating the second frame header data according to the third UVC frame information means: combining the values ​​of the third UVC frame information according to the format specified by the UVC protocol to obtain the second frame header data.

[0147] The second frame header data is frame header data generated when the number of encapsulated data packets reaches a second preset threshold value. The second frame header data and the first frame header data both contain the same type of UVC frame information.

[0148] The main difference between the second frame header data and the first frame header data is that the generation timings of the two and the values ​​of the UVC frame information contained in the two are different.

[0149] Specifically, the second frame header data is generated when the number of encapsulated data packets reaches a second preset threshold, and the first frame header data is generated at the start time of a video frame acquisition, that is, when the received video timing information is the frame start information, the collected video data stream has not yet been encapsulated in data packets. And because the values ​​of UVC frame information at different times may be different, for example, the values ​​corresponding to PTS and SCR at different times are different, therefore, the values ​​of UVC frame information contained in the first frame header data and the second frame header data are also different.

[0150] In the disclosed embodiment, the purpose of generating the second frame header data is to interrupt the continuous sending operation of the data packet. When the sent data packet reaches the second preset threshold, if the data packet is continued to be sent at this time, a transmission error will occur. Therefore, when the sent data packet reaches the second preset threshold, the second frame header data is generated and sent. After the second frame header data is sent, the packet transmission operation of the video data stream is performed, thereby avoiding abnormal transmission of the video data stream.

[0151] Step S240: Whether the received video timing information is frame termination information.

[0152] In this step, for the video data stream of the same video frame, when the received video timing information is frame termination information, it is determined that the video data stream has been collected.

[0153] If the video data stream is not collected, the process needs to return to step S220 to continue the data packet encapsulation operation of the video data stream.

[0154] Exemplarily, when the amount of data in the collected video data stream reaches a first preset threshold, the video data stream is encapsulated into a data packet and the data packet is sent to the USB host. After the data packet is received, the data packet counter detects that the data packet is the 10th encapsulated data packet, which has reached a second preset threshold. Therefore, it is necessary to generate second frame header data and send the second frame header data to the USB host. After sending the second frame header data, the video data stream has not yet been collected. At this time, it is necessary to return to step S220. When the amount of data in the collected video data stream reaches the first preset threshold, the video data stream is encapsulated into the 11th data packet and the data packet is sent to the USB host.

[0155] When the video data stream has been collected, step S250 is executed to generate and transmit the frame end data.

[0156] Step S250: In response to the received video timing information being frame termination information, second UVC frame information corresponding to the frame termination information is generated by a preset information acquisition component, frame tail data is generated according to the second UVC frame information, and the frame tail data is sent to the USB host.

[0157] In an optional implementation, the inventors found that after the video data stream corresponding to a video frame is packetized according to a first preset threshold, there may be residual data streams, which may cause part of the data stream to be unable to be transmitted. Therefore, before the second UVC frame information corresponding to the frame termination information is generated by the preset information acquisition component, when the presence of untransmitted residual data streams is detected, the remaining data streams can be encapsulated into short packet type data packets to achieve complete transmission of the video data stream.

[0158] Figure 3 The following is a flow chart of a method for transmitting a video data stream provided by an embodiment of the present disclosure. Figure 3 As shown, the method specifically comprises:

[0159] Step S310: In response to the received video timing information being frame start information, first UVC frame information corresponding to the frame start information is generated by a preset information acquisition component, first frame header data is generated according to the first UVC frame information, and the first frame header data is sent to the USB host.

[0160] Step S320: When the data volume of the collected video data stream reaches a first preset threshold, encapsulate the video data stream into a data packet and send the data packet to the USB host.

[0161] Step S330: When the number of encapsulated data packets reaches the second preset threshold, the third UVC frame information corresponding to the current moment is generated by the preset information collection component, the second frame header data is generated according to the third UVC frame information, and the second frame header data is sent to the USB host.

[0162] Step S340: Whether the received video timing information is frame termination information.

[0163] In this step, when the received video timing information is not frame termination information, it indicates that the video data stream has not been collected, and it is necessary to return to step S320 to continue the data packet encapsulation operation of the video data stream. When the received video timing information is frame termination information, it indicates that the video data stream has been collected, and it is necessary to execute step S350 to encapsulate the remaining video data stream that has not been encapsulated into a data packet into a data packet.

[0164] Step S350: In the case that there is a remaining video data stream that has not been encapsulated into a data packet, encapsulate the remaining video data stream into a data packet of a short packet type, and send the data packet of the short packet type to the USB host.

[0165] Among them, the remaining video data stream that has not been encapsulated into a data packet means that after the video data stream is collected, it is monitored that there is still a collected video data stream, and the data volume of the video data stream has not reached the first preset threshold. Therefore, the above video data stream cannot be encapsulated into a data packet of a long packet type.

[0166] At this time, the remaining video data stream is encapsulated into a data packet of a short packet type, and the data packet of the short packet type is sent to the USB host to achieve complete transmission of the video data stream.

[0167] Step S360: In the case where there is no remaining video data stream that has not been encapsulated as a data packet, a data packet of the zero packet type is generated and sent to the USB host.

[0168] Among them, when there is no remaining video data stream that has not been encapsulated as a data packet, that is, the amount of data of the collected video data stream monitored at this time is 0, indicating that the video data stream of a video frame has been transmitted, a data packet of the zero packet type can be generated and sent to the USB host to indicate that the data packets of the current video frame have been completely transmitted.

[0169] Step S370: Generate second UVC frame information corresponding to the frame termination information through a preset information collection component, generate frame tail data according to the second UVC frame information, and send the frame tail data to the USB host.

[0170] To facilitate understanding, an example is used below to introduce the implementation of the above embodiment.

[0171] In the related art, USB is a universal interface that can realize the transmission of video data streams. At present, the video data stream transmission scheme generally uses the CPU to obtain a large amount of collected video data streams, and encapsulates these video data streams into multiple data packets, and then generates corresponding frame header and frame tail data for the data packets according to the UVC protocol standard through the developed software, and finally transmits them to the USB host in a unified manner. Therefore, the above-mentioned video data stream transmission scheme not only requires a powerful CPU, but also consumes a large amount of ROM & RAM resources, and the software development cost is also high, resulting in high cost consumption required for video data stream transmission, and it is impossible to realize real-time transmission of video data streams.

[0172] Therefore, in order to solve the above problems, this example proposes a video data stream transmission method, which adds UVC data headers and tails and performs packet processing through hardware. It can accurately control the data volume of each data packet, correctly send short packets and zero packets, and generate frame header and frame tail data in time. It not only reduces software overhead, but also improves the real-time performance of video data transmission, and the Verilog implementation is simple.

[0173] Figure 4 A schematic diagram of a method for transmitting a video data stream in this example is shown, wherein: Figure 4 The meanings of the signals involved are as follows:

[0174] bus_clk: is the clock of the video capture device, such as 62.5Mhz.

[0175] vactive: video timing information, which is a line valid signal.

[0176] uvc_data: video data stream to be transmitted.

[0177] dvla: data validity information, used to indicate that the current uvc_data is valid.

[0178] mc_dvalid: A signal sent to the USB host to indicate that the video data transmitted to the USB host is valid data.

[0179] mc_data: video data transmitted to the USB host, such as frame header data, frame trailer data, and encapsulated data packets.

[0180] head_tail_gen: A module used to generate frame header data and frame tail data.

[0181] uvc_package: is a module used to generate data packets.

[0182] bfh[7:0]: video data stream identification information that identifies the relevant information of the video data stream in the frame header and frame footer data.

[0183] scr[47:0]: identifies the clock source of the video capture device in the frame header and frame footer data.

[0184] pts[31:0]: is the frame identifier of the video frame to which the video data stream belongs in the frame header and frame footer data.

[0185] like Figure 4 As shown, in the embodiment of the present disclosure, the head_tail_gen module can generate frame header data and frame tail data according to the bus_clk signal and the video timing information vactive signal.

[0186] Among them, when the received video timing information vactive is frame start information, the head_tail_gen module generates the first UVC frame information corresponding to the frame start information through the preset information acquisition component, and generates the first frame header data according to the first UVC frame information, that is, generates the first frame header data at the beginning of each video frame.

[0187] Among them, the UVC frame information generated by the preset information collection component mainly includes: 1 byte header length, 1 byte BFH (including EOH, ERR, STI, RES, SCR_EN, PTS_EN, EOF, FID), 4 bytes PTS, 6 bytes SCR. The specific generation process of each UVC frame information is as follows:

[0188] Header length: The length of the data header is set to a preset fixed value by a preset information collection component such as a signal processing component.

[0189] FID: Frame ID. Through a preset information collection component such as a signal processing element, when the video frame switches, that is, when the video timing information vactive is the frame start information, such as when vactive switches from a falling edge to a rising edge, it is flipped. For example, the frame ID corresponding to the current video frame is 0, the next frame is 1, and the next frame is 0, and so on.

[0190] EOF: end-of-frame flag information, through a preset information collection component such as a signal processing element, when receiving frame start information, it is set to a first preset value of 0, and when receiving frame end information, such as when vactive switches from a rising edge to a falling edge, it is set to a second preset value of 1. That is, for each video frame, the end-of-frame flag information is set to 1 when the last data packet is transmitted, and 0 at other times.

[0191] PTS_EN: PTS enable flag, which is set to a preset fixed value by a preset information collection component such as a signal processing element.

[0192] SCR_EN: SCR enable flag, which is set to a preset fixed value through a preset information collection component such as a signal processing element.

[0193] RES: A specific bit, which is set to a preset fixed value, such as 0, by a preset information collection component such as a signal processing element.

[0194] STI: Static picture indicator, which is set to a preset fixed value through a preset information collection component such as a signal processing element.

[0195] ERR: Error flag indication. Through preset information collection components such as signal processing elements, if data loss or abnormality is found during the transmission process, the flag position will be set to 1 to indicate that this is an erroneous data packet.

[0196] EOH: identifies the last header group in the data packet and is set to a preset fixed value, such as 1, by a preset information collection component such as a signal processing element.

[0197] PTS: The current video frame capture timestamp is counted cyclically by a preset information acquisition component such as a 32-bit first counter. When the frame start information is received, that is, when the FID is flipped, the count value of the first counter is assigned to PTS.

[0198] SCR: SCR[31:0] is the source time clock information representing the system clock of the video acquisition device. The clock bus_clk is cyclically counted through a preset information acquisition component such as a 32-bit first counter, and the count value of the first counter is the source time clock information. SCR[42:32] is the token counting information representing the value of the SOF token. The cyclic counting is performed through a preset information acquisition component such as an 11-bit second counter, and the count value of the second counter is the token counting information. SCR[47:43] is a reserved bit, which is set to a preset value, such as 0, through a preset information acquisition component. Therefore, each time the frame header data and frame tail data are generated, the values ​​of the above information at that moment are combined to obtain the specific value of SCR.

[0199] When the first frame header data needs to be generated, the values ​​of FID, EOF, PTS, SCR, STI, ERR, EOH and other information generated by the preset information collection component are combined to obtain the first frame header data, that is, the information bfh[7:0], scr[47:0], pts[31:0] and other information shown in the figure. Then, the frame header data is sent to the USB host through the packaging module uvc_package.

[0200] After generating the first frame header data, the packaging module uvc_package determines that the currently collected video data stream uvc_data is valid according to the dvla information, and cyclically counts the data volume of the collected video data stream of the video frame through a preset counter. The maximum value of the counter is a first preset threshold size, which is the maximum data volume that can be carried by the data packet configured by the USB host. When the collected video data stream reaches the first preset threshold, the video data stream is encapsulated as a data packet and transmitted to the USB host, and mc_dvalid information is sent to the USB host to indicate that the transmitted data is valid.

[0201] The number of encapsulated data packets is counted by the data packet counter. When the number of packets reaches the configured second preset threshold value payload size, the frame header data is generated and sent again, and the cycle continues until the remaining data is not enough to be encapsulated into a data packet of size data volume. At this time, the remaining data needs to be encapsulated into a data packet of short packet type and sent to the USB host. If the data volume of the video data stream of the current video frame is exactly an integer multiple of size, then a data packet of zero packet type needs to be sent to the USB host.

[0202] When the sending of short or zero packet type data packets is completed, the values ​​of FID, EOF, PTS, SCR, STI, ERR, EOH and other information generated by the preset information acquisition component are combined to generate frame tail data, and the frame tail data is sent to the USB host to complete the transmission of the video data stream of a video frame. Repeat this operation until the data of all video frames are transmitted, and the video transmission can be completed.

[0203] The step division of the above methods is only for the purpose of clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this patent.

[0204] In a second aspect, an embodiment of the present disclosure provides a device for transmitting a video data stream.

[0205] Figure 5 A schematic diagram of a video data stream transmission device provided by an embodiment of the present disclosure is shown, and the device specifically includes:

[0206] The frame header processing module 51 is used to generate first UVC frame information corresponding to the frame start information through a preset information acquisition component in response to the received video timing information being frame start information, generate first frame header data according to the first UVC frame information, and the USB host sends the first frame header data.

[0207] The data packet processing module 52 is used to encapsulate the video data stream into a data packet and send the data packet to the USB host when the data volume of the collected video data stream reaches a first preset threshold.

[0208] The frame tail processing module 53 is used to generate second UVC frame information corresponding to the frame termination information through a preset information acquisition component in response to the received video timing information being frame termination information, generate frame tail data according to the second UVC frame information, and send the frame tail data to the USB host.

[0209] In an optional implementation, the preset information acquisition component includes a signal processing element; the UVC frame information includes a frame identifier for characterizing a video frame to which a video data stream belongs, and the generating of the first UVC frame information corresponding to the frame start information by the preset information acquisition component includes: obtaining a frame identifier corresponding to the previous frame start information of the current frame start information; and flipping the frame identifier corresponding to the previous frame start information according to the signal processing element to obtain a frame identifier corresponding to the current frame start information.

[0210] In an optional implementation, the UVC frame information includes frame end flag information for characterizing the end of a video frame, and the UVC frame information is generated in the following manner: when the frame start information is received, the frame end flag information is set to a first preset value according to the signal processing element; when the frame termination information is received, the frame end flag information is set to a second preset value according to the signal processing element.

[0211] In an optional implementation, the preset information acquisition component also includes: a first counter; the UVC frame information includes video frame clock information for characterizing the video frame capture time and source time clock information for characterizing the system clock of the video acquisition device, then the UVC frame information is generated in the following manner: according to the first counter, the system clock of the video acquisition device is cyclically counted to obtain a first count value, and the first count value is used as the source time clock information; when the frame start information is received, the video frame clock information is updated according to the first count value.

[0212] In an optional implementation, the preset information collection component also includes: a second counter; the UVC frame information includes token counting information for characterizing the token value, and the UVC frame information is generated in the following manner: according to the second counter, the token sent by the USB host is cyclically counted to obtain a second count value, and the second count value is used as the token counting information.

[0213] In an optional implementation, after encapsulating the video data stream into a data packet and sending the data packet to the USB host, the method further includes: when the number of encapsulated data packets reaches a second preset threshold, generating third UVC frame information corresponding to the current moment through the preset information acquisition component, generating second frame header data according to the third UVC frame information, and sending the second frame header data to the USB host.

[0214] In an optional implementation, before the second UVC frame information corresponding to the frame termination information is generated by a preset information acquisition component, the method further includes: in the case where there is a remaining video data stream that is not encapsulated as a data packet, encapsulating the remaining video data stream into a data packet of a short packet type, and sending the data packet of the short packet type to the USB host; in the case where there is no remaining video data stream that is not encapsulated as a data packet, generating a data packet of a zero packet type, and sending the data packet of the zero packet type to the USB host.

[0215] The functions or modules included in the device provided in the embodiments of the present disclosure can be used to execute the method described in the first aspect of the method embodiment above. Its specific implementation and technical effects can be referred to the description of the method embodiment above. For the sake of brevity, they will not be repeated here.

[0216] It should be noted that all modules involved in this embodiment are logic modules. In practical applications, a logic unit may be a physical unit, or a part of a physical unit, or may be implemented as a combination of multiple physical units. In addition, in order to highlight the innovative part of the present disclosure, this embodiment does not introduce units that are not closely related to solving the technical problems proposed by the present disclosure, but this does not mean that there are no other units in this embodiment.

[0217] Reference Figure 6 , an embodiment of the present disclosure provides an electronic device, comprising:

[0218] One or more processors 601;

[0219] A memory 602, on which one or more programs are stored. When the one or more programs are executed by one or more processors, the one or more processors implement any one of the above-mentioned video data stream transmission methods;

[0220] One or more I / O interfaces 603 are connected between the processor and the memory and are configured to implement information exchange between the processor and the memory.

[0221] Among them, the processor 601 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 602 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) 603 is connected between the processor 601 and the memory 602, and can realize information interaction between the processor 601 and the memory 602, including but not limited to a data bus (Bus), etc.

[0222] In some embodiments, the processor 601 , the memory 602 , and the I / O interface 603 are connected to each other through a bus, and further connected to other components of the computing device.

[0223] This embodiment further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method for transmitting the video data stream provided in this embodiment is implemented. To avoid repeated description, the specific steps of the method for transmitting the video data stream are not repeated here.

[0224] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.

[0225] It should be noted that, in this article, the terms "include", "comprises" or any other variations 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. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0226] Those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present embodiment and to form different embodiments.

[0227] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present disclosure, but the present disclosure is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and substance of the present disclosure, and these modifications and improvements are also considered to be within the scope of protection of the present disclosure.

Claims

1. A method for transmitting a video data stream, It is characterized in that The method comprises: In response to the received video timing information being frame start information, generating first UVC frame information corresponding to the frame start information through a preset information acquisition component, generating first frame header data according to the first UVC frame information, and sending the first frame header data to a USB host; When the amount of data in the collected video data stream reaches a first preset threshold, encapsulating the video data stream into a data packet and sending the data packet to the USB host; In response to the received video timing information being frame termination information, second UVC frame information corresponding to the frame termination information is generated by a preset information acquisition component, frame tail data is generated according to the second UVC frame information, and the frame tail data is sent to the USB host.

2. The method according to claim 1, It is characterized in that The preset information acquisition component includes a signal processing element; the UVC frame information includes a frame identifier for representing a video frame to which the video data stream belongs, and the first UVC frame information corresponding to the frame start information generated by the preset information acquisition component includes: Get the frame identifier corresponding to the previous frame start information of the current frame start information; The frame identifier corresponding to the previous frame start information is flipped according to the signal processing element to obtain the frame identifier corresponding to the current frame start information.

3. The method according to claim 2, It is characterized in that The UVC frame information includes frame end flag information for indicating the end of the video frame, and the UVC frame information is generated in the following manner: When the frame start information is received, the frame end flag information is set to a first preset value according to the signal processing element; When the frame termination information is received, the frame end flag information is set to a second preset value according to the signal processing element.

4. The method according to claim 1, It is characterized in that The preset information collection component also includes: a first counter; The UVC frame information includes video frame clock information for representing the video frame capture time and source time clock information for representing the system clock of the video acquisition device. The UVC frame information is generated in the following manner: cyclically counting the system clock of the video acquisition device according to the first counter to obtain a first count value, and using the first count value as the source time clock information; When the frame start information is received, the video frame clock information is updated according to the first count value.

5. The method according to claim 1, It is characterized in that The preset information collection component further includes: a second counter; The UVC frame information includes token count information for characterizing a token value, and the UVC frame information is generated in the following manner: The token sent by the USB host is cyclically counted according to the second counter to obtain a second count value, and the second count value is used as the token counting information.

6. The method according to any one of claims 1 to 5, It is characterized in that After encapsulating the video data stream into a data packet and sending the data packet to the USB host, the method further comprises: When the number of encapsulated data packets reaches a second preset threshold, the preset information acquisition component generates third UVC frame information corresponding to the current moment, generates second frame header data according to the third UVC frame information, and sends the second frame header data to the USB host.

7. The method according to any one of claims 1 to 5, It is characterized in that Before the preset information collection component generates the second UVC frame information corresponding to the frame termination information, the method further includes: In the case where there is a remaining video data stream that is not encapsulated as a data packet, encapsulating the remaining video data stream into a data packet of a short packet type, and sending the data packet of the short packet type to the USB host; In the case that there is no remaining video data stream that is not encapsulated as a data packet, a data packet of a zero packet type is generated and sent to the USB host.

8. A video data stream transmission device, It is characterized in that The device comprises: A frame header processing module, for generating first UVC frame information corresponding to the frame start information by a preset information acquisition component in response to the received video timing information being frame start information, generating first frame header data according to the first UVC frame information, and sending the first frame header data by a USB host; A data packet processing module, configured to encapsulate the video data stream into a data packet and send the data packet to the USB host when the data volume of the collected video data stream reaches a first preset threshold; The frame tail processing module is used to generate second UVC frame information corresponding to the frame termination information through a preset information acquisition component in response to the received video timing information being frame termination information, generate frame tail data according to the second UVC frame information, and send the frame tail data to the USB host.

9. An electronic device, It is characterized in that include: one or more processors; A storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7; One or more I / O interfaces are connected between the processor and the memory and are configured to implement information interaction between the processor and the memory.

10. A computer readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method according to any one of claims 1 to 7.