WO2018054349A1 - 数据发送方法、数据接收方法及其装置和系统 - Google Patents

数据发送方法、数据接收方法及其装置和系统 Download PDF

Info

Publication number
WO2018054349A1
WO2018054349A1 PCT/CN2017/102889 CN2017102889W WO2018054349A1 WO 2018054349 A1 WO2018054349 A1 WO 2018054349A1 CN 2017102889 W CN2017102889 W CN 2017102889W WO 2018054349 A1 WO2018054349 A1 WO 2018054349A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
encoder
playing device
code rate
unit
Prior art date
Application number
PCT/CN2017/102889
Other languages
English (en)
French (fr)
Inventor
孙学刚
Original Assignee
深圳创维数字技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳创维数字技术有限公司 filed Critical 深圳创维数字技术有限公司
Publication of WO2018054349A1 publication Critical patent/WO2018054349A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • H04N21/234309Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by transcoding between formats or standards, e.g. from MPEG-2 to MPEG-4 or from Quicktime to Realvideo
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/436Interfacing a local distribution network, e.g. communicating with another STB or one or more peripheral devices inside the home
    • H04N21/4363Adapting the video stream to a specific local network, e.g. a Bluetooth® network
    • H04N21/43637Adapting the video stream to a specific local network, e.g. a Bluetooth® network involving a wireless protocol, e.g. Bluetooth, RF or wireless LAN [IEEE 802.11]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/44227Monitoring of local network, e.g. connection or bandwidth variations; Detecting new devices in the local network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/60Network structure or processes for video distribution between server and client or between remote clients; Control signalling between clients, server and network components; Transmission of management data between server and client, e.g. sending from server to client commands for recording incoming content stream; Communication details between server and client 
    • H04N21/63Control signaling related to video distribution between client, server and network components; Network processes for video distribution between server and clients or between remote clients, e.g. transmitting basic layer and enhancement layers over different transmission paths, setting up a peer-to-peer communication via Internet between remote STB's; Communication protocols; Addressing
    • H04N21/643Communication protocols

Definitions

  • the present disclosure relates to the field of computer communication technologies, for example, to a data transmission method, a data reception method, and an apparatus and system thereof.
  • DIGITAL LIVING NETWORKALLIANCE DLNA
  • DLNA DIGITAL LIVING NETWORKALLIANCE
  • DVD digital video broadcast
  • the UDP protocol is a subset of the TCP/IP protocol stack, which belongs to the transport layer protocol and has the speed advantage that the TCP protocol of the TCP/IP transport layer protocol is unmatched.
  • the UDP protocol since different set-top box chip manufacturers do not have a uniform standard for the speed at which the encoder processes data and the frame buffer size, this results in data being transmitted over the UDP protocol after the DLNA obtains media data due to the large amount of data burst by the encoder on some platforms.
  • the terminal device When transmitting, it causes a sudden increase in network traffic.
  • the terminal device receives the network data loss due to the limitation of the bandwidth or the transit device, which in turn affects the user experience. Therefore, how to solve the technical problem that the terminal device does not lose the live broadcast source data when the network traffic suddenly increases, and it is extremely important to realize a smooth and smooth broadcast of the live program.
  • the present disclosure provides a data transmitting method, a data receiving method, a device and a system thereof, which realize uniform transmission of media data, and provide a guarantee for a smooth and smooth broadcast of a live program of a smart terminal, and the user experience is good.
  • a data sending method is applied to a first data playing device, and the first data playing device is configured An encoder is provided, the first data playing device is connected to the second data playing device by using a DLNA protocol, and the second data playing device is configured with a decoder, the method comprising:
  • the step of sending the data block to the second data playing device includes:
  • the method further includes:
  • the encoder is turned off.
  • the code rate and resolution of the decoder match the CPU performance of the second data playback device.
  • a data receiving method is applied to a second data playing device, wherein the first data playing device is configured with an encoder, and the first data playing device is connected to the second data playing device by using a DLNA protocol, and the second data playing device is The device is configured with a decoder, and the method includes:
  • the data block sent by the first data playing device where the data block is composed of data output by the encoder and has a capacity less than or equal to the network buffer capacity.
  • the step of receiving the data block sent by the first data playing device includes:
  • the data sending thread includes, after each time the data block is sent, a sleep time T, the time
  • the code rate and resolution of the decoder match the CPU performance of the second data playback device.
  • a data transmitting device configured in the first data playing device, includes:
  • a configuration parameter receiving unit configured to receive, according to a DLNA protocol, a data buffer capacity of the second data playback device sent by the second data playback device, and a code rate and a resolution of the decoder;
  • An encoder activation unit configured to configure and activate the encoder according to the code rate and the resolution
  • a data buffer unit configured to buffer data output by the encoder
  • a data block reading unit configured to read a data block having a capacity less than or equal to the capacity of the network buffer:
  • a data block sending unit configured to send the data block to the second data playing device based on a DLNA protocol.
  • the data block sending unit includes:
  • the data sending thread starts the subunit, and is set to start the data sending thread
  • T The unit is milliseconds
  • B is the code rate, the unit of the code rate is bit/second
  • S is the data buffer capacity, the unit of the data buffer capacity is byte
  • M is a correction value, greater than 1
  • the integer, ⁇ t is the transmission time of the data block, and the time is in milliseconds.
  • it also includes:
  • connection status detecting unit configured to detect an HTTP connection status
  • An encoder control unit is arranged to turn off the encoder if the state is off.
  • the code rate and resolution of the decoder match the CPU performance of the second data playback device.
  • a data receiving device configured in the second data playing device, includes:
  • a configuration parameter sending unit configured to send a data buffer capacity of the second data playing device and a code rate and resolution of the decoder to the first data playing device based on the DLNA protocol, so as to Configuring and starting the encoder according to the code rate and the resolution by the first data playback device;
  • a data block receiving unit configured to receive the data block sent by the first data playing device based on a DLNA protocol, where the data block is composed of data output by the encoder and has a capacity less than or equal to the network buffer capacity .
  • the data block receiving unit includes:
  • a data block receiving subunit configured to receive, by the data sending thread, the data block sent by the first data playing device
  • the code rate and resolution of the decoder match the CPU performance of the second data playback device.
  • a data communication system includes a first data playing device, a second data playing device, and a WiFi device, wherein the first data playing device and the second data playing device are both connected to the WiFi device.
  • the first data playback device receives the data buffer capacity and a code rate and resolution of the decoder based on a DLNA protocol;
  • the first data playing device configures and starts the encoder according to the code rate and the resolution
  • the first data playing device buffers data output by the encoder, and reads a data block whose capacity is less than or equal to the network buffer capacity; and sends the data block to the second data playing device based on a DLNA protocol. ;as well as
  • the data block is composed of data output by the encoder and has a capacity less than or equal to the network buffer capacity.
  • a computer readable storage medium storing computer executable instructions executable The instructions are arranged to perform the method of any of the above-described first data playback device side.
  • a computer readable storage medium storing computer executable instructions, the computer executable instructions being arranged to perform the method of any of the above-described second data playback device side.
  • a UDP media data communication method includes:
  • the smart terminal sends an HTTP connection request to the set top box according to the CPU performance information matching the corresponding encoder setting parameter, where the HTTP connection request includes the network buffer length and the encoder setting parameter of the smart terminal;
  • a UDP media data communication method includes:
  • media data encoded by the encoder is buffered to a buffer by a DLNA application, and when the media data length of the buffer is greater than or equal to the length of the network buffer, the read length from the buffer is less than each time. Or a media data block equal to the length of the network buffer;
  • a UDP media data communication device configured in a set top box, includes:
  • connection request receiving unit configured to receive an HTTP connection request sent by the smart terminal, where the HTTP connection request includes a network buffer length and an encoder setting parameter of the smart terminal;
  • An encoder activation unit configured to set and start an encoder according to the encoder setting parameter
  • a media data block reading unit configured to buffer the media data encoded by the encoder into a buffer by using a DLNA application, and when the media data length of the buffer is greater than or equal to the length of the network buffer, each time Reading, in the buffer, a media data block whose length is less than or equal to the length of the network buffer;
  • a media data block sending unit sending the media data block to the smart terminal
  • the media data block sending unit includes:
  • the data sending thread starts the unit and is set to start the data sending thread.
  • a UDP media data communication system comprising the set top box, the smart terminal and the WiFi device as described above, wherein the set top box and the smart terminal are both connected to the WiFi device,
  • the smart terminal sends an HTTP connection request to the set top box according to the CPU performance information matching the corresponding encoder setting parameter, where the HTTP connection request includes a network buffer length and an encoder setting parameter of the smart terminal;
  • This embodiment also provides a set top box including at least one processor
  • a memory communicatively coupled to the at least one processor
  • the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to perform the method of the set top box side of any of the above.
  • the sending mechanism of the media data of the set top box is determined, and the problem that the UDP media data transmission is lost due to the configuration difference of the smart terminal is avoided, and the media data is uniformly transmitted, and the smart terminal is smooth and smooth. Playing live programs provides protection and user experience is good.
  • FIG. 1 is a flowchart of a method for an embodiment of a data communication method according to this embodiment.
  • FIG. 2 is a flowchart of a method of a first embodiment of a UDP media data communication method according to this embodiment.
  • FIG. 3 is a flowchart of a method of a second embodiment of a UDP media data communication method according to this embodiment.
  • FIG. 4 is a flowchart of a method of a third embodiment of a UDP media data communication method according to this embodiment.
  • FIG. 5 is a flowchart of a method of a fourth embodiment of a UDP media data communication method according to this embodiment.
  • FIG. 6 is a structural block diagram of a first embodiment of a UDP media data communication apparatus according to this embodiment.
  • FIG. 7 is a structural block diagram of a second embodiment of a UDP media data communication apparatus according to this embodiment.
  • FIG. 8 is a structural block diagram of a set top box according to this embodiment.
  • FIG. 9 is a schematic diagram of a system of a UDP media data communication system according to this embodiment.
  • FIG. 10 is still another structural block diagram of the set top box provided by this embodiment.
  • FIG. 1 is a flowchart of a method for an embodiment of a data communication method according to this embodiment.
  • the method of the embodiment of the data communication method provided in this embodiment may be performed by a first data playing device and a second data playing device, where the first data playing device is configured with an encoder, and the first data.
  • the playback device is connected to the second data playback device by using a DLNA protocol, and the second data playback device is configured with a decoder, and the method includes:
  • the second data playback device transmits a data buffer capacity of the second data playback device and a code rate and resolution of the decoder to the first data playback device based on the DLNA protocol.
  • the first data playback device receives the data buffer capacity and a code rate and resolution of the decoder based on a DLNA protocol.
  • the first data playback device configures and starts the encoder according to the code rate and the resolution.
  • the first data playing device buffers data output by the encoder, and reads a data block whose capacity is less than or equal to the capacity of the network buffer.
  • the first data playback device sends the data block to the second data playback device based on a DLNA protocol.
  • the second data playing device receives the data block sent by the first data playing device based on a DLNA protocol.
  • the data block is composed of data output by the encoder and has a capacity less than or equal to the network buffer capacity.
  • FIG. 2 is a flowchart of a method of a first embodiment of a UDP media data communication method according to this embodiment.
  • the UDP media data communication method includes:
  • the smart terminal sends an HTTP (Hyper Text Transfer Protocol) connection request to the set top box according to the built-in CPU performance matching encoder setting parameter, where the HTTP connection request includes the network buffer length of the smart terminal. And encoder settings parameters.
  • HTTP Hyper Text Transfer Protocol
  • the encoder setting parameters include a code rate and a resolution.
  • the set-top box and the smart terminal are connected to the same WiFi device, and the smart terminal obtains the media data of the set-top box through the DLNA protocol, and the media data includes a live program list, which is a media service resource that the set-top box can provide.
  • the intelligent terminal acquires information about the built-in CPU performance and the length of the network buffer. According to different Smart terminal CPU performance, set different resolution, code rate. As shown in Table 1:
  • Table 1 Resolution and code rate corresponding to smart terminal CPU performance
  • Table 1 is only for example.
  • the resolution and the code rate corresponding to the configuration information of the smart terminal can be smoothly played in a video within a preset range surrounding the set value.
  • the code rate is the encoding rate of the encoder required by the intelligent terminal.
  • the configuration information of the smart terminal may be a core number including a CPU.
  • the smart terminal (such as a mobile phone, a tablet computer, etc.) is realized by decoding the video software when playing the video, so the parameters of the smart terminal CPU may affect the decoding effect, that is, whether the resolution and the code rate of the specified range can be smoothly decoded. For example, if the dual-core CPU is to be smoothly decoded, the resolution of the encoded video is required to be 720*576 at the maximum, and the maximum code rate is 1M (megabytes).
  • the form of the HTTP connection request is as follows:
  • HTTP://192.168.6.83:8080/mediaService.play is the set-top box device address
  • type is the media data encapsulation format sent by the requesting set-top box device
  • venc and aenc are the encoding format of audio and video
  • resolution is resolution
  • bitrate is code Rate
  • procotol is the network protocol for media data transmission, generally udp or tcp
  • buff is the length of the network card buffer for the intelligent terminal to receive network data
  • business is the type of service requested, divided into DVB live broadcast and mirror screen (set-top box screen projected to smart Terminal) two.
  • the set top box receives the HTTP connection request, sets and starts an encoder according to the encoder setting parameter, and buffers the encoder encoded media data into a buffer through a DLNA application, when the buffer media
  • the media data block is sent to the smart terminal.
  • the buffer is a ring buffer, and a thread that sends media data to the smart terminal is opened.
  • Sending the media data block to the smart terminal including:
  • T The sleep time T after the data sending thread sends the media data block every time
  • the set top box sends the encoded media data to the DLNA application, and the DLNA application buffers the media data into a ring buffer, and the thread continuously reads and transmits the media data from the ring buffer.
  • the UDP media data communication method provided by the embodiment provides an HTTP connection request to the set top box according to the CPU performance information matching the corresponding encoder setting parameter, where the HTTP connection request includes the network buffer length and the encoder setting of the smart terminal.
  • the set-top box sets and starts the encoder according to the encoder setting parameter sent by the intelligent terminal, and determines the length of the sent media data block according to the length of the network buffer, and determines the set-top box according to the performance of the current intelligent terminal through the interaction between the intelligent terminal and the set-top box.
  • the transmission mechanism of the media data avoids the problem of loss of UDP media data transmission due to the configuration difference of the smart terminal, and realizes the uniform transmission of the media data, which provides a guarantee for the smooth and smooth playing of the live program of the intelligent terminal, and the user experience is good.
  • FIG. 3 is a flowchart of a method of a second embodiment of a UDP media data communication method according to this embodiment.
  • the UDP media data communication method includes:
  • the smart terminal sends an HTTP connection request to the set top box according to the CPU performance information matching the corresponding encoder setting parameter, where the HTTP connection request includes the network buffer length and the encoder setting parameter of the smart terminal.
  • the set top box receives the HTTP connection request, sets and starts an encoder according to the encoder setting parameter, and buffers the encoder encoded media data into a buffer through a DLNA application, when the buffer media
  • the media data block is sent to the smart terminal.
  • the set top box detects the HTTP connection status, and if the HTTP connection is disconnected, the encoder stops working.
  • steps S201 and S202 refer to the method shown in FIG. 2, and details are not described herein again.
  • the UDP media data communication method provided in this embodiment and the method shown in FIG. 2 in addition to the interaction between the smart terminal and the set top box, determine the transmission mechanism of the set top box media data according to the performance of the current smart terminal, thereby avoiding the configuration difference of the smart terminal.
  • the problem of losing the transmission of UDP media data enables the uniform transmission of the media data, which provides a guarantee for the smooth and smooth playback of the live program by the intelligent terminal.
  • the connection state of the set top box is stopped by using the HTTP connection state. Real-time performance is simple, convenient, and maximizes the use of resources.
  • FIG. 4 is a flowchart of a method of a third embodiment of a UDP media data communication method according to this embodiment.
  • the UDP media data communication method is applied to a set top box, and includes:
  • an HTTP connection request sent by the smart terminal is received, where the HTTP connection request includes a network buffer length and an encoder setting parameter of the smart terminal.
  • the encoder setting parameters include a code rate and a resolution.
  • the set-top box and the smart terminal are connected to the same WiFi device, and the smart terminal obtains the media data of the set-top box through the DLNA protocol, and the media data includes a live program list, which is a media service resource that the set-top box can provide.
  • the intelligent terminal obtains its CPU performance information and network buffer length information. Different resolutions and code rates are set in advance according to different smart terminal CPU performance.
  • the code rate is the encoding rate of the encoder required by the intelligent terminal.
  • the form of the HTTP connection request is as follows:
  • HTTP://192.168.6.83:8080/mediaService.play is the set-top box device address
  • type is the media data encapsulation format sent by the requesting set-top box device
  • venc and aenc are the encoding format of audio and video
  • resolution is resolution
  • bitrate is code Rate
  • procotol is the network protocol for media data transmission, generally udp or tcp
  • buff is the length of the network card buffer for the intelligent terminal to receive network data
  • business is the type of service requested, divided into DVB live broadcast and mirror screen (set-top box screen projected to smart Terminal) two.
  • the encoder is set and started according to the encoder setting parameters.
  • the media data encoded by the encoder is buffered to a buffer by a DLNA application, and when the media data length of the buffer is greater than or equal to the length of the network buffer, each time from the buffer A media data block whose length is less than or equal to the length of the network buffer is read.
  • the media data length of the selected buffer is the same as the length of the network buffer.
  • the length of the media data taken from the encoder is the same each time.
  • the data frame sent each time is equal to the network buffer length of the smart terminal. It realizes that the set-top box can send media data at a uniform speed, which is also good for the loss of media data and rational utilization of resources.
  • the media data block is sent to the smart terminal.
  • T The sleep time T after the data sending thread sends the media data block every time
  • the UDP media data communication method provided by the embodiment sets the set-top box according to the encoder setting parameter sent by the intelligent terminal, and starts the encoder, and determines the length of the sent media data block according to the network buffer length, and the interaction between the set-top box and the intelligent terminal is
  • the performance of the current intelligent terminal determines the transmission mechanism of the set-top box media data, avoids the problem of UDP media data transmission loss due to the configuration difference of the smart terminal, realizes the uniform transmission of the media data, and provides the smooth and smooth broadcast of the live program for the intelligent terminal.
  • the guarantee is good and the user experience is good.
  • FIG. 5 is a flowchart of a method of a fourth embodiment of a UDP media data communication method according to this embodiment.
  • the UDP media data communication method is applied to a set top box, and includes:
  • an HTTP connection request sent by the smart terminal is received, where the HTTP connection request includes a network buffer length and an encoder setting parameter of the smart terminal.
  • the encoder is set and started according to the encoder setting parameters.
  • media data encoded by the encoder is buffered to a buffer by a DLNA application, and when the media data length of the buffer is greater than or equal to the length of the network buffer, each time from the buffer A media data block whose length is less than or equal to the length of the network buffer is read.
  • the media data block is sent to the smart terminal.
  • steps S401, S402, S403, and S404 refer to the method shown in FIG. 4, and details are not described herein again.
  • the problem of losing the transmission of UDP media data enables the uniform transmission of the media data, which provides a guarantee for the smooth and smooth playback of the live program by the intelligent terminal.
  • the connection state of the set top box is stopped by using the HTTP connection state. Real-time performance is simple, convenient, and maximizes the use of resources.
  • FIG. 6 is a structural block diagram of a first embodiment of a UDP media data communication apparatus according to this embodiment.
  • the UDP media data communication device is configured in a set top box, and includes:
  • the connection request receiving unit 100 is configured to receive an HTTP connection request sent by the smart terminal, where the HTTP connection request includes a network buffer length and an encoder setting parameter of the smart terminal;
  • the encoder activation unit 110 is configured to set and start an encoder according to the encoder setting parameters; the encoder setting parameters include a code rate and a resolution.
  • the media data block reading unit 120 is configured to buffer the media data encoded by the encoder into a buffer by using a DLNA application, and when the media data length of the buffer is greater than or equal to the length of the network buffer, each time A media data block having a length less than or equal to the length of the network buffer is read from the buffer.
  • the media data block sending unit 130 sends the media data block to the smart terminal.
  • the media data block sending unit 130 includes:
  • the data sending thread starting unit 131 is configured to start a data sending thread
  • the set-top box of the UDP media data communication device sets and starts the encoder according to the encoder setting parameter sent by the smart terminal, and determines the length of the sent media data block according to the length of the network buffer, and the interaction between the set-top box and the smart terminal is
  • the performance of the current intelligent terminal determines the transmission mechanism of the set-top box media data, avoids the problem of UDP media data transmission loss due to the configuration difference of the smart terminal, realizes the uniform transmission of the media data, and provides the smooth and smooth broadcast of the live program for the intelligent terminal.
  • the guarantee is good and the user experience is good.
  • FIG. 7 is a structural block diagram of a second embodiment of a UDP media data communication apparatus according to this embodiment.
  • the UDP media data communication device is configured in a set top box, which is different from the device shown in FIG. 5 in that it further includes:
  • the connection state detecting unit 140 is configured to detect an HTTP connection state, and if the HTTP connection is disconnected, the encoder stops operating.
  • the UDP media data communication device provided in this embodiment has the advantages of the device shown in FIG. 6, and also uses the HTTP connection state to control whether the service of the set top box is stopped, has good real-time performance, is simple and convenient, and utilizes resources to the greatest extent.
  • FIG. 8 is a structural block diagram of a set top box according to this embodiment.
  • the set top box 1 includes the UDP media data communication device 10 described above.
  • the set-top box 1 determines the sending mechanism of the media data of the set-top box according to the performance of the current smart terminal, and avoids the problem that the UDP media data is lost due to the configuration difference of the smart terminal, and realizes the uniform transmission of the media data. It provides a guarantee for the smooth and smooth playback of live programs of smart terminals, and the user experience is good.
  • FIG. 9 is a schematic diagram of a system of a UDP media data communication system according to this embodiment.
  • the UDP media data communication system includes the set top box 1, the smart terminal 2, and the WiFi device 3, and the set top box 1 and the smart terminal 2 are both connected to the WiFi device 3.
  • the smart terminal 2 sends an HTTP connection request to the set top box 1 according to the CPU performance information matching the corresponding encoder setting parameter, where the HTTP connection request includes the network buffer length and the encoder setting parameter of the smart terminal;
  • the set top box 1 receives the HTTP connection request, sets and starts an encoder according to the encoder setting parameter, and buffers the media data encoded by the encoder into a buffer through a DLNA application, when the media data of the buffer When the length is greater than or equal to the length of the network buffer, each time a media data block whose length is less than or equal to the length of the network buffer is read from the buffer, the media data block is sent to the smart terminal 2.
  • the UDP media data communication system determines the sending mechanism of the media data of the set top box according to the performance of the current smart terminal through the interaction between the smart terminal and the set top box, and avoids the loss of the UDP media data transmission due to the configuration difference of the smart terminal.
  • the problem is that the media data is sent at a uniform speed, which provides a guarantee for the smooth and smooth playing of the live program of the smart terminal, and the user experience is good.
  • the embodiment further provides a computer readable storage medium storing computer executable instructions for executing the UDP media data communication method described in the foregoing embodiments.
  • FIG. 10 is a block diagram showing another structure of the set top box according to the embodiment.
  • the set top box provided in this embodiment may include a processor 1001 and a memory 1003, and may further include a communication interface 1002, a bus 1004, a UDP media data communication device 1005, a wireless connection circuit 1006, and a code. 1007.
  • the processor 1001, the communication interface 1002, and the memory 1003 can complete communication with each other through the bus 1004.
  • Communication interface 1002 can be used for information transfer.
  • the processor 1001 can call the logic instructions in the memory 1003 to perform the UDP media data communication method of the above embodiment.
  • the wireless connection circuit can be a WIFI module.
  • the encoder 1007 is for encoding media data.
  • the logic instructions in the memory 1003 described above may be implemented in the form of a software functional unit and sold or used as a stand-alone product, and may be stored in a computer readable storage medium.
  • the technical solution of the embodiment may be embodied in the form of a software product stored in a storage medium, including a plurality of instructions for causing a computer device (which may be a personal computer, a server, or The network device or the like) performs all or part of the steps of the method described in the various embodiments of the present embodiment.
  • the foregoing storage medium may be a non-transitory storage medium, including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • a medium that can store program code, or a transitory storage medium including: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
  • the UDP media data communication method provided in this embodiment determines the sending mechanism of the set top box media data according to the performance of the current smart terminal, thereby avoiding the problem that the UDP media data transmission is lost due to the configuration difference of the smart terminal, and the uniform transmission media is realized.
  • the data provides a guarantee for the smooth and smooth playing of the live program of the smart terminal, and the user experience is good.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Databases & Information Systems (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

一种数据发送方法,应用于第一数据播放设备,所述第一数据播放设备配置有编码器,所述第一数据播放设备通过DLNA协议与第二数据播放设备连接,所述第二数据播放设备配置有解码器,所述方法包括:基于DLNA协议,接收所述第二数据播放设备发送的第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率;根据所述码率和所述分辨率,配置并启动所述编码器;缓存所述编码器输出的数据;读取容量小于或等于所述网络缓冲区容量的数据块;以及基于DLNA协议,发送所述数据块至所述第二数据播放设备。

Description

数据发送方法、数据接收方法及其装置和系统 技术领域
本公开涉及计算机通信技术领域,例如涉及一种数据发送方法、数据接收方法及其装置和系统。
背景技术
随着数字生活网络联盟(DIGITAL LIVING NETWORKALLIANCE,DLNA)技术的发展,使得数字媒体和内容服务的无限制的共享和增长成为可能。利用DLNA标准,我们可以把手机和客厅的机顶盒设备连到同一个WiFi局域网中,实现把整个机顶盒的屏幕投放到手机上,以及使用手机观看电视上的数字视频广播(Digital Video Broadcasting,DVB)直播节目。这样,无论我们是在卧室或卫生间等均可以控制机顶盒,以及收看电视上的DVB直播节目。对于机顶盒的屏幕投放到手机屏幕上以及收看电视上的DVB直播节目的这种应用场景,基于对实时性要求很高的场景下,一般我们优先选择用户数据报协议(User Datagram Protocol,UDP)协议作为传输方式,UDP协议是TCP/IP协议栈的一个子集,属于传输层的协议,具有同为TCP/IP传输层协议的TCP协议所望尘莫及的速度优势。然而,由于不同机顶盒芯片厂商对于编码器处理数据的速度以及帧缓冲大小没有统一的标准,这就导致在一些平台上,由于编码器突发大量数据,在DLNA获得媒体数据后通过UDP协议进行数据传输时,引起网络流量突然增大。在网络流量突然增长时,由于带宽或者中转设备的限制而出现终端设备接收网络数据丢失的问题,继而影响到用户的体验。因此,如何解决由于网络流量突然增加时,终端设备接收直播源数据不丢失的技术问题,实现平滑顺畅播放直播节目,显得异常重要。
发明内容
本公开提供一种数据发送方法、数据接收方法及其装置和系统,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好。
本公开采用以下技术方案:
一种数据发送方法,应用于第一数据播放设备,所述第一数据播放设备配 置有编码器,所述第一数据播放设备通过DLNA协议与第二数据播放设备连接,所述第二数据播放设备配置有解码器,所述方法包括:
基于DLNA协议,接收所述第二数据播放设备发送的第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率;
根据所述码率和所述分辨率,配置并启动所述编码器;
缓存所述编码器输出的数据;
读取容量小于或等于所述网络缓冲区容量的数据块;以及
基于DLNA协议,发送所述数据块至所述第二数据播放设备。
可选的,所述发送所述数据块至所述第二数据播放设备的步骤包括:
启动数据发送线程;
所述数据发送线程包括,每次发送完所述数据块后,休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
可选的,所述启动所述编码器的步骤之后,还包括:
检测所述连接的状态;以及
如果所述状态为断开,关闭所述编码器。
可选的,所述解码器的码率和分辨率与所述第二数据播放设备的中央处理器CPU性能匹配。
一种数据接收方法,应用于第二数据播放设备,所述第一数据播放设备配置有编码器,所述第一数据播放设备通过DLNA协议与第二数据播放设备连接,所述第二数据播放设备配置有解码器,所述方法包括:
基于DLNA协议,发送所述第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率至第一数据播放设备,以便于所述第一数据播放设备根据所述码率和所述分辨率,配置并启动所述编码器;以及
基于DLNA协议,接收所述第一数据播放设备发送的所述数据块,所述数据块由所述编码器输出的数据构成且容量小于或等于所述网络缓冲区容量。
可选的,接收所述第一数据播放设备发送的所述数据块的步骤包括:
通过数据发送线程接收所述第一数据播放设备发送的所述数据块;以及
所述数据发送线程包括,每次发送完所述数据块后,休眠时间T,所述时间 T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
可选的,所述解码器的码率和分辨率与所述第二数据播放设备的中央处理器CPU性能匹配。
一种数据发送装置,配置于第一数据播放设备,包括:
配置参数接收单元,设置为基于DLNA协议,接收所述第二数据播放设备发送的第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率;
编码器启动单元,设置为根据所述码率和所述分辨率,配置并启动所述编码器;
数据缓存单元,设置为缓存所述编码器输出的数据;
数据块读取单元,设置为读取容量小于或等于所述网络缓冲区容量的数据块:以及
数据块发送单元,设置为基于DLNA协议,发送所述数据块至所述第二数据播放设备。
可选的,数据块发送单元包括:
数据发送线程启动子单元,设置为启动数据发送线程;
休眠子单元,设置为所述数据发送线程每次发送完媒体数据块后休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
可选的,还包括:
连接状态检测单元,设置为检测HTTP连接状态;以及
编码器控制单元,设置为如果所述状态为断开,关闭所述编码器。
可选的,所述解码器的码率和分辨率与所述第二数据播放设备的中央处理器CPU性能匹配。
一种数据接收装置,配置于第二数据播放设备,包括:
配置参数发送单元,设置为基于DLNA协议,发送所述第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率至第一数据播放设备,以便 于所述第一数据播放设备根据所述码率和所述分辨率,配置并启动所述编码器;以及
数据块接收单元,设置为基于DLNA协议,接收所述第一数据播放设备发送的所述数据块,所述数据块由所述编码器输出的数据构成且容量小于或等于所述网络缓冲区容量。
可选的,数据块接收单元包括:
数据块接收子单元,设置为通过数据发送线程接收所述第一数据播放设备发送的所述数据块;
休眠子单元,设置为每次发送完所述数据块后,休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
可选的,所述解码器的码率和分辨率与所述第二数据播放设备的中央处理器CPU性能匹配。
一种数据通信系统,包括第一数据播放设备、第二数据播放设备和WiFi设备,所述第一数据播放设备和第二数据播放设备均与所述WiFi设备连接,
所述第二数据播放设备基于DLNA协议,发送所述第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率至第一数据播放设备,
所述第一数据播放设备基于DLNA协议接收所述数据缓冲区容量以及所述解码器的码率和分辨率;
所述第一数据播放设备根据所述码率和所述分辨率,配置并启动所述编码器;
所述第一数据播放设备缓存所述编码器输出的数据,并读取容量小于或等于所述网络缓冲区容量的数据块;以及基于DLNA协议发送所述数据块至所述第二数据播放设备;以及
所述第二数据播放设备基于DLNA协议接收所述第一数据播放设备发送的所述数据块;
其中,所述数据块由所述编码器输出的数据构成且容量小于或等于所述网络缓冲区容量。
一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行 指令设置为执行权利要求上述第一数据播放设备侧的任一项所述的方法。
一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行权利要求上述第二数据播放设备侧的任一项所述的方法。
一种UDP媒体数据通信方法,包括:
智能终端根据其CPU性能信息匹配对应的编码器设置参数,向机顶盒发送HTTP连接请求,所述HTTP连接请求包括该智能终端的网络缓冲区长度和编码器设置参数;
机顶盒接收所述HTTP连接请求,根据所述编码器设置参数设置并启动编码器,将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块,将所述媒体数据块发送至智能终端。
一种UDP媒体数据通信方法,包括:
接收智能终端发送的HTTP连接请求,所述HTTP连接请求包括所述智能终端的网络缓冲区长度和编码器设置参数;
根据所述编码器设置参数设置并启动编码器;
将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块;
将所述媒体数据块发送至智能终端。
一种UDP媒体数据通信装置,配置于机顶盒,包括:
连接请求接收单元,设置为接收智能终端发送的HTTP连接请求,所述HTTP连接请求包括所述智能终端的网络缓冲区长度和编码器设置参数;
编码器启动单元,设置为根据所述编码器设置参数设置并启动编码器;
媒体数据块读取单元,设置为将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块;
媒体数据块发送单元,将所述媒体数据块发送至智能终端;
所述媒体数据块发送单元包括:
数据发送线程启动单元,设置为启动数据发送线程。
一种UDP媒体数据通信系统,包括如上述所述的机顶盒、智能终端和WiFi设备,所述机顶盒和智能终端均与所述WiFi设备连接,
所述智能终端根据其CPU性能信息匹配对应的编码器设置参数,向机顶盒发送HTTP连接请求,所述HTTP连接请求包括该智能终端的网络缓冲区长度和编码器设置参数;
所述机顶盒接收所述HTTP连接请求,根据所述编码器设置参数设置并启动编码器,将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块,将所述媒体数据块发送至智能终端。
本实施例还提供了一种机顶盒,包括至少一个处理器;以及
与所述至少一个处理器通信连接的存储器;
其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,执行如上述任一项机顶盒侧的所述的方法。
本实施例根据当前智能终端的性能,确定机顶盒媒体数据的发送机制,避免了因为智能终端的配置差异性而导致UDP媒体数据发送丢失的问题,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好。
附图概述
图1是本实施例提供的数据通信方法实施例的方法流程图。
图2是本实施例提供的UDP媒体数据通信方法第一个实施例的方法流程图。
图3是本实施例提供的UDP媒体数据通信方法第二个实施例的方法流程图。
图4是本实施例提供的UDP媒体数据通信方法第三个实施例的方法流程图。
图5是本实施例提供的UDP媒体数据通信方法第四个实施例的方法流程图。
图6是本实施例提供的UDP媒体数据通信装置第一个实施例的结构方框图。
图7是本实施例提供的UDP媒体数据通信装置第二个实施例的结构方框图。
图8是本实施例提供的机顶盒的结构框图。
图9是本实施例提供的UDP媒体数据通信系统的系统示意图。
图10是本实施例提供的机顶盒的又一结构框图。
具体实施方式
图1是本实施例提供的数据通信方法实施例的方法流程图。参见图1,本实施例提供的数据通信方法实施例的方法,可以是由第一数据播放设备和第二数据播放设备执行,所述第一数据播放设备配置有编码器,所述第一数据播放设备通过DLNA协议与第二数据播放设备连接,所述第二数据播放设备配置有解码器,该方法包括:
在S110,所述第二数据播放设备基于DLNA协议,发送所述第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率至第一数据播放设备。
在S120中,所述第一数据播放设备基于DLNA协议接收所述数据缓冲区容量以及所述解码器的码率和分辨率。
在S130中,所述第一数据播放设备根据所述码率和所述分辨率,配置并启动所述编码器。
在S140中,所述第一数据播放设备缓存所述编码器输出的数据,并读取容量小于或等于所述网络缓冲区容量的数据块。
在S150中,所述第一数据播放设备基于DLNA协议发送所述数据块至所述第二数据播放设备。
在S160中,所述第二数据播放设备基于DLNA协议接收所述第一数据播放设备发送的所述数据块。
其中,所述数据块由所述编码器输出的数据构成且容量小于或等于所述网络缓冲区容量。
图2是本实施例提供的UDP媒体数据通信方法第一个实施例的方法流程图。参考图2所示,该UDP媒体数据通信方法,包括:
在S110中,智能终端根据内置的CPU性能匹配的编码器设置参数,向机顶盒发送HTTP(Hyper Text Transfer Protocol,超文本传输协议)连接请求,所述HTTP连接请求包括该智能终端的网络缓冲区长度和编码器设置参数。
可选地,所述编码器设置参数包括码率和分辨率。
机顶盒和智能终端连接到同一个WiFi设备上,智能终端通过DLNA协议获得机顶盒的媒体数据,媒体数据包括直播节目列表,为机顶盒可以提供的媒体服务资源。
智能终端获取内置的CPU性能的信息和网络缓冲区长度。预先根据不同的 智能终端CPU性能,设置不同的分辨率,码率。如表1所示:
表1:智能终端CPU性能对应的分辨率和码率
核心数 分辨率 码率
单核 480*320 0.5M
双核 720*576 1M
大于四核 1280*720 2M
表1仅是作为举例说明,针对智能终端的配置信息对应的分辨率和码率在围绕上述设定值的一个预设范围内的视频都是可以实现流畅播放的。码率为智能终端要求编码器的编码速率。所述智能终端的配置信息可以是包括CPU的核数。基于智能终端(例如手机,平板电脑等)在播放视频时是通过对视频软件解码实现的,因此智能终端CPU的参数会影响到解码的效果,即是否可以流畅解码指定范围的分辨率和码率,比如双核CPU如果要流畅解码,则要求编码后的视频分辨率最大为720*576,码率最大为1M(兆)。
可选地,HTTP连接请求的形式如下:
HTTP://192.168.6.83:8080/mediaService.play?type=ts,venc=h264,aenc=aac,resolution=1280*720,bitrate=3145728,procotol=udp,buff=1024,business=mediaplay,channid=1?udp://@192.168.6.80:1234
其中,HTTP://192.168.6.83:8080/mediaService.play为机顶盒设备地址,type为请求机顶盒设备发送的媒体数据封装格式;venc和aenc为音视频的编码格式;resolution为分辨率;bitrate为码率;procotol为媒体数据发送的网络协议,一般为udp或tcp;buff为智能终端接收网络数据的网卡缓冲区长度;business为请求的业务类型,分为DVB直播和镜屏(机顶盒屏幕投射到智能终端)两种。Channid为节目号;当business=mediaplay时有效。udp://@192.168.6.80:1234为智能终端要接收数据的地址和端口号,当procotol=udp时,该字段有效。
在S120中,机顶盒接收所述HTTP连接请求,根据所述编码器设置参数设置并启动编码器,将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块,将所述媒体数据块发送至智能终端。
所述缓冲区为环形缓冲区,开辟向智能终端发送媒体数据的线程。
将所述媒体数据块发送至智能终端,包括:
启动数据发送线程;
所述数据发送线程每次发送完媒体数据块后休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
在其他实施例中,M值可以根据实际情况调整,当M=2时,表示发送速度是播放码率的二倍,M值应当大于1,以确保由于网络延时等因素,导致发送速度赶不上播放速度,进而导致视频卡顿。
机顶盒将编码完成的媒体数据发送给DLNA应用程序,DLNA应用程序将媒体数据缓冲到环形缓冲区,线程不断地从环形缓冲区中读取并发送媒体数据。
本实施例提供的UDP媒体数据通信方法智能终端根据其CPU性能信息匹配对应的编码器设置参数,向机顶盒发送HTTP连接请求,所述HTTP连接请求包括该智能终端的网络缓冲区长度和编码器设置参数,机顶盒根据智能终端发送的编码器设置参数设置并启动编码器,并根据网络缓冲区长度确定发送的媒体数据块的长度,通过智能终端和机顶盒的交互,根据当前智能终端的性能,确定机顶盒媒体数据的发送机制,避免了因为智能终端的配置差异性而导致UDP媒体数据发送丢失的问题,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好。
图3是本实施例提供的UDP媒体数据通信方法第二个实施例的方法流程图。参考图3所示,该UDP媒体数据通信方法,包括:
在S201中,智能终端根据其CPU性能信息匹配对应的编码器设置参数,向机顶盒发送HTTP连接请求,所述HTTP连接请求包括该智能终端的网络缓冲区长度和编码器设置参数。
在S202中,机顶盒接收所述HTTP连接请求,根据所述编码器设置参数设置并启动编码器,将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块,将所述媒体数据块发送至智能终端。
在S203中,机顶盒检测HTTP连接状态,如果所述HTTP连接断开,编码器停止工作。
HTTP连接断开的原因有多种,比如用户关闭智能终端的直播以及网络不稳定导致断开等。
可选地,在停止编码器工作的同时,销毁环形缓冲区,避免机顶盒内存泄漏。
步骤S201和S202的详细内容参考图2所示的方法,这里不再赘述。
本实施例提供的UDP媒体数据通信方法与图2所示方法,除了通过智能终端和机顶盒的交互,根据当前智能终端的性能,确定机顶盒媒体数据的发送机制,避免了因为智能终端的配置差异性而导致UDP媒体数据发送丢失的问题,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好之外,还利用HTTP得连接状态控制机顶盒的服务是否停止,实时性好,简单方便,最大程度的利用了资源。
图4是本实施例提供的UDP媒体数据通信方法第三个实施例的方法流程图。参考图4所示,该UDP媒体数据通信方法应用于机顶盒端,包括:
在S301中,接收智能终端发送的HTTP连接请求,所述HTTP连接请求包括所述智能终端的网络缓冲区长度和编码器设置参数。
可选地,所述编码器设置参数包括码率和分辨率。
机顶盒和智能终端连接到同一个WiFi设备上,智能终端通过DLNA协议获得机顶盒的媒体数据,媒体数据包括直播节目列表,为机顶盒可以提供的媒体服务资源。
智能终端获取其CPU性能信息和网络缓冲区长度信息。预先根据不同的智能终端CPU性能,设置不同的分辨率,码率。码率为智能终端要求编码器的编码速率。
可选地,HTTP连接请求的形式如下:
HTTP://192.168.6.83:8080/mediaService.play?type=ts,venc=h264,aenc=aac,resolution=1280*720,bitrate=3145728,procotol=udp,buff=1024,business=mediaplay,channid=1?udp://@192.168.6.80:1234
其中,HTTP://192.168.6.83:8080/mediaService.play为机顶盒设备地址,type为请求机顶盒设备发送的媒体数据封装格式;venc和aenc为音视频的编码格式;resolution为分辨率;bitrate为码率;procotol为媒体数据发送的网络协议,一般为udp或tcp;buff为智能终端接收网络数据的网卡缓冲区长度;business为请求的业务类型,分为DVB直播和镜屏(机顶盒屏幕投射到智能终端)两种。 Channid为节目号;当business=mediaplay时有效。udp://@192.168.6.80:1234为智能终端要接收数据的地址和端口号,当procotol=udp时,该字段有效。
在S302中,根据所述编码器设置参数设置并启动编码器。
在S303中,将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块。
通常选取的缓冲区的媒体数据长度与网络缓冲区长度相同,每次从编码器取出的媒体数据长度相同,在进行网络发送时,每次发送的数据帧等于智能终端的网络缓冲区长度,这样实现了机顶盒匀速发送媒体数据,也不错造成媒体数据丢失,合理利用了资源。
在S304中,将所述媒体数据块发送至智能终端。
启动数据发送线程;
所述数据发送线程每次发送完媒体数据块后休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
在其他实施例中,M值可以根据实际情况调整,当M=2时,表示发送速度是播放码率的二倍,M值应当大于1,以确保由于网络延时等因素,导致发送速度赶不上播放速度,进而导致视频卡顿。
本实施例提供的UDP媒体数据通信方法机顶盒根据智能终端发送的编码器设置参数设置并启动编码器,并根据网络缓冲区长度确定发送的媒体数据块的长度,通过机顶盒和智能终端的交互,根据当前智能终端的性能,确定机顶盒媒体数据的发送机制,避免了因为智能终端的配置差异性而导致UDP媒体数据发送丢失的问题,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好。
图5是本实施例提供的UDP媒体数据通信方法第四个实施例的方法流程图。参考图5所示,该UDP媒体数据通信方法应用于机顶盒端,包括:
在S401中,接收智能终端发送的HTTP连接请求,所述HTTP连接请求包括所述智能终端的网络缓冲区长度和编码器设置参数。
在S402中,根据所述编码器设置参数设置并启动编码器。
在S403中,将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块。
在S404中,将所述媒体数据块发送至智能终端。
在S405中,检测HTTP连接状态,如果所述HTTP连接断开,编码器停止工作。
HTTP连接断开的原因有多种,比如用户关闭智能终端的直播以及网络不稳定导致断开等。
可选地,在停止编码器工作的同时,销毁环形缓冲区,避免机顶盒内存泄漏。
步骤S401、S402、S403及S404的详细内容请参考图4所示的方法,这里不再赘述。
本实施例提供的UDP媒体数据通信方法与图4所示方法,除了通过智能终端和机顶盒的交互,根据当前智能终端的性能,确定机顶盒媒体数据的发送机制,避免了因为智能终端的配置差异性而导致UDP媒体数据发送丢失的问题,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好之外,还利用HTTP得连接状态控制机顶盒的服务是否停止,实时性好,简单方便,最大程度的利用了资源。
图6是本实施例提供的UDP媒体数据通信装置第一个实施例的结构方框图。参考图6所示,该UDP媒体数据通信装置配置于机顶盒,包括:
连接请求接收单元100,设置为接收智能终端发送的HTTP连接请求,所述HTTP连接请求包括所述智能终端的网络缓冲区长度和编码器设置参数;
编码器启动单元110,设置为根据所述编码器设置参数设置并启动编码器;编码器设置参数包括码率和分辨率。
媒体数据块读取单元120,设置为将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块。
媒体数据块发送单元130,将所述媒体数据块发送至智能终端。
可选地,一些实施例中,所述媒体数据块发送单元130包括:
数据发送线程启动单元131,设置为启动数据发送线程;
休眠单元132,设置为所述数据发送线程每次发送完媒体数据块后休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
在其他实施例中,M值可以根据实际情况调整,当M=2时,表示发送速度是播放码率的二倍,M值应当大于1,以确保由于网络延时等因素,导致发送速度赶不上播放速度,进而导致视频卡顿。
本装置的详细内容请参考图4所示方法的相关内容,这里不再赘述。
本实施例提供的UDP媒体数据通信装置机顶盒根据智能终端发送的编码器设置参数设置并启动编码器,并根据网络缓冲区长度确定发送的媒体数据块的长度,通过机顶盒和智能终端的交互,根据当前智能终端的性能,确定机顶盒媒体数据的发送机制,避免了因为智能终端的配置差异性而导致UDP媒体数据发送丢失的问题,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好。
图7是本实施例提供的UDP媒体数据通信装置第二个实施例的结构方框图。参考图7所示,该UDP媒体数据通信装置配置于机顶盒,其与图5所示装置的不同之处在于,还包括:
连接状态检测单元140,设置为检测HTTP连接状态,如果所述HTTP连接断开,编码器停止工作。
本实施例提供的UDP媒体数据通信装置在具有图6所示装置的优点的同时,还利用HTTP得连接状态控制机顶盒的服务是否停止,实时性好,简单方便,最大程度的利用了资源。
图8是本实施例提供的机顶盒的结构框图。参考图8所示,该机顶盒1包括上述所述的UDP媒体数据通信装置10。该机顶盒1通过和智能终端的交互,根据当前智能终端的性能,确定机顶盒媒体数据的发送机制,避免了因为智能终端的配置差异性而导致UDP媒体数据发送丢失的问题,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好。
图9是本实施例提供的UDP媒体数据通信系统的系统示意图。参考图9所示,该UDP媒体数据通信系统包括上述所述的机顶盒1、智能终端2和WiFi设备3,所述机顶盒1和智能终端2均与所述WiFi设备3连接,
所述智能终端2根据其CPU性能信息匹配对应的编码器设置参数,向机顶盒1发送HTTP连接请求,所述HTTP连接请求包括该智能终端的网络缓冲区长度和编码器设置参数;
所述机顶盒1接收所述HTTP连接请求,根据所述编码器设置参数设置并启动编码器,将所述编码器编码完成的媒体数据通过DLNA应用缓冲至缓冲区,当所述缓冲区的媒体数据长度大于或等于所述网络缓冲区长度时,每次从所述缓冲区中读取长度小于或等于所述网络缓冲区长度的媒体数据块,将所述媒体数据块发送至智能终端2。
本实施例提供的UDP媒体数据通信系统通过智能终端和机顶盒的交互,根据当前智能终端的性能,确定机顶盒媒体数据的发送机制,避免了因为智能终端的配置差异性而导致UDP媒体数据发送丢失的问题,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好。
本实施例还提供了一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行上述实施例所述的UDP媒体数据通信方法。
图10为本实施例提供的机顶盒的又一结构框图。本实施例提供的机顶盒可以是包括:处理器(processor)1001和存储器(memory)1003,还可以包括通信接口(Communications Interface)1002、总线1004、UDP媒体数据通信装置1005、无线连接电路1006以及编码器1007。其中,处理器1001、通信接口1002、存储器1003可以通过总线1004完成相互间的通信。通信接口1002可以用于信息传输。处理器1001可以调用存储器1003中的逻辑指令,以执行上述实施例的UDP媒体数据通信方法。所述无线连接电路可以是WIFI模块。所述编码器1007用于对媒体数据进行编码。
此外,上述的存储器1003中的逻辑指令可以通过软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本实施例的技术方案可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本实施例各个实施例所述方法的全部或部分步骤。而前述的存储介质可以是非暂态存储介质,包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质,也可以是暂态存储介质。
工业实用性
本实施例提供的UDP媒体数据通信方法,根据当前智能终端的性能,确定机顶盒媒体数据的发送机制,避免了因为智能终端的配置差异性而导致UDP媒体数据发送丢失的问题,实现了匀速发送媒体数据,为智能终端流畅平滑的播放直播节目提供了保障,用户体验效果好。

Claims (17)

  1. 一种数据发送方法,应用于第一数据播放设备,所述第一数据播放设备配置有编码器,所述第一数据播放设备通过DLNA协议与第二数据播放设备连接,所述第二数据播放设备配置有解码器,所述方法包括:
    基于DLNA协议,接收所述第二数据播放设备发送的第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率;
    根据所述码率和所述分辨率,配置并启动所述编码器;
    缓存所述编码器输出的数据;
    读取容量小于或等于所述网络缓冲区容量的数据块;以及
    基于DLNA协议,发送所述数据块至所述第二数据播放设备。
  2. 根据权利要求1所述的方法,其中,所述发送所述数据块至所述第二数据播放设备的步骤包括:
    启动数据发送线程;
    所述数据发送线程包括,每次发送完所述数据块后,休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
  3. 根据权利要求1所述的方法,其中,所述启动所述编码器的步骤之后,还包括:
    检测所述连接的状态;以及
    如果所述状态为断开,关闭所述编码器。
  4. 根据权利要求1所述的方法,其中,所述解码器的码率和分辨率与所述第二数据播放设备的中央处理器CPU性能匹配。
  5. 一种数据接收方法,应用于第二数据播放设备,所述第一数据播放设备配置有编码器,所述第一数据播放设备通过DLNA协议与第二数据播放设备连接,所述第二数据播放设备配置有解码器,所述方法包括:
    基于DLNA协议,发送所述第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率至第一数据播放设备,以便于所述第一数据播放设备根据所述码率和所述分辨率,配置并启动所述编码器;以及
    基于DLNA协议,接收所述第一数据播放设备发送的所述数据块,所述数据块由所述编码器输出的数据构成且容量小于或等于所述网络缓冲区容量。
  6. 根据权利要求5所述的方法,其中,接收所述第一数据播放设备发送的所述数据块的步骤包括:
    通过数据发送线程接收所述第一数据播放设备发送的所述数据块;以及
    所述数据发送线程包括,每次发送完所述数据块后,休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
  7. 根据权利要求5所述的方法,其中,所述解码器的码率和分辨率与所述第二数据播放设备的中央处理器CPU性能匹配。
  8. 一种数据发送装置,配置于第一数据播放设备,包括:
    配置参数接收单元,设置为基于DLNA协议,接收所述第二数据播放设备发送的第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率;
    编码器启动单元,设置为根据所述码率和所述分辨率,配置并启动所述编码器;
    数据缓存单元,设置为缓存所述编码器输出的数据;
    数据块读取单元,设置为读取容量小于或等于所述网络缓冲区容量的数据块;以及
    数据块发送单元,设置为基于DLNA协议,发送所述数据块至所述第二数据播放设备。
  9. 根据权利要求8所述的装置,其中,
    数据块发送单元包括:
    数据发送线程启动子单元,设置为启动数据发送线程;
    休眠子单元,设置为所述数据发送线程每次发送完媒体数据块后休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
  10. 据权利要求8所述的装置,还包括:
    连接状态检测单元,设置为检测HTTP连接状态;以及
    编码器控制单元,设置为如果所述状态为断开,关闭所述编码器。
  11. 根据权利要求8所述的装置,其中,所述解码器的码率和分辨率与所述第二数据播放设备的中央处理器CPU性能匹配。
  12. 一种数据接收装置,配置于第二数据播放设备,包括:
    配置参数发送单元,设置为基于DLNA协议,发送所述第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率至第一数据播放设备,以便于所述第一数据播放设备根据所述码率和所述分辨率,配置并启动所述编码器;以及
    数据块接收单元,设置为基于DLNA协议,接收所述第一数据播放设备发送的所述数据块,所述数据块由所述编码器输出的数据构成且容量小于或等于所述网络缓冲区容量。
  13. 根据权利要求12所述的装置,其中,数据块接收单元包括:
    数据块接收子单元,设置为通过数据发送线程接收所述第一数据播放设备发送的所述数据块;
    休眠子单元,设置为每次发送完所述数据块后,休眠时间T,所述时间T的计算公式为:T=S*8.0*1000.0/M/B-Δt,其中,T的单位为毫秒,B为所述码率,所述码率的单位为比特/秒;S为所述数据缓冲区容量,所述数据缓冲区容量的单位为字节;M为修正值,大于1的整数,Δt为所述数据块的发送时间,所述时间的单位为毫秒。
  14. 根据权利要求12所述的装置,其中,所述解码器的码率和分辨率与所述第二数据播放设备的中央处理器CPU性能匹配。
  15. 一种数据通信系统,包括第一数据播放设备、第二数据播放设备和WiFi设备,所述第一数据播放设备和第二数据播放设备均与所述WiFi设备连接,
    所述第二数据播放设备基于DLNA协议,发送所述第二数据播放设备的数据缓冲区容量以及所述解码器的码率和分辨率至第一数据播放设备,
    所述第一数据播放设备基于DLNA协议接收所述数据缓冲区容量以及所述解码器的码率和分辨率;
    所述第一数据播放设备根据所述码率和所述分辨率,配置并启动所述编码器;
    所述第一数据播放设备缓存所述编码器输出的数据,并读取容量小于或等于所述网络缓冲区容量的数据块;以及基于DLNA协议发送所述数据块至所述第二数据播放设备;以及
    所述第二数据播放设备基于DLNA协议接收所述第一数据播放设备发送的所述数据块;
    其中,所述数据块由所述编码器输出的数据构成且容量小于或等于所述网络缓冲区容量。
  16. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行权利要求1-4任一项所述的方法。
  17. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令设置为执行权利要求5-7任一项所述的方法。
PCT/CN2017/102889 2016-09-22 2017-09-22 数据发送方法、数据接收方法及其装置和系统 WO2018054349A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610840294.8 2016-09-22
CN201610840294.8A CN106375786B (zh) 2016-09-22 2016-09-22 一种udp媒体数据通信方法、装置、机顶盒及系统

Publications (1)

Publication Number Publication Date
WO2018054349A1 true WO2018054349A1 (zh) 2018-03-29

Family

ID=57897267

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/102889 WO2018054349A1 (zh) 2016-09-22 2017-09-22 数据发送方法、数据接收方法及其装置和系统

Country Status (2)

Country Link
CN (1) CN106375786B (zh)
WO (1) WO2018054349A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106375786B (zh) * 2016-09-22 2020-03-17 深圳创维数字技术有限公司 一种udp媒体数据通信方法、装置、机顶盒及系统
CN107948660A (zh) * 2017-11-16 2018-04-20 北京小米移动软件有限公司 视频编码适配的方法及装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012097549A1 (zh) * 2011-01-18 2012-07-26 中兴通讯股份有限公司 一种共享音频和/或视频的方法及系统
CN104581367A (zh) * 2015-01-04 2015-04-29 华为技术有限公司 分享多媒体内容的方法及装置
CN105898506A (zh) * 2016-05-03 2016-08-24 乐视控股(北京)有限公司 媒体文件的多屏播放方法和系统
CN106375786A (zh) * 2016-09-22 2017-02-01 深圳创维数字技术有限公司 一种udp媒体数据通信方法、装置、机顶盒及系统

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7705859B2 (en) * 2003-12-03 2010-04-27 Sony Corporation Transitioning between two high resolution video sources
CN104602118A (zh) * 2013-10-30 2015-05-06 中国移动通信集团公司 一种多媒体数据的输出方法和设备
CN103596063B (zh) * 2013-11-20 2017-05-24 海信集团有限公司 终端、电视机、多屏互动系统和抓屏参数的设置方法
CN103995683B (zh) * 2014-04-24 2017-04-19 深圳创维-Rgb电子有限公司 一种多屏互动方法及其系统
CN105025094B (zh) * 2015-07-09 2018-06-22 传成文化传媒(上海)有限公司 多屏互动方法及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012097549A1 (zh) * 2011-01-18 2012-07-26 中兴通讯股份有限公司 一种共享音频和/或视频的方法及系统
CN104581367A (zh) * 2015-01-04 2015-04-29 华为技术有限公司 分享多媒体内容的方法及装置
CN105898506A (zh) * 2016-05-03 2016-08-24 乐视控股(北京)有限公司 媒体文件的多屏播放方法和系统
CN106375786A (zh) * 2016-09-22 2017-02-01 深圳创维数字技术有限公司 一种udp媒体数据通信方法、装置、机顶盒及系统

Also Published As

Publication number Publication date
CN106375786A (zh) 2017-02-01
CN106375786B (zh) 2020-03-17

Similar Documents

Publication Publication Date Title
CN109327728B (zh) 一种一对多同屏方法、装置和系统、同屏设备及存储介质
CN106664458B (zh) 用于发射视频数据的方法、源装置以及存储媒体
US10110393B2 (en) Protocol switching over multi-network interface
TWI654888B (zh) Information processing device and information processing method
US9674257B2 (en) Placeshifting live encoded video faster than real time
US9986579B2 (en) Split miracast transmission over multiple frequency bands
WO2015033762A1 (ja) 情報処理装置および情報処理方法
US20140139735A1 (en) Online Media Data Conversion Method, Online Video Playing Method and Corresponding Device
JP2014168262A (ja) モバイルデバイスからワイヤレスディスプレイにコンテンツを送信するシステムおよび方法
US20150350288A1 (en) Media agnostic display for wi-fi display
KR20070059053A (ko) 전송 에러 복구가 있는 가정용 망 시스템
US11240559B2 (en) Content reproducing apparatus and content reproducing method
WO2014194815A1 (zh) 一种切换编码方式的方法、发送端和接收端
US20150086184A1 (en) Reception apparatus and reception method
WO2018054349A1 (zh) 数据发送方法、数据接收方法及其装置和系统
CN115865884A (zh) 一种网络摄像头数据访问装置、方法、网络摄像头和介质
US20200329387A1 (en) Miracast Framework Enhancements For Direct Streaming Mode
JP2011087070A (ja) ネットワーク機器、情報処理装置、ストリーム切替方法、情報処理方法、プログラムおよびコンテンツ配信システム
KR101710011B1 (ko) 영상 데이터 전송 및 수신 방법 및 장치
KR20140070896A (ko) 비디오 스트리밍 방법 및 그 전자 장치
US20240137606A1 (en) Electronic apparatus, server apparatus and control method thereof
WO2023216798A1 (zh) 音视频的转码装置、方法、设备、介质及产品
US11558776B2 (en) Devices and system for transmitting and receiving compressed bitstream via wireless stream and handling transmission error
WO2014166217A1 (zh) 一种多媒体业务传输方法及终端
WO2014183383A1 (zh) 一种业务处理方法及终端、管控设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17852417

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17852417

Country of ref document: EP

Kind code of ref document: A1