Real-time pushing method of media stream and server

文档序号:1159444 发布日期:2020-09-15 浏览:24次 中文

阅读说明:本技术 媒体流的实时推送方法及服务器 (Real-time pushing method of media stream and server ) 是由 姜红旗 于 2019-03-05 设计创作,主要内容包括:本发明公开了一种媒体流的实时推送方法及服务器,其中,方法包括:生成媒体段,其中,生成初始媒体段,并根据客户端的反馈和媒体单元的产生情况生成新的媒体段,媒体段封装有至少一个媒体单元,客户端的反馈包括媒体段中已接收数据的指示;向客户端发送生成的媒体段并接收客户端的反馈,其中,采用预设网络传输协议与客户端建立至少一个传送连接,以使用至少一个传送连接传送生成的媒体段。根据本发明实施例的推送方法,可以实现媒体流的自适应分段推送,支持多种网络传输协议,提高媒体流的传送效率和在复杂网络环境下的传送性能。(The invention discloses a real-time pushing method of media streams and a server, wherein the method comprises the following steps: generating a media segment, wherein an initial media segment is generated, a new media segment is generated according to the feedback of a client and the generation condition of a media unit, the media segment is packaged with at least one media unit, and the feedback of the client comprises an indication of received data in the media segment; and sending the generated media segments to the client and receiving feedback of the client, wherein at least one transmission connection is established with the client by adopting a preset network transmission protocol so as to transmit the generated media segments by using the at least one transmission connection. According to the pushing method provided by the embodiment of the invention, the self-adaptive segmented pushing of the media stream can be realized, a plurality of network transmission protocols are supported, and the transmission efficiency and the transmission performance of the media stream under a complex network environment are improved.)

1. A method for pushing a media stream in real time, wherein the media stream is a sequence of media units generated in real time, and each media unit is associated with a generation time and/or a sequence number indicating a generation sequence, and the method comprises:

generating a media segment, wherein an initial media segment is generated, a new media segment is generated according to the feedback of a client and the generation condition of a media unit, the media segment is packaged with at least one media unit, and the feedback of the client comprises an indication of received data in the media segment;

and sending the generated media segments to the client and receiving feedback of the client, wherein at least one transmission connection is established with the client by adopting a preset network transmission protocol so as to transmit the generated media segments by using the at least one transmission connection.

2. The real-time pushing method of media stream according to claim 1, wherein the initial media segment encapsulates a default designated media unit, and the default designated media unit is a media unit whose sequence number interval between all and the latest media unit in the media stream is smaller than a first preset value, or a media unit whose generation time interval between all and the latest media unit in the media stream is smaller than a second preset value.

3. The real-time pushing method of media stream according to claim 1, wherein the generating a new media segment according to the feedback of the client and the generation condition of the media unit further comprises:

when a new media unit is generated, judging whether the existing media unit meets a preset media segment generation condition, wherein if the preset media segment generation condition is met, selecting part or all unsuccessfully transmitted media units to be packaged into the new media segment.

4. The real-time pushing method of the media stream according to claim 3, wherein the preset media segment generation condition is: the sequence number interval between the newest media unit and all the media units in the sent media segment is larger than or equal to a preset sequence number interval.

5. The real-time pushing method of the media stream according to claim 3, wherein the preset media segment generation condition is: the generation time interval of the newest media unit and all media units in the sent media segment is greater than or equal to a preset time interval.

6. The real-time pushing method of media stream according to claim 1, wherein the predetermined network transport protocol is one of the following protocols: RTP, TCP, HTTP and QUIC.

7. The real-time pushing method of media stream according to claim 1, wherein when the predetermined network transport protocol comprises a plurality of network transport protocols, a network transport protocol is selected according to the feedback of the client and the transmission requirement of the media stream.

8. A real-time push method of media streams according to claim 1, characterized in that when different media segments are sent to the client using the same network transport protocol, different transport connections are used or the same transport connection is shared.

9. A real-time push server of a media stream, wherein the media stream is a sequence of media units generated in real-time, wherein each media unit is associated with a generation time and/or a sequence number indicating a generation order, and wherein the server comprises:

the media segment generation component is used for generating media segments, wherein an initial media segment is generated, a new media segment is generated according to the feedback of a client and the generation condition of a media unit, the media segment is packaged with at least one media unit, and the feedback of the client comprises an indication that data is received in the media segment;

and the media segment sending component is used for sending the generated media segments to the client and receiving the feedback of the client, wherein at least one transmission connection is established with the client by adopting a preset network transmission protocol so as to transmit the generated media segments by using the at least one transmission connection.

10. The real-time push server of media stream according to claim 9, wherein the initial media segment encapsulates a default designated media unit, and the default designated media unit is a media unit in which sequence number intervals of all and latest media units in the media stream are smaller than a first preset value, or a media unit in which generation time intervals of all and latest media units in the media stream are smaller than a second preset value.

11. The real-time media stream pushing server of claim 9, wherein the media segment sending component is further configured to determine whether existing media units satisfy a preset media segment generating condition each time a new media unit is generated, wherein if the preset media segment generating condition is satisfied, part or all of unsuccessfully sent media units are selected to be encapsulated into the new media segment.

12. The real-time media stream pushing server according to claim 11, wherein the preset media segment generating condition is: the sequence number interval between the newest media unit and all the media units in the sent media segment is larger than or equal to a preset sequence number interval.

13. The real-time media stream pushing server according to claim 11, wherein the preset media segment generating condition is: the generation time interval of the newest media unit and all media units in the sent media segment is greater than or equal to a preset time interval.

14. The real-time push server of media stream as claimed in claim 9, wherein the predetermined network transport protocol is one of the following protocols: RTP, TCP, HTTP and QUIC.

15. The real-time push server of media stream as claimed in claim 9, wherein when the predetermined network transport protocol comprises a plurality of network transport protocols, the network transport protocol is selected according to the feedback of the client and the transmission requirement of the media stream.

16. A real-time push server of media streams according to claim 9, characterised in that when sending different media segments to the client using the same network transport protocol, different transport connections are used or the same transport connection is shared.

17. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the method of any one of claims 1 to 8.

18. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the method of any one of claims 1-8.

19. A computer program product in which instructions, when executed by a processor, perform the method of any one of claims 1-8.

Technical Field

The present invention relates to the field of digital information transmission technologies, and in particular, to a real-time media stream pushing method and a server.

Background

With the rapid development of the internet, especially the mobile internet, the real-time transmission of multimedia data such as audio, video, and image through the internet becomes a basic requirement for many applications, and in order to meet the requirement, various streaming media real-time transmission technologies are proposed, which can be divided into two categories according to the different origins of data transmission: one is a stream pulling mode, the basic principle is that a client actively requests real-time data from a server, and the technical scheme of stream pulling is as follows: hls (http Live Streaming) proposed by apple, Smooth Streaming proposed by microsoft, hds (http Dynamic Streaming) proposed by Adobe, dash (Dynamic Adaptive Streaming http) proposed by MPEG organization; the other type is a stream pushing mode, the basic principle is that a server actively pushes a media stream generated in real time to a client, and the technical scheme of stream pushing comprises the following steps: Real-Time Transport Protocol (RTP)/RTSP), RTMP (Real Time Streaming Protocol), and HTTP-FLV.

Compared with a stream pulling mode, a stream pushing mode does not need to wait for a request of a client, and can quickly send media stream data generated in real time to the client to realize low delay, so that the pushing-based mode is generally adopted in application occasions with higher real-time requirements, such as interactive live broadcast, video conference and the like.

However, various push schemes of the related art have the following problems:

1. there is a lack of segment pushing of media data. In related push schemes, once media data is generated, it is immediately sent to a transmission buffer, but if the amount of data of a single media unit is small, frequent single push will increase network transmission overhead, decreasing transmission efficiency.

2. Only a single network transmission protocol is used, and the method cannot adapt to various complex network environments. Firstly, due to the arrangement of a router and a firewall in the internet, a server and certain clients can only use a specific transmission protocol, and the server needs to select different network transmission protocols for different clients; secondly, when the terminal where the client is located accesses the internet through the wireless network, the signal quality of an access link of the terminal changes along with the position of the terminal, accordingly, the network transmission bandwidth, the transmission delay and the packet loss rate also change, and the service performance cannot be guaranteed only by using one network transmission protocol, for example, when the packet loss rate of the link is higher, the transmission efficiency of the TCP is very low, and even the TCP cannot work.

3. Only a single transport connection is used, resulting in cumulative delays. For RTMP or HTTP-FLV, it is necessary to establish a TCP connection before transmission and use it throughout the transmission process, which easily results in cumulative delay, i.e. when network congestion occurs, packets that are not sent soon are accumulated and transmission of subsequent packets is blocked. Although the above problem can be remedied by emptying the buffer and disconnecting the reconnection, this will cause all the data in the buffer to be lost.

Disclosure of Invention

The present invention is directed to solving, at least to some extent, one of the technical problems in the related art.

Therefore, a first objective of the present invention is to provide a real-time pushing method for a media stream, which can implement adaptive segment pushing of the media stream, support multiple network transmission protocols, and improve the transmission efficiency and the transmission performance of the media stream in a complex network environment.

The second objective of the present invention is to provide a real-time push server for media streams.

A third object of the invention is to propose a computer device.

A fourth object of the invention is to propose a non-transitory computer-readable storage medium.

A fifth object of the invention is to propose a computer program product.

In order to achieve the above object, a first embodiment of the present invention provides a method for pushing a media stream in real time, where the media stream is a sequence of media units generated in real time, where each media unit is associated with a generation time and/or a sequence number indicating a generation order, and the method includes: generating a media segment, wherein an initial media segment is generated, a new media segment is generated according to the feedback of a client and the generation condition of a media unit, the media segment is packaged with at least one media unit, and the feedback of the client comprises an indication of received data in the media segment; and sending the generated media segments to the client and receiving feedback of the client, wherein at least one transmission connection is established with the client by adopting a preset network transmission protocol so as to transmit the generated media segments by using the at least one transmission connection.

The method for pushing the media stream in real time in the embodiment of the invention can realize the segmented pushing of the media data through the self-adaptive segmentation of the media stream, improve the transmission efficiency of the media stream, and automatically adjust the duration and the content of the media segment according to the feedback of the client so as to adapt to the dynamic change of a network; secondly, the transmission of the media segments can adopt any specified network transmission protocol, and can also select a proper network transmission protocol for each client and even each media segment according to the network transmission condition so as to be suitable for transmission under a complex network environment; finally, when different media segments are transmitted by using the same network transmission protocol, the same transmission connection can be shared, and different transmission connections can be respectively used, so that the accumulated time delay caused by network congestion or faults can be avoided.

In addition, the real-time pushing method of the media stream according to the above embodiment of the present invention may further have the following additional technical features:

further, in an embodiment of the present invention, the initial media segment encapsulates a default specified media unit, where the default specified media unit is a media unit in which sequence number intervals of all and latest media units in the media stream are smaller than a first preset value, or a media unit in which generation time intervals of all and latest media units in the media stream are smaller than a second preset value.

Further, in an embodiment of the present invention, the generating a new media segment according to the feedback of the client and the generation condition of the media unit further includes: when a new media unit is generated, judging whether the existing media unit meets a preset media segment generation condition, wherein if the preset media segment generation condition is met, selecting part or all unsuccessfully transmitted media units to be packaged into the new media segment.

Optionally, in an embodiment of the present invention, the preset media segment generation condition is: the sequence number interval between the newest media unit and all the media units in the sent media segment is larger than or equal to a preset sequence number interval.

Optionally, in an embodiment of the present invention, the preset media segment generation condition is: the generation time interval of the newest media unit and all media units in the sent media segment is greater than or equal to a preset time interval.

Optionally, in an embodiment of the present invention, the preset network transmission protocol is one of the following protocols: RTP, TCP, HTTP and QUIC.

In an embodiment of the present invention, when the preset network transport protocol includes multiple network transport protocols, the network transport protocol is selected according to the feedback of the client and the transmission requirement of the media stream.

In addition, in one embodiment of the invention, when different media segments are sent to the client using the same network transport protocol, different transport connections are used, or the same transport connection is shared.

In order to achieve the above object, a second aspect of the present invention provides a real-time push server for a media stream, where the media stream is a sequence of media units generated in real time, and each media unit is associated with a generation time and/or a sequence number indicating a generation sequence, where the server includes: the media segment generation component is used for generating media segments, wherein an initial media segment is generated, a new media segment is generated according to the feedback of a client and the generation condition of a media unit, the media segment is packaged with at least one media unit, and the feedback of the client comprises an indication that data is received in the media segment; and the media segment sending component is used for sending the generated media segments to the client and receiving the feedback of the client, wherein at least one transmission connection is established with the client by adopting a preset network transmission protocol so as to transmit the generated media segments by using the at least one transmission connection.

The real-time pushing server of the media stream of the embodiment of the invention can realize the segmented pushing of the media data through the self-adaptive segmentation of the media stream, improve the transmission efficiency of the media stream, and automatically adjust the duration and the content of the media segment according to the feedback of the client so as to adapt to the dynamic change of a network; secondly, the transmission of the media segments can adopt any specified network transmission protocol, and can also select a proper network transmission protocol for each client and even each media segment according to the network transmission condition so as to be suitable for transmission under a complex network environment; finally, when different media segments are transmitted by using the same network transmission protocol, the same transmission connection can be shared, and different transmission connections can be respectively used, so that the accumulated time delay caused by network congestion or faults can be avoided.

In addition, the real-time push server of the media stream according to the above embodiment of the present invention may further have the following additional technical features:

further, in an embodiment of the present invention, the initial media segment encapsulates a default specified media unit, where the default specified media unit is a media unit in which sequence number intervals of all and latest media units in the media stream are smaller than a first preset value, or a media unit in which generation time intervals of all and latest media units in the media stream are smaller than a second preset value.

Further, in an embodiment of the present invention, the media segment sending component is further configured to, each time a new media unit is generated, determine whether an existing media unit meets a preset media segment generation condition, wherein, if the preset media segment generation condition is met, select some or all unsuccessfully sent media units to be encapsulated into the new media segment.

Optionally, in an embodiment of the present invention, the preset media segment generation condition is: the sequence number interval between the newest media unit and all the media units in the sent media segment is larger than or equal to a preset sequence number interval.

Optionally, in an embodiment of the present invention, the preset media segment generation condition is: the generation time interval of the newest media unit and all media units in the sent media segment is greater than or equal to a preset time interval.

Optionally, in an embodiment of the present invention, the preset network transmission protocol is one of the following protocols: RTP, TCP, HTTP and QUIC.

In an embodiment of the present invention, when the preset network transport protocol includes multiple network transport protocols, the network transport protocol is selected according to the feedback of the client and the transmission requirement of the media stream.

In addition, in one embodiment of the invention, when different media segments are sent to the client using the same network transport protocol, different transport connections are used, or the same transport connection is shared.

In order to achieve the above object, a third embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the processor implements the real-time pushing method for media streams as described in the above embodiments.

To achieve the above object, a fourth aspect of the present invention provides a non-transitory computer-readable storage medium, where the program is executed by a processor to implement the real-time pushing method for media streams as described in the above embodiments.

To achieve the above object, a fifth aspect of the present invention provides a computer program product, wherein when the instructions in the computer program product are executed by a processor, the method for pushing a media stream in real time as described in the above embodiments is performed.

Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.

Drawings

The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:

fig. 1 is a flowchart of a real-time pushing method of a media stream according to an embodiment of the present invention;

fig. 2 is a schematic diagram of a real-time pushing process of a media stream according to an embodiment of the present invention;

FIG. 3 is a diagram illustrating a server supporting multiple network transport protocols, according to one embodiment of the invention;

FIG. 4 is a diagram illustrating selection of a network transport protocol according to one embodiment of the invention;

FIG. 5 is a schematic diagram of selecting a transport connection according to one embodiment of the present invention;

fig. 6 is a schematic structural diagram of a real-time push server for media streaming according to an embodiment of the present invention.

Detailed Description

Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.

In the internet, it is often necessary to transmit various real-time generated audio, video or data streams from one network node to another, the network nodes including both various terminals such as PCs, mobile phones, tablets and various application servers such as video servers and audio servers, and the transmitted audio, video or data streams are collectively referred to as media streams. The delivery process of a media stream can be described in a general client-server model: the media stream generated in real time is delivered by the server to the client. The server and the client refer to logical functional entities, where the server is a functional entity that transmits a media stream, and the client is a functional entity that receives a media stream. The server and client may reside on any network node.

Each transmitted media stream is a sequence of media units generated in real time. Different media streams, their corresponding media units can be selected by themselves. When the media stream is a byte stream generated in real time, a byte can be selected as a media unit; when the media stream is an audio stream or a video stream obtained through real-time sampling, an original audio frame or a video frame can be selected as a media unit; when the media stream is an audio stream or a video stream which is sampled and encoded in real time, an encoded audio frame, an encoded video frame or an Access Unit (Access Unit) can be selected as a media Unit; when the media stream is an audio stream or a video stream that is sampled, encoded and encapsulated in real time, the encapsulated transport packets (e.g., RTP packets, PES/PS/TS packets, etc.) may be selected as media units; when the media stream is an audio or video stream that is sampled, encoded, encapsulated, and pre-segmented in real-time, a segmented media segment (e.g., a TS format segment used in HLS protocol, fMP4 format segment used in DASH protocol) may be selected as a media unit.

Each media unit may be associated with a generation time, which is typically a timestamp. Each media unit may also be associated with a sequence number that may be used to indicate the order in which the media units were generated. When sequence numbers are used to indicate the order in which the media units are generated, the meaning of the sequence numbers need to be defined in terms of the specific media unit. When the media unit is a byte, the serial number of the media unit is a byte serial number; when the media units are audio frames and video frames, the serial numbers of the media units are frame serial numbers; when the media unit is a transmission packet, the sequence number of the media unit is a packet sequence number; when the Media unit is a stream segment, the Sequence number of the Media unit is a segment Sequence number (e.g., Media Sequence of each TS segment in HLS).

For a media stream, a Sequence Number indicating a generation Sequence and a generation time may be associated at the same time, for example, when the real-time media stream is an RTP packet stream, the RTP header has both a Sequence Number (Sequence Number) field to indicate the Sequence of the RTP packet and a timestamp field to indicate the generation time of the media data encapsulated in the RTP. In this case, multiple consecutive RTP packets may correspond to the same generation time, but their sequence numbers are unique.

Embodiments of the present invention may be implemented for any type of real-time media stream. In the following embodiments, the MPEG2-TS real-time media stream will be selected to illustrate the implementation of the embodiments of the present invention. For MPEG2-TS real-time streams, in a manner similar to HLS/DASH, a TS stream generated or received in real-time may be divided into TS segments of short duration, such as about 1 second, each TS segment may include a plurality of media frames, and then the segments are sequenced in the generation order as media units, and the timestamp of the first media frame contained in each segment indicates the generation time of the segment.

In related art real-time streaming media protocols such as RTP, RTMP or HTTP-FLV, a server push method is adopted: once a new media unit exists on the server, the new media unit is actively sent to the client, without involving the segmentation encapsulation of the media stream, but in various HTTP adaptive streams (such as HLS, smooth stream, MPEG-DASH), a pre-segmentation manner is adopted, and the media stream generates media segments according to a fixed time length and issues a manifest file, and then waits for the pull of the client. Different from the above manners, in the embodiment of the present invention, the server actively segments and pushes the media stream in real time, and automatically adjusts the content and duration of the subsequent media segments according to the sending condition of the media segments.

The following describes a real-time pushing method of a media stream and a server according to an embodiment of the present invention with reference to the drawings, and first, a real-time pushing method of a media stream according to an embodiment of the present invention will be described with reference to the drawings.

Fig. 1 is a flowchart of a real-time pushing method of a media stream according to an embodiment of the present invention.

As shown in fig. 1, the method for pushing a media stream in real time is a sequence of media units generated in real time, wherein each media unit is associated with a generation time and/or a sequence number indicating a generation sequence, and the method includes:

in step S101, a media segment is generated, wherein an initial media segment is generated, and a new media segment is generated according to the feedback of the client and the generation condition of the media unit, the media segment is packaged with at least one media unit, and the feedback of the client includes an indication of received data in the media segment.

Specifically, in the pushing process, the server may combine small media units into a media segment, so as to reduce the number of times of pushing and improve the pushing efficiency, but the process of encapsulating the media units into the media segment also increases the waiting delay of the media units, so that the server first provides an initial media segment to probe the transmission delay and the transmission bandwidth of the network, and then further adjusts the duration and the content of subsequent media segments according to the feedback of the client, so as to achieve the tradeoff between the transmission delay and the transmission efficiency. For example, if the network transmission bandwidth is sufficient, the number of encapsulated media units in a media segment can be reduced, and the number of push times can be increased to reduce the delay; if the network transmission bandwidth is insufficient, the number of pushes can be reduced and part of the media units can be selected for pushing.

In addition, the server can know the current network transmission bandwidth and transmission delay through the feedback of the client. For example, first, the feedback of the client includes an indication of received data in the media segment, where the received data may refer to a number of bytes received in the media segment or may be a received media unit in the media segment. Secondly, the feedback of the client should be timely, for example, the client may send the feedback to the server periodically at a set interval. Finally, the feedback of the client may be explicit feedback or implicit feedback, and it should be noted that the explicit feedback may mean that the feedback of the client is independent of the used network transmission protocol; the implicit feedback mentioned above may mean that the feedback of the client is implicit in the network transmission protocol used, such as the feedback message for the received data already existing in TCP.

In an embodiment of the present invention, in order to ensure the push real-time performance, the media units encapsulated in the initial media segment should include the newly generated media units. In addition, one or more media units may be encapsulated into media segments using custom encapsulation protocols, for example, one simple encapsulation protocol is as follows: the media segment is composed of a segment head and a segment payload, the segment payload is formed by cascading a plurality of media units, and the segment head indicates the initial position and the length of each media unit, so that the analysis of the client side is facilitated. If the media unit does not include the generation time and/or the sequence number thereof, the generation time and/or the sequence number corresponding to the media unit also needs to be encapsulated in the media segment, which is convenient for the receiving end to receive and analyze.

In step S102, the generated media segment is sent to the client and feedback of the client is received, wherein at least one transmission connection is established with the client using a preset network transport protocol to transmit the generated media segment using the at least one transmission connection.

In particular, the server may employ any network transport protocol to transmit the media segments. When media stream is pushed to a client, the server and the client should agree on a network transmission protocol which can be used between the server and the client, if the server and the client only agree on one network transmission protocol, the server sends media segments to the client according to the network transmission protocol; if two or more network transmission protocols are agreed by the server and the client, the server may select one network transmission protocol from the row according to the feedback from the client. Therefore, when the clients are distributed in different networks, the most appropriate network transmission protocol can be selected to push the media segments, and the pushing from the server to each client under the complex network environment is realized.

When a network transport protocol is used for transmitting media segments, at least one transport connection to the client is first established using the network transport protocol and the media segments are then transmitted over the transport connection. We can view this transport connection as a logical data pipe. Taking the TCP protocol as an example, in order to push a media segment to a client using the TCP protocol, the server and the client establish a TCP connection, the TCP connection actually binds IP addresses and port numbers of the server and the client, and after the connection is established, the server can send media segment data through the TCP connection and receive feedback of the client.

Because the pushing of the media stream is carried out based on the media segments, the method of the embodiment of the invention can select a network transmission protocol and corresponding transmission connection for each media segment according to the transmission condition of the network, therefore, each media segment can be transmitted on different connections, and the accumulated delay phenomenon in single connection can not occur.

It should be understood that the steps S101 and S102 are provided for convenience of description only and are not used to limit the execution order of the method, and in a specific implementation, the steps S101 and S102 may be implemented as two parallel execution processes or threads.

The above is a detailed explanation of embodiment 1, and embodiment 2 will be described in detail below, and in the following embodiment, a description will be made of how the server generates the initial media segment.

Further, in an embodiment of the present invention, the initial media segment encapsulates a default specified media unit, where the default specified media unit is a media unit in which sequence number intervals of all and latest media units in the media stream are smaller than a first preset value, or a media unit in which generation time intervals of all and latest media units in the media stream are smaller than a second preset value.

In an embodiment of the present invention, to reduce the transmission delay, the initial media segment generally contains the latest generated media unit, i.e. the latest generated media unit is pushed out immediately, on the other hand, the size of the initial media segment is related to the receiving buffer of the client, and the client stores the initial media segment into the receiving buffer after receiving the initial media segment, so that the length of the initial media segment should not exceed the size of the receiving buffer, and therefore, before pushing, the server and the client should agree on the number of media units contained in the initial media segment (determined by a first preset value) or the duration of the initial media segment (determined by a second preset value).

The following implementation takes MPEG2-TS real-time stream as an example, where a media unit is a TS segment, and each TS segment is associated with a sequence number. As shown in fig. 2, assuming that the sequence number of the newly generated TS fragment is 21, and the first preset value agreed by the client and the server is 2, 2 media units (sequence numbers 20 and 21) are encapsulated in the initial media segment MS 1. Of course, we can also use the second preset value to limit the duration of the initial media segment, for example, assuming that the duration of each TS segment is 1 second, and the second preset value is set to 3 seconds, it means that the duration of the initial media segment does not exceed 3 seconds, i.e. at most includes 3 media units.

In other embodiments, the media units contained in the initial media segment may also be selected according to other rules, such as selecting media units of a particular priority.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:模拟现实的方法、装置和系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类