mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
ignore when sps/pps consumed all frame.
This commit is contained in:
parent
b319e9ff9c
commit
1401f2e0ab
2 changed files with 12 additions and 9 deletions
|
@ -353,6 +353,7 @@ int SrsMpegtsOverUdp::on_ts_video(SrsTsMessage* msg, SrsStream* avs)
|
||||||
int ibpframe_size = avs->size() - avs->pos();
|
int ibpframe_size = avs->size() - avs->pos();
|
||||||
|
|
||||||
// send each frame.
|
// send each frame.
|
||||||
|
bool got_sps_pps = false;
|
||||||
while (!avs->empty()) {
|
while (!avs->empty()) {
|
||||||
char* frame = NULL;
|
char* frame = NULL;
|
||||||
int frame_size = 0;
|
int frame_size = 0;
|
||||||
|
@ -369,6 +370,8 @@ int SrsMpegtsOverUdp::on_ts_video(SrsTsMessage* msg, SrsStream* avs)
|
||||||
|
|
||||||
// for sps
|
// for sps
|
||||||
if (avc->is_sps(frame, frame_size)) {
|
if (avc->is_sps(frame, frame_size)) {
|
||||||
|
got_sps_pps = true;
|
||||||
|
|
||||||
std::string sps;
|
std::string sps;
|
||||||
if ((ret = avc->sps_demux(frame, frame_size, sps)) != ERROR_SUCCESS) {
|
if ((ret = avc->sps_demux(frame, frame_size, sps)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -388,6 +391,8 @@ int SrsMpegtsOverUdp::on_ts_video(SrsTsMessage* msg, SrsStream* avs)
|
||||||
|
|
||||||
// for pps
|
// for pps
|
||||||
if (avc->is_pps(frame, frame_size)) {
|
if (avc->is_pps(frame, frame_size)) {
|
||||||
|
got_sps_pps = true;
|
||||||
|
|
||||||
std::string pps;
|
std::string pps;
|
||||||
if ((ret = avc->pps_demux(frame, frame_size, pps)) != ERROR_SUCCESS) {
|
if ((ret = avc->pps_demux(frame, frame_size, pps)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -405,16 +410,13 @@ int SrsMpegtsOverUdp::on_ts_video(SrsTsMessage* msg, SrsStream* avs)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// regenerat the ibp frame.
|
break;
|
||||||
if (!avs->empty()) {
|
|
||||||
ibpframe = avs->data() + avs->pos();
|
|
||||||
ibpframe_size = avs->size() - avs->pos();
|
|
||||||
} else {
|
|
||||||
srs_info("mpegts: sps/pps frame consumed.");
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
// not ibp frame, ignore for already sent.
|
||||||
|
if (got_sps_pps) {
|
||||||
|
srs_info("mpegts: already send the sps/pps.");
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ibp frame.
|
// ibp frame.
|
||||||
|
|
|
@ -103,6 +103,7 @@ int SrsFlvEncoder::write_header(char flv_header[9])
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// previous tag size.
|
||||||
char pts[] = { (char)0x00, (char)0x00, (char)0x00, (char)0x00 };
|
char pts[] = { (char)0x00, (char)0x00, (char)0x00, (char)0x00 };
|
||||||
if ((ret = _fs->write(pts, 4, NULL)) != ERROR_SUCCESS) {
|
if ((ret = _fs->write(pts, 4, NULL)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue