1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

for #250, merge avc to codec. use queue to dequeue.

This commit is contained in:
winlin 2015-01-31 21:16:42 +08:00
parent 153a3a6c42
commit 4246be92c9
12 changed files with 959 additions and 928 deletions

View file

@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class sockaddr_in;
#include <string>
#include <map>
class SrsStream;
class SrsTsContext;
@ -43,6 +44,7 @@ class SrsRtmpClient;
class SrsStSocket;
class SrsRequest;
class SrsRawH264Stream;
class SrsSharedPtrMessage;
#include <srs_app_st.hpp>
#include <srs_kernel_ts.hpp>
@ -68,6 +70,26 @@ public:
virtual int on_udp_packet(sockaddr_in* from, char* buf, int nb_buf) = 0;
};
/**
* the queue for mpegts over udp to send packets.
* for the aac in mpegts contains many flv packets in a pes packet,
* we must recalc the timestamp.
*/
class SrsMpegtsQueue
{
private:
// key: dts, value: msg.
std::map<int64_t, SrsSharedPtrMessage*> msgs;
int nb_audios;
int nb_videos;
public:
SrsMpegtsQueue();
virtual ~SrsMpegtsQueue();
public:
virtual int push(SrsSharedPtrMessage* msg);
virtual SrsSharedPtrMessage* dequeue();
};
/**
* the mpegts over udp stream caster.
*/
@ -92,6 +114,7 @@ private:
std::string h264_pps;
bool h264_pps_changed;
bool h264_sps_pps_sent;
SrsMpegtsQueue* queue;
public:
SrsMpegtsOverUdp(SrsConfDirective* c);
virtual ~SrsMpegtsOverUdp();