CN107770567B - A kind of method and apparatus of live streaming - Google Patents

A kind of method and apparatus of live streaming Download PDF

Info

Publication number
CN107770567B
CN107770567B CN201710930142.1A CN201710930142A CN107770567B CN 107770567 B CN107770567 B CN 107770567B CN 201710930142 A CN201710930142 A CN 201710930142A CN 107770567 B CN107770567 B CN 107770567B
Authority
CN
China
Prior art keywords
host process
coding
coding pass
video
plug
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201710930142.1A
Other languages
Chinese (zh)
Other versions
CN107770567A (en
Inventor
杨亮
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710930142.1A priority Critical patent/CN107770567B/en
Priority to PCT/CN2017/109670 priority patent/WO2019071679A1/en
Publication of CN107770567A publication Critical patent/CN107770567A/en
Application granted granted Critical
Publication of CN107770567B publication Critical patent/CN107770567B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/24Monitoring of processes or resources, e.g. monitoring of server load, available bandwidth, upstream requests
    • 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/241Operating system [OS] processes, e.g. server setup

Abstract

An embodiment of the present invention provides a kind of method and apparatus of live streaming, are at least used to solve the technical issues of how improving main broadcaster end live streaming program operation stability of the existing technology.The method includes:Start main broadcaster end and application program is broadcast live;Obtain the host process of the main broadcaster end live streaming application program;The host process creates coding pass;Video flowing is encoded out by the coding pass and feeds back to the host process;The host process is by the video stream to direct broadcast server, so that the video flowing is transmitted to the spectators' end equipment for accessing the direct broadcast server by the direct broadcast server.

Description

A kind of method and apparatus of live streaming
Technical field
The present invention relates to field of computer technology more particularly to a kind of method and apparatus of live streaming.
Background technology
Network direct broadcasting has been increasingly becoming amusement and the exchange way of a kind of mainstream of the modern life.Make a general survey of current each platform Main broadcaster end live streaming application program or even other kinds of application program, be all to use one process mode operation, that is, program All functions are all integrated in a process and execute.
Although one process pattern has the advantages that framework is simple, maintains easily, but there is a problem of that stability is low, example As if certain module goes wrong, it is possible to cause entire process to be collapsed, it is necessary to could be solved by reset routine.
Therefore, the prior art there is technical issues that how to improve main broadcaster end live streaming program.
Invention content
An embodiment of the present invention provides a kind of method and apparatus of live streaming, at least be used for solve it is of the existing technology how The technical issues of improving main broadcaster end live streaming program operation stability.
In a first aspect, the present invention provides a kind of methods of live streaming, including:
Start main broadcaster end and application program is broadcast live;
Obtain the host process of the main broadcaster end live streaming application program;
The host process creates coding pass;
Video flowing is encoded out by the coding pass and feeds back to the host process;
The host process is by the video stream to direct broadcast server, so that the direct broadcast server is by the video The spectators' end equipment for accessing the direct broadcast server is issued in circulation.
Optionally, described that video flowing is encoded out by the coding pass and feeds back to the host process, including:
The host process sends coded command to coding counterfoil module, to notify the coding pass encoded video stream;
The coding pass calls the coding local service module being connect with the coding counterfoil module to encode out described regard Frequency flows;
The coding pass is called encodes coding agent interface module that local service module is connect to the master with described The video flowing that control progress feedback encodes out.
Optionally, the host process creates coding pass, including:
The host process calling process creates function;
The ID of the host process is passed to the process creation function by the host process;
The host process runs coding pass described in the process creation function creation, and the coding pass is creating Cheng Hou initializes process context, and based on the ID connections master of the host process possessed by the process creation function Control process.
Optionally, the coding pass initializes process context, and be based on the process creation function after the completion of establishment The ID connections host process of the possessed host process, including:
The coding pass register initial service function and video flowing encoding service function;
It creates the video shared drive of storage audio-visual-materials and stores the audio shared drive of audio material;
Obtain the ID connections host process of the host process possessed by the process creation function;
Based on the connection with the host process, mark and the institute of the video shared drive are sent to the host process State the mark of audio shared drive.
Optionally, it is described video flowing encoded out by the coding pass and feed back to the host process before, also Including:
The host process sends initialization command to the coding pass, and the initialization command includes for instructing The nominal parameter that coding pass determines solution harbour parameter is stated, the solution harbour parameter includes video solution harbour parameter and audio decoder Head parameter;
The coding pass is based on the initialization command and runs the initialization service function, to be based on the specified ginseng Number obtains the video solution harbour parameter and the audio decoder head parameter;
The coding pass feeds back the video solution harbour parameter and the audio decoder head parameter to the host process, So that the video solution harbour parameter and the audio decoder head parameter are sent to the direct broadcast server by the host process, The video solution harbour parameter and the audio decoder head parameter are transmitted to spectators' end equipment by the direct broadcast server again.
Optionally, described that video flowing is encoded out by the coding pass and feeds back to the host process, including:
The coding pass receives the coded command that the host process is sent;
Based on the coded command, extraction is by the pre-stored video of the host process from the video sharing memory Material, and share in memory from the audio and extract by the pre-stored audio material of the host process;
It runs audio-visual-materials described in the video flowing encoding service function pair to be encoded, obtains video data encoder, with And the audio material is encoded, coded audio data is obtained, the video flowing includes the video data encoder and institute State coded audio data;
The video data encoder and the coded audio data are fed back into the host process.
Optionally, the method further includes:
The host process monitors whether the coding pass collapses;
If the host process monitors the coding pass collapse, the coding pass is re-created.
Second aspect, the present invention provides a kind of devices of live streaming, including:
Application program is broadcast live for starting main broadcaster end in start unit;
The host process of application program is broadcast live for obtaining the main broadcaster end for host process acquiring unit;
Process creation unit, for creating coding pass;
Video flowing acquiring unit encodes out video flowing and feeds back to the host process for passing through the coding pass;
Transmission unit is used for the video stream to direct broadcast server, so that the direct broadcast server is regarded by described in The spectators' end equipment for accessing the direct broadcast server is issued in frequency circulation.
Optionally, the video flowing acquiring unit is used to send coded command to coding counterfoil module, to notify the volume Code process encoded video stream, the coding pass call the coding local service module being connect with the coding counterfoil module to encode Go out the video flowing, the coding pass is called encodes coding agent interface module that local service module is connect to institute with described State the video flowing that video flowing acquiring unit feedback encoding goes out.
Optionally, the process creation unit creates function for calling process, and the ID of the host process is passed to institute State process creation function, run coding pass described in the process creation function creation, the coding pass after the completion of establishment, Initialize process context, and the ID connections master control based on the host process possessed by the process creation function into Journey.
Optionally, described device further includes coding pass environment initial cell, is completed for being created in the coding pass Afterwards, process context, and the ID connections master control based on the host process possessed by the process creation function are initialized Process is specifically used for register initial service function and video flowing encoding service function in the coding pass, creates storage The video shared drive of audio-visual-materials and the audio shared drive for storing audio material, obtain the process creation function and are had The ID connections host process for the host process having, the connection based on the coding pass Yu the host process, to The host process sends the mark of the video shared drive and the mark of the audio shared drive.
Optionally, described device further includes coding initialization unit, for being encoded out by the coding pass described Video flowing and before feeding back to the host process, initialization command, the initialization command packet are sent to the coding pass The nominal parameter for instructing the coding pass to determine solution harbour parameter is included, the solution harbour parameter includes video solution harbour ginseng Number and audio decoder head parameter run the initialization service function, to be based on the specified ginseng based on the initialization command Number obtains the video solution harbour parameter and the audio decoder head parameter, feeds back the video solution harbour to the host process Parameter and the audio decoder head parameter, so that the host process is by the video solution harbour parameter and the audio decoder head Parameter is sent to the direct broadcast server, and the direct broadcast server is again by the video solution harbour parameter and the audio decoder head Parameter is transmitted to spectators' end equipment.
Optionally, the video flowing acquiring unit is used to receive the coded command that the host process is sent;Based on described Coded command, extraction is by the pre-stored audio-visual-materials of the host process from the video sharing memory, and from described Audio, which is shared in memory, to be extracted by the pre-stored audio material of the host process;Run the video flowing encoding service function The audio-visual-materials are encoded, obtain video data encoder, and encode to the audio material, audio is obtained and compiles Code data, the video flowing includes the video data encoder and the coded audio data;By the video data encoder and The coded audio data feeds back to the host process.
Optionally, described device further includes coding pass monitoring unit, for monitoring whether the coding pass collapses;Such as Fruit monitors the coding pass collapse, re-creates the coding pass.
The third aspect, the present invention provides a kind of computer readable storage mediums, are stored thereon with computer program, the journey The step of any one of first aspect the method is realized when sequence is executed by processor.
Fourth aspect, the present invention provides a kind of computer equipments, including memory, processor and storage are on a memory And the computer program that can be run on a processor, the processor are realized when executing described program described in any one of first aspect The step of method.
Said one in the embodiment of the present application or multiple technical solutions at least have following one or more technology effects Fruit:
In the technical solution of the embodiment of the present invention, starts main broadcaster end first and application program is broadcast live, and it is straight to obtain main broadcaster end The host process of application program is broadcast, then host process further creates coding pass, and video flowing is encoded out by coding pass And host process is fed back to, host process is again by video stream to direct broadcast server, so that direct broadcast server circulates video Issue spectators' end equipment of access direct broadcast server.Since the embodiment of the present invention uses multi-process, regarded using coding pass coding Frequency flows, so the exception of encoding function does not interfere with host process, is led so avoiding since one or more functions are abnormal Cause program crashing so that main broadcaster end live streaming application program is more stably run, and thus solves of the existing technology how to carry The technical issues of high main broadcaster end live streaming program operation stability.
Description of the drawings
Fig. 1 is the method flow diagram being broadcast live in the embodiment of the present invention;
Fig. 2 is the apparatus structure schematic diagram being broadcast live in the embodiment of the present invention;
Fig. 3 is the structural schematic diagram of Computer equipment of the embodiment of the present invention.
Specific implementation mode
An embodiment of the present invention provides a kind of method and apparatus of live streaming, at least be used for solve it is of the existing technology how The technical issues of improving main broadcaster end live streaming program operation stability.
In order to solve the above technical problem, the present invention provides technical solution thinking it is as follows:
In the technical solution of the embodiment of the present invention, starts main broadcaster end first and application program is broadcast live, and it is straight to obtain main broadcaster end The host process of application program is broadcast, then host process further creates coding pass, and video flowing is encoded out by coding pass And host process is fed back to, host process is again by video stream to direct broadcast server, so that direct broadcast server circulates video Issue spectators' end equipment of access direct broadcast server.Since the embodiment of the present invention uses multi-process, regarded using coding pass coding Frequency flows, so the exception of encoding function does not interfere with host process, is led so avoiding since one or more functions are abnormal Cause program crashing so that main broadcaster end live streaming application program is more stably run, and thus solves of the existing technology how to carry The technical issues of high main broadcaster end live streaming program operation stability.
Technical solution of the present invention is described in detail below by attached drawing and specific embodiment, it should be understood that the application Specific features in embodiment and embodiment are the detailed description to technical scheme, rather than to present techniques The restriction of scheme, in the absence of conflict, the technical characteristic in the embodiment of the present application and embodiment can be combined with each other.
The terms "and/or", only a kind of incidence relation of description affiliated partner, indicates that there may be three kinds of passes System, for example, A and/or B, can indicate:Individualism A exists simultaneously A and B, these three situations of individualism B.In addition, herein Middle character "/", it is a kind of relationship of "or" to typically represent forward-backward correlation object.
First aspect present invention provides a kind of method of live streaming, referring to FIG. 1, for the side being broadcast live in the embodiment of the present invention Method flow chart.This method includes:
S101:Start main broadcaster end and application program is broadcast live;
S102:Obtain the host process of the main broadcaster end live streaming application program;
S103:The host process creates coding pass and/or plug-in unit loads process, and the coding pass is used to be based on institute The control for stating host process encodes out video flowing, and feeds back the video flowing to the host process, and the plug-in unit loads process The plug-in unit loaded is called for loading plug-in unit in the plug-in unit load process, and according to the control of the host process;
S104:The host process obtains the video flowing;
S105:The host process is by the video stream to direct broadcast server, so that the direct broadcast server is by institute It states video flowing and is transmitted to the spectators' end equipment for accessing the direct broadcast server.
Specifically, start main broadcaster end in S101 and application program is broadcast live.During specific implementation, the live streaming of main broadcaster end is answered The live streaming application in main broadcasters' end equipment such as mobile phone, tablet computer or desktop computer is may be mounted at program, the present invention, which is not done, to be had Body limits.The technical solution in the embodiment of the present invention is introduced for convenience, it hereafter will be with mounted on the desktop of Windows systems It is introduced for main broadcaster end live streaming application program on brain.
In S102, as the startup of application program, the corresponding master for creating main broadcaster end live streaming application program is broadcast live in main broadcaster end Control process.Next, in S103, host process will create coding pass and/or plug-in unit load process as required.
Specifically, the coding pass in the embodiment of the present invention encodes out video flowing for the control based on host process, And feed back video flowing to host process.More specifically, coding pass receive host process initialization command and coded command into Row initialization and coding, and by the data transfer after coding to host process.
Plug-in unit load process is called according to the control of host process and is loaded for loading plug-in unit in plug-in unit load process Plug-in unit.More specifically, plug-in unit load process serves as the loader of main broadcaster end live streaming application plug, to be loaded original It is loaded into plug-in unit load process into the plug-in unit in host process, and then host process is made no longer to need to load plug-in unit, and then kept away The case where having exempted to cause host process to collapse because of the problem of plug-in unit.Plug-in unit in the embodiment of the present invention loads process one side mould It draws up plug-in unit load and runs the environment of relied on host process, on the other hand response obtains image from host process, obtains The orders such as audio are taken, the image and audio generated to host process feedback plug-in unit makes normally draw in host process and come from The image and broadcasting sound of plug-in unit.
Host process is the host process of main broadcaster end live streaming application program, management plug-in unit load process and coding pass.Also, If monitoring coding pass to exit extremely, host process will re-create coding pass automatically so that coding pass can be fast Speed is restarted.
Further, since host process, coding pass and plug-in unit load process are different processes, in order to make a plurality of process Collaboration provides the various services of main broadcaster end live streaming application program, is interacted by way of process communication between process.Process is logical The mode of letter includes RPC (remote procedure call protocol, Remote Procedure Call Protocol) and name pipeline etc. Deng the present invention is not particularly limited, and those skilled in the art can be according to actually selecting.Hereinafter Then it is introduced by taking RPC as an example.
For the main broadcaster end live streaming application program in the embodiment of the present invention, host process, coding pass and plug-in unit add It is loaded into journey and runs on backstage, then interacted with main broadcaster by interface program on foreground.Interface program is that main broadcaster really carries out man-machine friendship Mutual program, in realization, interface program need to give video pictures the preview window to host process to draw.Main broadcaster is at interface On calling can be forwarded in host process and handle by RPC.Also, interface program need to also be in the feelings that host process collapses extremely Under condition, start and restore host process.
It is the introduction to each process in multi-process pattern of the present invention above.During specific implementation, in different feelings Main broadcaster may have different demands, such as main broadcaster under condition can use one process pattern for the ease of safeguarding to incline, or in order to Program temperature can use multi-process pattern, and plug-in unit load process etc. can not be created in the case where that need not use plug-in unit, In order to meet the needs of different, the main broadcaster end live streaming application program in the embodiment of the present invention can be according at least following 4 kinds of operations Mode operation.
First mode:
First mode LIVE_ENCODER_PROXY_WITH_SERVER is specially multi-process pattern.In the flrst mode, To create host process RpcLiveEncoderServer after main broadcaster end live streaming application program launching, (host process can also be named For other), then host process RpcLiveEncoderServer can be considered as server by main broadcaster end live streaming application program, with visitor The identity access host process RpcLiveEncoderServer at family end.Then, application program is broadcast live to host process in main broadcaster end Calling, can by RPC ask be sent to host process RpcLiveEncoderServer.
In the flrst mode, host process RpcLiveEncoderServer can further create coding pass RpcLiveEncoderEncoder (name of coding pass may be other) and plug-in unit load process RpcPluginLoader (name that plug-in unit loads process may be other).
Second mode:
Second mode LIVE_ENCODER_PROXY_WITHOUT_SERVER is also multi-process pattern.Not with first mode With live streaming application program in main broadcaster end need not voluntarily create host process under the second mode RpcLiveEncoderServer, and be attached in an existing default host process.Similarly, main broadcaster end live streaming application Host process RpcLiveEncoderServer can be considered as server by program, according to the address of server with the identity of client Access preset host process.
During specific implementation, the host process in second mode can be the process that upper layer application creates.Second mould Compared to first mode, advantage is to extend host process from upper layer application formula;First mode is excellent compared to second mode Gesture is directly to manage host process convenient for main broadcaster end live streaming application program, and host process be by main broadcaster end application program from What oneself created, therefore incompatible possibility is low.
Under the second mode, host process RpcLiveEncoderServer also can further create coding pass RpcLiveEncoderEncoder and plug-in unit load process RpcPluginLoader.
The third mode:
The third mode LIVE_ENCODER_PROXY_STUB is also multi-process pattern.Wherein, the master control in the third mode into Journey RpcLiveEncoderServer is similar to the host process in first mode or second mode.In a third mode, master control Process RpcLiveEncoderServer can further create coding pass RpcLiveEncoderServer or plug-in unit load into One in journey RpcPluginLoader.In embodiments of the present invention, host process is indicated by pre-setting marker bit RpcLiveEncoderServer generates coding pass RpcLiveEncoderServer or plug-in unit loads process RpcPluginLoader。
Specifically, the first marker bit LIVE_ENCODER_REMOTE_PLUGIN expressions need to create plug-in unit load process RpcPluginLoader, the second marker bit LIVE_ENCODER_REMOTE_ENCODER expressions need to create coding pass RpcLiveEncoderServer。
So, during specific implementation, if necessary to add plug-in unit, and influence of the plug-in unit to host process is reduced, The third mode can be then selected, and pre-sets the first marker bit;It is encoded if necessary to single process, avoids encoding function to master Control process influences, and when need not add plug-in unit, then can select the third mode, and pre-set the second marker bit.
Fourth mode:
Fourth mode LIVE_ENCODER_LOCAL_SERVICE is one process pattern.Under fourth mode, main broadcaster end is straight It broadcasts application program and only creates a process, i.e. host process.Main broadcaster end is broadcast live the encoding function applied and is realized in host process, Plug-in unit also loads in host process.
Under fourth mode, host process RpcLiveEncoderServer will not further create other processes.
Based on the introduction above to four kinds of operational modes, it can be seen that application program is broadcast live in different operational modes in main broadcaster end Under will obtain host process in different ways, therefore the S102 in the embodiment of the present invention is realized especially by following process:
Judge the operational mode of the pre-set main broadcaster end live streaming application program;
If the operational mode is first mode, the host process of the main broadcaster end live streaming application program is created, Wherein, in the first mode, the host process will create the coding pass and plug-in unit load process;
If the operational mode is second mode, the address of the preset host process is obtained, and based on describedly The host process is accessed in location, wherein in the first mode, the host process will create the coding pass and described Plug-in unit loads process.
Specifically, first determine whether that pre-set operational mode is any in above four kinds of patterns.If main broadcaster The operational mode of setting is first mode, then is created that host process by main broadcaster end live streaming application program;If main broadcaster's setting Operational mode is second mode, then live streaming application program in main broadcaster end obtains the address of preset host process, is then based on the ground Preset host process is accessed in location.
In addition, if the operational mode of main broadcaster's setting is fourth mode, main broadcaster end live streaming application program only creates master control One process of process, with one process mode operation.If the operational mode of main broadcaster's setting is the third mode, the live streaming of main broadcaster end is answered After obtaining host process with program, host process further also need to create one in coding pass or plug-in unit load process into Journey.Specifically, further include before S103:The operational mode for judging pre-set main broadcaster end live streaming application program, if operation Pattern is the third mode, then the marker bit for indicating to need to create coding pass or plug-in unit load process is further obtained, if mark Note position is the first marker bit, and S103 is specially:Plug-in unit, which is created, by host process loads process;If marker bit is the second label Position, S103 are specially:Coding pass is created by host process.Also, the master in the first mode and in a second mode, got Control process will further create coding pass and plug-in unit load process.
It can make main broadcaster end that application program be broadcast live with list by the way that different operational modes is arranged it can be seen from foregoing description Process or multi-process operation, meet different performance requirements.Also, the marker bit by being arranged different can also load plug-in unit One in function and encoding function is independent from host process.
Further, encoding function is usually one of the function of main broadcaster end live streaming application program core the most, in the prior art In, realize that each function, interface and parameter of encoding function etc. are encapsulated in coding module.Host process will encode mould when running Block is loaded into host process, and then host process can arbitrarily call each function, interface and the parameter of encoding function.At this In inventive embodiments, since live streaming application program in main broadcaster end can not only have been run but also can have been run with multi-process with one process, in order to Make main broadcaster end live streaming application program no matter one process operation or multi-process run can be with normal encoding, the embodiment of the present invention pair Coding module has at least made following improvement:
The encoding function of coding module in the prior art is encapsulated in a module, i.e., LiveEncoderLocalService is encoded in local service module;Addition is instructed for receiving, and the instruction that will be received The module being forwarded in coding local service module, i.e. LiveEncoderStub encode counterfoil module;Addition one is for simulating The module of the original output interface of coding module and transparent transmission coding local service module handling result, i.e., LiveEncoderProxy coding agent modules.Enable LiveEncoderLocalService coding local service module connections LiveEncoderStub encodes counterfoil module, and LiveEncoderProxy coding agent modules is enabled to connect LiveEncoderLocalService encodes local service module.Optionally, LiveEncoderLocalService is encoded Local service module, LiveEncoderStub coding counterfoil modules and LiveEncoderProxy coding agent modules are encapsulated in In one module, i.e. LiveEncoder coding modules.
Based on above to the improved introduction of coding module, below just to the embodiment of the present invention how the coding after application enhancements Module coding is introduced.
(1) if host process creates coding pass, i.e. main broadcaster end live streaming application program operates in first mode, second Under pattern and (under the second marker bit) the third mode, host process acquisition video flowing includes in S104:
The host process sends coded command to coding counterfoil module, to notify the coding pass encoded video stream;
The coding pass calls the coding local service module being connect with the coding counterfoil module to encode out described regard Frequency flows;
The coding pass is called encodes coding agent interface module that local service module is connect to the master with described The video flowing that control progress feedback encodes out.
Specifically, if host process calls coding module to create coding pass, just the live streaming of main broadcaster end is answered With the encoding function of program from host process independently to realizing in coding pass.Coding pass is subordinated to coding module.When need When encoding, host process is led to by communicating to the transmission coded command of coding counterfoil module by the RPC between coding pass Know that coding pass starts to encode.Coding pass in response to coded command, call correlation technique in coding local service module and Function executes coded command, to encode out video flowing.Then, coding pass recalls coding agent module LiveEncoderProxy is by the channels RPC to the good video flowing of host process feedback encoding.
In turn, in S105, host process is by video stream to direct broadcast server, and then direct broadcast server is by video flowing It is transmitted in the spectators' end equipment for watching the spectators of the main broadcaster.In turn, spectators' end equipment decodes live streaming and regards to decoding video stream Frequency is watched for spectators.
(2) if host process does not create coding pass, i.e., main broadcaster end live streaming application program operate in the third mode and Under (the first marker bit) the third mode, host process acquisition video flowing includes in S104:
The host process sends coded command to coding counterfoil module;
The coding counterfoil module calls the coding local service module being connect with the coding counterfoil module to encode out institute State video flowing;
The coding local service module calls the coding agent interface module being connect with the coding local service module The video flowing gone out to the host process feedback encoding.
Specifically, if host process does not create coding pass, the encoding function of application program is broadcast live in main broadcaster end Then still realized by host process.Specifically, when host process needs encoded video stream, coded command is generated.Then, master control Process sends coded command to coding counterfoil module.Then, coding counterfoil module sends coding to coding local service module and refers to It enables, to call the method and function encoded video stream that encode in local service module.Then, coding local service module will encode The video stream of completion gives coding agent module, and then video flowing is transparently transmitted to host process by coding agent module again.
Be above to host process and coding pass how the introduction encoded using improved coding module, below How coding pass is then created to host process and the specific cataloged procedure of coding pass is introduced.
The process for creating coding pass to host process first is introduced.In embodiments of the present invention, host process is created Coding pass is built to comprise the following processes:
The host process calling process creates function;
The ID of the host process is passed to the process creation function by the host process;
The host process runs coding pass described in the process creation function creation, and the coding pass is creating Cheng Hou initializes process context, and based on the ID connections master of the host process possessed by the process creation function Control process.
Specifically, host process calls one volume of process creation CreateProcess function creations of Windows systems Code process RpcLiveEncoderEncoder.Host process, can be by host process when calling CreateProcess functions Process ID passes to CreateProcess functions as command line parameter, and then by the coding of CreateProcess function creations Process RpcLiveEncoderEncoder can obtain the process ID of host process in order line after starting.Then, master control Process operation CreateProcess function creations go out coding pass RpcLiveEncoderEncoder.Next, coding pass Process context is initialized, and establishes the connection with host process, specifically, coding pass passes through following procedure initialization process ring Border simultaneously connects host process:
The coding pass register initial service function and video flowing encoding service function;
It creates the video shared drive of storage audio-visual-materials and stores the audio shared drive of audio material;
Obtain the ID connections host process of the host process possessed by the process creation function;
Based on the connection with the host process, mark and the institute of the video shared drive are sent to the host process State the mark of audio shared drive.
Specifically, coding pass RpcLiveEncoderEncoder is by calling RpcCreateInstance methods wound A RPC communication client instance handle hRpc is built, accordingly, host process is server.Then, it calls RpcRegisterProcedure functions, by the initialization service function init_ of coding pass RpcLiveEncoderEncoder Encoder is registered in hRpc, and video flowing encoding service function encode_raw_buffer is registered in hRpc. In the embodiment of the present invention, initialization service function init_encoder is used to respond the initialization command of host process, according to first Nominal parameter in beginningization order completes coding initial work, and encoding stream server functions encode_raw_buffer is used for Respond host process coded command, in host process specified memory audio-visual-materials and audio material encode, and will Acquired data return to host process after coding.
Next, creating the memory of storage audio-visual-materials and audio material.In embodiments of the present invention, it is contemplated that if needed The higher video flowing of clarity, such as the video flowing of 1080p are encoded, then all bigger per the data volume of frame image;Meanwhile If using the data between RPC transmission processes, larger performance consumption is also brought along, therefore in order to avoid coded data need not The transmission wanted, the embodiment of the present invention optimize performance by the way of shared drive.Specifically, Windows systems are called The video shared drive of one entitled RpcLiveEncoderEncoder_video_X of CreateFileMapping function creations, And create the audio shared drive of an entitled RpcLiveEncoderEncoder_Audio_X.Certainly, it was implementing The name of Cheng Zhong, video shared drive and audio shared drive can be according to being actually configured, and the present invention is not particularly limited.
Next, the process ID of the host process in coding pass reading order row, calls RpcStartService functions Establish the RPC communication channel between host process.Then, the client_process_ of host process is called based on the channels RPC Ready functions, to notify host process coding pass initialization process context to complete.
Host process, to the calling of client_process_ready functions, is obtained according to coding pass out of RPC channels SessionId session id of the coding pass in RPC connections, and determine that coding pass context initialization is completed, and then follow-up Informed code process encoded video stream as needed in the process.
In addition, sessionId of the host process based on coding pass calls the rpc_encoder_ of coding pass Sharememory_name functions obtain the video shared drive mark and audio shared drive mark that coding pass is created.
By the above process, the establishment to coding pass is just completed.Next, to the specific cataloged procedure of coding pass It is introduced.
First, it in order to enable spectators' end equipment can smoothly obtain and decoded video streams, needs first to carry to spectators' end equipment For solving harbour parameter.Therefore, before encoding out video flowing by coding pass and feeding back to host process, further include:
The host process sends initialization command to the coding pass, and the initialization command includes for instructing The nominal parameter that coding pass determines solution harbour parameter is stated, the solution harbour parameter includes video solution harbour parameter and audio decoder Head parameter;
The coding pass is based on the initialization command and runs the initialization service function, to be based on the specified ginseng Number obtains the video solution harbour parameter and the audio decoder head parameter;
The coding pass feeds back the video solution harbour parameter and the audio decoder head parameter to the host process, So that the video solution harbour parameter and the audio decoder head parameter are sent to the direct broadcast server by the host process, The video solution harbour parameter and the audio decoder head parameter are transmitted to spectators' end equipment by the direct broadcast server again.
Specifically, host process sends initialization init_encoder orders to coding pass.The order includes being used for Coding pass is instructed to determine the nominal parameter of solution harbour parameter, and nominal parameter is then true according to the selection of main broadcaster by host process It is fixed.In embodiments of the present invention, nominal parameter includes but not limited to resolution information (width width and height height), depending on Frequency code rate videoBitrate, video frame rate fps, video encoder type videoCodec, the channel number of audio coder AudioChannel, audio sample rate audioSampleRate, audio code rate audioBitrate and audio coder class Type audioCodec.
Coding pass is after RPC channel receptions initialize init_encoder orders, by initializing service function init_ Encoder is responded, specifically:Call CreateMediaFile one multimedia file IMediaFile interface of function creation;So IMediaFile interfaces are called according to the video encoder type videoCodec in init_encoder orders afterwards CreateEncoder methods create video encoder the interface videoEncoder, Yi Jigen that a type is videoCodec CreateEncoder methods are called to create a class according to the audio coder type audioCodec in init_encoder orders Type is the video encoder interface audioEncoder of audioCodec;Call video encoder interface videoEncoder's Open methods using the width width of encoded video, height height, video code rate videoBitrate, video frame rate fps as Parameter initializes video encoder interface IMediaEncoder, and calls the Open of audio coder audioEncoder Method, by the channel number audioChannel, audio sample rate audioSampleRate, audio code rate of audio coder AudioBitrate is as a parameter to initialization audio coder audioEncoder.
Then, coding pass calls the readVideoHeader of IMediaFile interfaces to get video encoder interface The video solution harbour parameter videoHeader of IMediaEncoder, and call IMediaFile interfaces ReadAudioHeader methods obtain the audio decoder head parameter audioHeader of audio coder audioEncoder.
Then, coding pass is by the video solution harbour parameter videoHeader got and audio decoder head parameter AudioHeader is sent to host process by the channels RPC.And host process then can further by video solution harbour parameter VideoHeader and audio decoder head parameter audioHeader is sent to direct broadcast server, so direct broadcast server by video Solution harbour parameter videoHeader and audio decoder head parameter audioHeader is sent to each spectators' end equipment.So, it sees Many end equipments can basis video solution harbour parameter videoHeader and audio decoder head parameter audioHeader to regarding Frequency and audio are decoded broadcasting.
After obtaining solution harbour parameter, so that it may to obtain the video flowing of coding.In embodiments of the present invention, pass through in S104 Coding pass obtains encoded video stream especially by following process:
The coding pass receives the coded command that the host process is sent;
Based on the coded command, extraction is by the pre-stored video of the host process from the video sharing memory Material, and share in memory from the audio and extract by the pre-stored audio material of the host process;
It runs audio-visual-materials described in the video flowing encoding service function pair to be encoded, obtains video data encoder, with And the audio material is encoded, coded audio data is obtained, the video flowing includes the video data encoder and institute State coded audio data;
The video data encoder and the coded audio data are fed back into the host process.
Specifically, host process is according to the mark of the video shared drive obtained above, it would be desirable to the video material of coding Material is prestored in video shared drive, and according to the mark of the audio shared drive obtained above, it would be desirable to coding Audio material is prestored in audio shared drive.During specific implementation, the content of audio-visual-materials and audio material is logical It is often matched, such as from same file or has the acquisition of main broadcaster's end equipment.Then, it is needing to encode out video flowing When, host process sends coded command encode_raw_buffer by the channels RPC between coding pass to coding pass.
It after coding pass receives encode_raw_buffer orders, is responded by coding function, specifically:It calls The Encode methods of videoEncoder interfaces, the audio-visual-materials read in video shared drive are encoded, by Video coding Data return to host process;And the Encode methods of audioEncoder are called, to the audio material in audio shared drive Material is encoded, and coded audio data is returned to host process.Wherein, video data encoder and coded audio data composition regard Frequency flows, and the two is corresponded to according to time shaft.
Above is exactly the introduction to coding pass encoded video stream.By the above process, coding pass is achieved that individually Encoded video stream.
Host process receives after the video flowing that coding pass returns, and video flowing is stored in transmit queue and is sent to Direct broadcast server.In turn, direct broadcast server is transmitted to each spectators' end equipment, spectators after receiving video flowing, then by video flowing End equipment decodes the video flowing received successively, and then the live video of main broadcaster is played to user, thus completes live streaming.
In addition, during specific implementation, coding pass may collapse due to abnormal, be answered to make main broadcaster end be broadcast live It can continue to encode with program and then continue to be broadcast live, the live broadcasting method in the embodiment of the present invention can further include:
The host process monitors whether the coding pass collapses;
If the host process monitors coding pass collapse, the host process re-create it is described encode into Journey.
Specifically, the operating status of host process monitoring coding pass, if monitoring coding pass collapse, according to The mode of establishment coding pass described above re-creates coding pass, and just it is no longer repeated herein.
It is the introduction to coding pass above, the method for loading process and plug-in unit load to plug-in unit below is introduced.
In embodiments of the present invention, the plug-in unit of main broadcaster end live streaming application program loads inside plug-in unit load process, in turn The operation of host process will not be influenced plug-in unit is abnormal.Similar to coding pass, plug-in unit process is also by the channels RPC and master Control process connects, also, plug-in unit process can be called to simulate the environment that plug-in unit is loaded into host process by the channels RPC The relevant interface of host process makes plug-in unit can be with normal load and operation.
For the host process of the prior art before loading plug-in unit, which plug-in unit needs to know has, thus load plug-in unit it Before, it needs to enumerate plug-in unit.Plug-in unit in the embodiment of the present invention loads process before loading plug-in unit, it is also desirable to host process piece Lift plug-in unit.Specifically, needs are loaded in plug-in unit load process and are broadcast live in application program at main broadcaster end in plug-in unit load process add Before the target plug-in of load, further include:
The host process creates plug-in unit enumerator process;
The plug-in unit enumerator process is enumerated present in current load catalogue to the host process and can be loaded Alternative plug-in unit;
The host process determination determines the target plug-in from the alternative plug-in unit, and the plug-in unit is notified to load Target plug-in described in process.
The process for creating plug-in unit enumerator process to host process first is introduced, and host process is created in the following way Build plug-in unit enumerator process:
The host process calling process creates function;
The ID of the host process is passed to the process creation function by the host process;
The host process runs plug-in unit enumerator process described in the process creation function creation, the plug-in unit enumerator Process initializes process context, and based on the host process possessed by the process creation function after the completion of establishment The ID connections host process.
Host process load the long-range plugin manager modules of RpcPluginManager, the module be responsible for plug-in unit enumerator into The establishment of journey RpcPluginFinder, and RpcPluginFinder is ordered to enumerate the function of plug-in unit.It will After in RpcPluginManager module loadings to host process, mould CreatePluginManager functions in the block are called, Create a plugin manager interface IPluginManager.
Next, host process calls the initialization init methods of plugin manager interface IPluginManager, make Init methods further call the process creation function CreateProcess of Windows systems to create plug-in unit enumerator process RpcPluginFinder.When calling CreateProcess functions, host process can also regard the process ID of host process Command line parameter passes to CreateProcess functions.
Next, host process operation, which creates function CreateProcess, can be created that plug-in unit enumerator process RpcPluginFinder.
The establishment of plug-in unit enumerator process is just completed by the above process.And plug-in unit enumerator process is creating completion Afterwards, it is also desirable to initialize process context, and establish the connection with host process.Specifically, plug-in unit enumerator process passes through Following procedure initialization environment:
Registration, which is enumerated plug-in unit function and enumerated, in the plug-in unit enumerator process exits function;
Obtain the ID connections host process of the host process possessed by the process creation function.
Specifically, by calling RpcCreateInstance to create a RPC communication client instance handle hRpc; RpcRegisterProcedure functions are called, the power function of plug-in unit will be enumerated, that is, enumerate plug-in unit function get_plugins notes Volume is instructed for responding the plug-in unit of enumerating of host process and enumerates plug-in unit in hRpc, enumerating plug-in unit function;It calls RpcRegisterProcedure functions will be enumerated and exit function and also be registered in hRpc, enumerate and exit function for responding master Control process get send after all plug-in units enumerate exit instruction, so that plug-in unit enumeration process is exited;According to the master in order line The process ID of control process calls RpcStartService functions, establishes the channels RPC between host process;Call master control into The client_process_ready functions of journey, to notify host process plug-in unit enumerator process initialization to complete.
Host process according to plug-in unit enumerator process to the calling of client_process_ready functions, from the channels RPC SessionId session id of the plug-in unit enumerator process in RPC connections is inside got, and at the beginning of determining plug-in unit enumerator process context Beginningization is completed, and then notice plug-in unit enumerator process enumerates plug-in unit as needed in the follow-up process.
By the above process, the establishment to plug-in unit enumerator process is just completed.Next, having to plug-in unit enumerator process The enumeration process of body is introduced.Plug-in unit enumerator process is enumerated present in current load catalogue and can be added to host process The alternative plug-in unit carried, including:
What the plug-in unit enumerator received that the host process sends enumerates instruction, and plug-in unit function process is enumerated described in calling Read all plug-in units under the load catalogue;
Legal plug-in unit is filtered out from all plug-in units;
The spare plug-in unit that the main broadcaster end live streaming application program is supported is filtered out from the legal plug-in unit.
Specifically, the alternative plug-in unit in the embodiment of the present invention refers to the plug-in unit for host process selection load.Work as master When control process needs to load plug-in unit, can instruction first be enumerated to the transmission of plug-in unit enumerator process, obtain all alternative plug-in units.Plug-in unit piece After what act device process was sent from RPC channel reception to host process enumerates instruction, calls enumeration function get_plugins to enumerate and works as All plug-in units under preceding load catalogue.
Specifically, get_plugins function calls FindFirstFile functions obtain first under load catalogue DLL (dynamic link library, Dynamic Link Library) file.Then, get_plugins function calls FindNextFile Function continues to obtain next dll file under load catalogue.If FindNextFile function return values are true, indicate to obtain Next dll file has been arrived, then has executed FindNextFile functions again, continues to obtain next dll file;If FindNextFile function return values are fictitious time, indicate to have obtained all dll files under load catalogue.As long as The return value of FindNextFile functions is true, then carries out obtaining next dll file, until FindNextFile functions return Value is false.
During specific implementation, main broadcaster is possible to be added to some illegal plug-in units in load catalogue, still Illegal plug-in unit cannot load, therefore after getting all plug-in units, further judge whether the plug-in unit obtained is legal, general Illegal plug-in unit filters out.
Specifically, the LoadLibrary functions of calling system load each dll file, if it is possible to successfully call LoadLibrary functions, then indicating that the dll file is legal;, whereas if LoadLibrary function calls fail, then table Show that the dll file is illegal.After calling LoadLibrary functions for each dll file, by illegal dll file from adding It carries and is unloaded in catalogue, legal dll file is retained.
Further, for application program is broadcast live in main broadcaster end, although a plug-in unit is legal, the live streaming of main broadcaster end Application program is also possible to not support the plug-in unit, therefore in embodiments of the present invention, in order to ensure finally to be provided for host process Alternative plug-in unit be main broadcaster end live streaming application program support plug-in unit, it is also necessary to carried out further directed to legal dll file Filter, to obtain the plug-in unit that main broadcaster end live streaming application program is supported.
During specific implementation, plug-in unit enumerator process is filtered according to different supports conditions, and the present invention is not done Concrete restriction.For example, the plug-in unit that live streaming application program in main broadcaster end is supported has the plug-in unit of export function, that , specifically judge whether the method that can be supported is legal plug-in unit:The GetProcAddress functions of calling system obtain one Export function in a legal dll file, if it is possible to get export function, it is determined that the corresponding plug-in unit of the dll file is The plug-in unit that main broadcaster end live streaming application program can be supported, and then the plug-in unit is left alternative plug-in unit;, whereas if having not been obtained Export function, it is determined that the corresponding plug-in unit of the dll file is that main broadcaster end is broadcast live the plug-in unit do not supported of application program, and then from load The plug-in unit is unloaded in catalogue.
By the above process, one or more alternative plug-in units are just obtained.Next, plug-in unit enumerator process by with master The title for the alternative plug-in unit determined is supplied to host process by the channels RPC of control process.
Further, it in order to save the system resource of main broadcaster's end equipment, enumerates and works as to host process in plug-in unit enumerator process Present in preceding load catalogue and after the alternative plug-in unit that can load, further include:
The host process sends exit instruction to the plug-in unit enumerator process;
The plug-in unit enumerator be based on the exit instruction call described in enumerate and exit function and terminate process.
Specifically, host process is sent out after receiving the plug-in unit that plug-in unit enumerator process is enumerated to plug-in unit enumeration process Send exit instruction.After plug-in unit enumerator process receives exit instruction, calling, which is enumerated, to be exited function and exits plug-in unit enumerator process.
Next, host process chooses target plug-in from alternative plug-in unit automatically, or it is true according to the selection operation of main broadcaster Fixed corresponding target plug-in, then by loading the channels RPC of process with plug-in unit, by the title notice plug-in unit load of target plug-in Process.In turn, plug-in unit load process to load and is run according to the dll file of the name acquiring target plug-in of target process Target plug-in.
One specific example, it is assumed that the plug-in unit currently loaded needs the addition method for calling host process that could load, So, plug-in unit load process is made plug-in unit detect and is added by the addition method with the channels RPC of host process calling host process Method method, so as to successfully load.Further, host process call plug-in component operation, plug-in unit load process by with master control into What the RPC channel reception host process of journey was sent triggers the instruction of the plug-in component operation, and then triggers the plug-in component operation.The plug-in unit is transported It needs to use subtraction method during row, then, plug-in unit loads process by calling host process with the channels RPC of host process Subtraction method, so that the plug-in unit is handled using subtraction method, to obtain handling result.Plug-in unit load process obtains this and inserts Part operation as a result, the operation result of the plug-in unit is fed back to host process by the channels RPC with host process.
In addition, if the plug-in unit of load will produce image and audio, i.e. plug-in unit needs to show image and sound to main broadcaster, that Plug-in unit load process then need the image generated plug-in unit by the channels RPC with host process and audio transmission to master control into Journey.Then, the Image Rendering window that host process is generated further according to plug-in unit shows image, and by player plays audio, To which the image and sound that generate plug-in unit show main broadcaster.
Certainly, host process is equally also required to monitoring plug-in unit load process, therefore the embodiment of the invention also includes with lower section Case:
The host process monitors whether the plug-in unit load process collapses;
If the host process monitors the plug-in unit load process collapse, the plug-in unit load process is re-created.
Specifically, host process monitoring plug-in unit loads running state of a process, is collapsed if monitoring plug-in unit load process Burst, then re-created in such a way that establishments plug-in unit enumerator process described above and plug-in unit load process plug-in unit enumerator into Journey and plug-in unit load process, and just it is no longer repeated herein.
Based on inventive concept same as the method being broadcast live in previous embodiment, second aspect of the present invention also provides a kind of straight The device broadcast, as shown in Fig. 2, including:
Application program is broadcast live for starting main broadcaster end in start unit 101;
The host process of application program is broadcast live for obtaining the main broadcaster end for host process acquiring unit 102;
Process creation unit 103 loads process for creating coding pass and/or plug-in unit, and the coding pass is used for base Video flowing is encoded out in the control of the host process, and the video flowing, the plug-in unit load are fed back to the host process Process calls the plug-in unit loaded for loading plug-in unit in the plug-in unit load process, and according to the control of the host process;
Video flowing acquiring unit 104, for obtaining the video flowing;
Transmission unit 105 is used for the video stream to direct broadcast server, so that the direct broadcast server will be described Video flowing is transmitted to the spectators' end equipment for accessing the direct broadcast server.
Specifically, the host process acquiring unit 102 is for judging the pre-set main broadcaster end live streaming application The operational mode of program;If the operational mode is first mode, the master of the main broadcaster end live streaming application program is created Control process, wherein in the first mode, the host process will create the coding pass and the plug-in unit load into Journey;If the operational mode is second mode, the address of the preset host process is obtained, and access based on described address The host process, wherein in the second mode, the host process will create the coding pass and the plug-in unit adds It is loaded into journey.
Further, described device further includes:
Mode determination, for creating coding pass and/or plug-in unit load process by the host process described Before, judge the operational mode of the pre-set main broadcaster end live streaming application program;
Acquiring unit is marked, if being the third mode for the operational mode, is creating coding pass or plug-in unit load Before process, the marker bit for indicating to need to create the coding pass and/or plug-in unit load process is obtained;
If the marker bit be the first marker bit, the process creation unit 103 be specifically used for by the master control into Journey creates the plug-in unit and loads process;
If the marker bit be the second marker bit, the process creation unit 103 be specifically used for by the master control into Journey creates the coding pass.
Further, if the host process creates the coding pass, the video flowing acquiring unit 104 be used for Encode counterfoil module and send coded command, to notify the coding pass encoded video stream, the coding pass call with it is described The coding local service module of coding counterfoil module connection encodes out the video flowing, and the coding pass calls and the coding The video flowing that the coding agent interface module of local service module connection goes out to the video flowing acquiring unit feedback encoding.
And if the host process does not create the coding pass, for volume if video flowing acquiring unit 104 Code counterfoil module sends coded command, and the coding counterfoil module calls the coding being connect with the coding counterfoil module locally to take Business module coding goes out the video flowing, and the coding local service module calls the volume being connect with the coding local service module The video flowing that code proxy interface module goes out to the video flowing acquiring unit feedback encoding.
(1) if the embodiment of the present invention need create coding pass, the process creation unit 103 for call into Journey creates function, and the ID of the host process is passed to the process creation function, runs the process creation function creation institute Coding pass is stated, the coding pass initializes process context, and had based on the process creation function after the completion of establishment The ID connections host process for the host process having.
Further, described device further includes coding pass environment initial cell, is completed for being created in the coding pass Afterwards, process context, and the ID connections master control based on the host process possessed by the process creation function are initialized Process is specifically used for register initial service function and video flowing encoding service function in the coding pass, creates storage The video shared drive of audio-visual-materials and the audio shared drive for storing audio material, obtain the process creation function and are had The ID connections host process for the host process having, the connection based on the coding pass Yu the host process, to The host process sends the mark of the video shared drive and the mark of the audio shared drive.
Further, described device further includes coding initialization unit, for being encoded by the coding pass described Before going out video flowing and feeding back to the host process, initialization command, the initialization command are sent to the coding pass Include the nominal parameter for instructing the coding pass to determine solution harbour parameter, the solution harbour parameter includes video solution harbour Parameter and audio decoder head parameter run the initialization service function based on the initialization command, described specified to be based on Video solution harbour parameter described in gain of parameter and the audio decoder head parameter feed back the video decoding to the host process The head parameter and audio decoder head parameter, so that the host process is by the video solution harbour parameter and the audio decoder Head parameter is sent to the direct broadcast server, and the direct broadcast server is again by the video solution harbour parameter and the audio decoder Head parameter is transmitted to spectators' end equipment.
The video flowing acquiring unit 104 is used to receive the coded command that the host process is sent;Based on the coding Order, extraction is by the pre-stored audio-visual-materials of the host process from the video sharing memory, and from the audio Share in memory and extracts by the pre-stored audio material of the host process;Run video flowing encoding service function pair institute It states audio-visual-materials to be encoded, obtains video data encoder, and encode to the audio material, obtain audio coding number According to the video flowing includes the video data encoder and the coded audio data;By the video data encoder and described Coded audio data feeds back to the host process.
Further, described device further includes coding pass monitoring unit, for monitoring whether the coding pass collapses; If monitoring the coding pass collapse, the coding pass is re-created.
(2) if the host process creates the plug-in unit load process, described device further includes:
Plug-in unit loading unit needs to load in the live streaming application program for loading in the plug-in unit load process Target plug-in.
So, the process creation unit 103 is additionally operable to load in the plug-in unit load process and need in the live streaming Before the target plug-in loaded in application program, plug-in unit enumerator process is created;
Described device further includes plug-in unit enumeration unit, for being enumerated present in current load catalogue to the host process And the alternative plug-in unit that can be loaded;
Determination unit determines the target plug-in from the alternative plug-in unit for determining, and the plug-in unit is notified to add It is loaded into Cheng Suoshu target plug-ins.
Specifically, the process creation unit 103 creates function for calling process, and the ID of the host process is passed Enter the process creation function, runs plug-in unit enumerator process described in the process creation function creation, the plug-in unit enumerator Process initializes process context, and based on the host process possessed by the process creation function after the completion of establishment The ID connections host process.
Further, described device further include plug-in unit load process context initial cell, for the plug-in unit enumerator into After the completion of journey creates, process context is initialized, and connect based on the ID of the host process possessed by the process creation function The host process is connect, function is exited specifically for registering to enumerate plug-in unit function and enumerate in the plug-in unit enumerator process, Obtain the ID connections host process of the host process possessed by the process creation function.
Further, the plug-in unit enumeration unit is used to receive the instruction of enumerating that the host process sends, described in calling It enumerates plug-in unit function process and reads all plug-in units loaded under catalogue;Legal insert is filtered out from all plug-in units Part;The spare plug-in unit that the main broadcaster end live streaming application program is supported is filtered out from the legal plug-in unit.
Further, described device further includes exiting unit, for the plug-in unit enumerator process to the master control into Journey is enumerated present in current load catalogue and after the alternative plug-in unit that can be loaded, and is moved back to plug-in unit enumerator process transmission Go out instruction, based on the exit instruction call described in enumerate and exit function and terminate process.
Further, described device further includes plug-in unit load process monitoring unit, and process is loaded for monitoring the plug-in unit Whether collapse, if monitoring the plug-in unit load process collapse, re-creates the plug-in unit load process.
The various change mode and specific example of the method for live streaming in 1 embodiment of earlier figures are equally applicable to the present embodiment Live streaming device, by the detailed description of the aforementioned method to live streaming, those skilled in the art are clear that this reality The implementation for the device being broadcast live in example is applied, so in order to illustrate the succinct of book, this will not be detailed here.
Based on inventive concept same as the method being broadcast live in previous embodiment, the present invention also provides a kind of computer-readable Storage medium is stored thereon with computer program, which realizes appointing for the method for live streaming described previously when being executed by processor The step of one method.
Based on inventive concept same as the method being broadcast live in previous embodiment, the present invention also provides a kind of computers to set It is standby, as shown in figure 3, including memory 204, processor 202 and being stored on memory 204 and can run on processor 202 Computer program, the processor 202 execute described program when realize it is described previously control progress bar method either one The step of method.
Wherein, in figure 3, bus architecture (being represented with bus 200), bus 200 may include any number of interconnection Bus and bridge, bus 200 will include the one or more processors represented by processor 202 and what memory 204 represented deposits The various circuits of reservoir link together.Bus 200 can also will peripheral equipment, voltage-stablizer and management circuit etc. it Various other circuits of class link together, and these are all it is known in the art, therefore, are no longer carried out further to it herein Description.Bus interface 206 provides interface between bus 200 and receiver 201 and transmitter 203.Receiver 201 and transmitter 203 can be the same element, i.e. transceiver, provide the unit for being communicated over a transmission medium with various other devices.
Processor 202 is responsible for bus 200 and common processing, and memory 204 can be used to store processor 202 execute operate when used data.
Said one in the embodiment of the present application or multiple technical solutions at least have following one or more technology effects Fruit:
In the technical solution of the embodiment of the present invention, starts main broadcaster end first and application program is broadcast live, and it is straight to obtain main broadcaster end The host process of application program is broadcast, then host process further creates coding pass, and video flowing is encoded out by coding pass And host process is fed back to, host process is again by video stream to direct broadcast server, so that direct broadcast server circulates video Issue spectators' end equipment of access direct broadcast server.Since the embodiment of the present invention uses multi-process, regarded using coding pass coding Frequency flows, so the exception of encoding function does not interfere with host process, is led so avoiding since one or more functions are abnormal Cause program crashing so that main broadcaster end live streaming application program is more stably run, and thus solves of the existing technology how to carry The technical issues of high main broadcaster end live streaming program operation stability.
It should be understood by those skilled in the art that, the embodiment of the present invention can be provided as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, the present invention can be used in one or more wherein include computer usable program code computer The computer program production implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) The form of product.
The present invention be with reference to according to the method for the embodiment of the present invention, the flow of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that can be realized by computer program instructions every first-class in flowchart and/or the block diagram The combination of flow and/or box in journey and/or box and flowchart and/or the block diagram.These computer programs can be provided Instruct the processor of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine so that the instruction executed by computer or the processor of other programmable data processing devices is generated for real The device for the function of being specified in present one flow of flow chart or one box of multiple flows and/or block diagram or multiple boxes.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that instruction generation stored in the computer readable memory includes referring to Enable the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one box of block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device so that count Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, in computer or The instruction executed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in a box or multiple boxes.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art God and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (8)

1. a kind of method of live streaming, which is characterized in that including:
Start main broadcaster end and application program is broadcast live;
Obtain the host process of the main broadcaster end live streaming application program;
The host process creates coding pass;The host process creates coding pass, including:The host process call into Journey creates function;The ID of the host process is passed to the process creation function by the host process;The host process fortune Coding pass described in the row process creation function creation, the coding pass initialize process context after the completion of establishment, and The ID connections host process based on the host process possessed by the process creation function;
Video flowing is encoded out by the coding pass and feeds back to the host process;It is described to be encoded by the coding pass Go out video flowing and feeds back to the host process, including:The host process sends coded command to coding counterfoil module, with logical Know the coding pass encoded video stream;The coding pass calls the coding local service being connect with the coding counterfoil module Module coding goes out the video flowing;The coding pass calls the coding agent interface being connect with the coding local service module The video flowing that module goes out to the host process feedback encoding;
The host process is by the video stream to direct broadcast server, so that the direct broadcast server circulates the video Issue the spectators' end equipment for accessing the direct broadcast server.
2. the method as described in claim 1, which is characterized in that the coding pass initializes process ring after the completion of establishment Border, and the ID connections host process based on the host process possessed by the process creation function, including:
The coding pass register initial service function and video flowing encoding service function;
It creates the video shared drive of storage audio-visual-materials and stores the audio shared drive of audio material;
Obtain the ID connections host process of the host process possessed by the process creation function;
Based on the connection with the host process, the mark of the video shared drive and the sound are sent to the host process The mark of frequency shared drive.
3. method as claimed in claim 2, which is characterized in that encode out video flowing and anti-by the coding pass described It feeds before the host process, further includes:
The host process sends initialization command to the coding pass, and the initialization command includes for instructing the volume Code process determines that the nominal parameter of solution harbour parameter, the solution harbour parameter include video solution harbour parameter and audio decoder head ginseng Number;
The coding pass is based on the initialization command and runs the initialization service function, is obtained with being based on the nominal parameter Obtain the video solution harbour parameter and the audio decoder head parameter;
The coding pass feeds back the video solution harbour parameter and the audio decoder head parameter to the host process, so that The video solution harbour parameter and the audio decoder head parameter are sent to the direct broadcast server by the host process, described The video solution harbour parameter and the audio decoder head parameter are transmitted to spectators' end equipment by direct broadcast server again.
4. method as claimed in claim 3, which is characterized in that described to encode out video flowing by the coding pass and feed back To the host process, including:
The coding pass receives the coded command that the host process is sent;
Based on the coded command, extraction is by the pre-stored video material of the host process from the video sharing memory Material, and share in memory from the audio and extract by the pre-stored audio material of the host process;
It runs audio-visual-materials described in the video flowing encoding service function pair to be encoded, obtains video data encoder and right The audio material is encoded, and obtains coded audio data, the video flowing includes the video data encoder and the sound Frequency coded data;
The video data encoder and the coded audio data are fed back into the host process.
5. the method as described in claim 1, which is characterized in that the method further includes:
The host process monitors whether the coding pass collapses;
If the host process monitors the coding pass collapse, the coding pass is re-created.
6. a kind of device of live streaming, which is characterized in that including:
Application program is broadcast live for starting main broadcaster end in start unit;
The host process of application program is broadcast live for obtaining the main broadcaster end for host process acquiring unit;
Process creation unit, for creating coding pass;Wherein, the process creation unit creates function for calling process, The ID of the host process is passed to the process creation function, runs coding pass described in the process creation function creation, The coding pass initializes process context, and based on the master possessed by the process creation function after the completion of establishment The ID connections host process of control process;
Video flowing acquiring unit encodes out video flowing and feeds back to the host process for passing through the coding pass;Wherein, The video flowing acquiring unit is used to send coded command to coding counterfoil module, to notify the coding pass encoded video Stream, the coding pass call the coding local service module being connect with the coding counterfoil module to encode out the video flowing, The coding pass calls the coding agent interface module being connect with the coding local service module to be obtained to the video flowing The video flowing that unit feedback encoding goes out;
Transmission unit, for by the video stream to direct broadcast server, so that the direct broadcast server is by the video flowing It is transmitted to the spectators' end equipment for accessing the direct broadcast server.
7. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is held by processor The step of any one of claim 1-5 the methods are realized when row.
8. a kind of computer equipment, including memory, processor and storage are on a memory and the meter that can run on a processor Calculation machine program, which is characterized in that the processor realizes the step of any one of claim 1-5 the methods when executing described program Suddenly.
CN201710930142.1A 2017-10-09 2017-10-09 A kind of method and apparatus of live streaming Active CN107770567B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710930142.1A CN107770567B (en) 2017-10-09 2017-10-09 A kind of method and apparatus of live streaming
PCT/CN2017/109670 WO2019071679A1 (en) 2017-10-09 2017-11-07 Method and device for live streaming

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710930142.1A CN107770567B (en) 2017-10-09 2017-10-09 A kind of method and apparatus of live streaming

Publications (2)

Publication Number Publication Date
CN107770567A CN107770567A (en) 2018-03-06
CN107770567B true CN107770567B (en) 2018-08-21

Family

ID=61267910

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710930142.1A Active CN107770567B (en) 2017-10-09 2017-10-09 A kind of method and apparatus of live streaming

Country Status (2)

Country Link
CN (1) CN107770567B (en)
WO (1) WO2019071679A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108777812B (en) * 2018-06-25 2021-03-23 香港乐蜜有限公司 Screen recording live broadcast method and device, electronic equipment and storage medium
CN112040259A (en) * 2020-08-28 2020-12-04 广州华多网络科技有限公司 Method, server, system, storage medium and equipment for continuous playing

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104333770A (en) * 2014-11-20 2015-02-04 广州华多网络科技有限公司 Method and device for live video streaming
CN105681212A (en) * 2016-03-21 2016-06-15 广州盈可视电子科技有限公司 Video playing state monitoring method and device
CN106713304A (en) * 2016-12-19 2017-05-24 北京星辰美豆文化传播有限公司 Webcast method, apparatus and electronic equipment
CN107613312A (en) * 2017-10-09 2018-01-19 武汉斗鱼网络科技有限公司 A kind of live method and apparatus

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9584564B2 (en) * 2007-12-21 2017-02-28 Brighttalk Ltd. Systems and methods for integrating live audio communication in a live web event
CN101739300A (en) * 2008-11-18 2010-06-16 中兴通讯股份有限公司 Method and system for inter-process communication of multimedia terminal
CN101742218B (en) * 2010-01-19 2012-02-01 南京邮电大学 Implementation method of videophone system among IPTV set top boxes
CN104053014B (en) * 2013-03-13 2020-05-29 腾讯科技(北京)有限公司 Live broadcast system and method based on mobile terminal and mobile terminal
US9792716B2 (en) * 2014-06-13 2017-10-17 Arcsoft Inc. Enhancing video chatting
CN104850456A (en) * 2015-05-27 2015-08-19 苏州科达科技股份有限公司 Multi-process decoding method and multi-process decoding system
CN105872827A (en) * 2015-12-07 2016-08-17 乐视云计算有限公司 Live broadcast method and device of application interface in mobile terminal
US9602846B1 (en) * 2016-08-31 2017-03-21 Living As One, Llc System and method for asynchronous uploading of live digital multimedia with guaranteed delivery
CN106792034A (en) * 2017-02-10 2017-05-31 深圳创维-Rgb电子有限公司 Live method and mobile terminal is carried out based on mobile terminal

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104333770A (en) * 2014-11-20 2015-02-04 广州华多网络科技有限公司 Method and device for live video streaming
CN105681212A (en) * 2016-03-21 2016-06-15 广州盈可视电子科技有限公司 Video playing state monitoring method and device
CN106713304A (en) * 2016-12-19 2017-05-24 北京星辰美豆文化传播有限公司 Webcast method, apparatus and electronic equipment
CN107613312A (en) * 2017-10-09 2018-01-19 武汉斗鱼网络科技有限公司 A kind of live method and apparatus

Also Published As

Publication number Publication date
CN107770567A (en) 2018-03-06
WO2019071679A1 (en) 2019-04-18

Similar Documents

Publication Publication Date Title
CN107678801B (en) A kind of method and apparatus of plug-in unit load
CN107613312B (en) A kind of method and apparatus of live streaming
CN105635751B (en) A kind of video cloud platform plays the method and device of video
CN114501062B (en) Video rendering coordination method, device, equipment and storage medium
CN104837052A (en) Playing method of multimedia data and device
CN107770567B (en) A kind of method and apparatus of live streaming
CN109640191A (en) A kind of method and apparatus of even wheat live streaming
CN102855133A (en) Interactive system of computer processing unit
CN105451071A (en) Video stream processing method, device and system
CN113965751B (en) Screen content coding method, device, equipment and storage medium
CN107484010A (en) A kind of video resource coding/decoding method and device
CN102857533B (en) A kind of long-distance interactive system based on cloud computing
CN102857531B (en) A kind of long-distance interactive system based on cloud computing
CN104834649B (en) It can realize the smart machine and multiple-equipment team working method of more equipment collaborations
CN112843676A (en) Data processing method, device, terminal, server and storage medium
CN106797398A (en) Method and system for providing from virtual desktop serve to client
CN104067627A (en) Video redirecting method, device, system and computer readable medium
CN101009836B (en) Embedded video playing device based on the dual processor
US9118947B2 (en) Multi-vision virtualization system and method
CN108055594A (en) Implementation method, device, computer equipment and the storage medium of edge section
CN101622873B (en) Method for the delivery of audio and video data sequences by a server
CN113766266B (en) Audio and video processing method, device, equipment and storage medium
CN102857534A (en) Remote interaction method on basis of cloud computing
CN102857535B (en) A kind of computer processing unit, computer gateway, interactive system
KR101647099B1 (en) Server structure for supporting virtual multi session

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant