Skip to content

Commit 1685cdd

Browse files
committed
for ossrs#250, parse pes packet ok, ts message ok.
1 parent 4862770 commit 1685cdd

File tree

6 files changed

+740
-25
lines changed

6 files changed

+740
-25
lines changed

trunk/research/hls/ts_info.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,8 @@ int TSPayloadPES::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t
15391539
// for (i = 0; i < PES_packet_length; i++) {
15401540
// PES_packet_data_byte
15411541
// }
1542-
} else if (stream_id != PES_padding_stream) {
1542+
// TODO: FIXME: implements it.
1543+
} else if (stream_id == PES_padding_stream) {
15431544
// for (i = 0; i < PES_packet_length; i++) {
15441545
// padding_byte
15451546
// }

trunk/src/app/srs_app_mpegts_udp.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf)
7373

7474
// process each ts packet
7575
if ((ret = on_ts_packet(stream)) != ERROR_SUCCESS) {
76-
break;
76+
srs_warn("mpegts: ignore parse ts packet failed. ret=%d", ret);
77+
continue;
7778
}
7879
srs_info("mpegts: parse ts packet completed");
7980
}
@@ -86,12 +87,19 @@ int SrsMpegtsOverUdp::on_ts_packet(SrsStream* stream)
8687
{
8788
int ret = ERROR_SUCCESS;
8889

89-
if ((ret = context->decode(stream)) != ERROR_SUCCESS) {
90+
if ((ret = context->decode(stream, this)) != ERROR_SUCCESS) {
9091
srs_error("mpegts: decode ts packet failed. ret=%d", ret);
9192
return ret;
9293
}
9394

9495
return ret;
9596
}
9697

98+
int SrsMpegtsOverUdp::on_ts_message(SrsTsMessage* msg)
99+
{
100+
int ret = ERROR_SUCCESS;
101+
// TODO: FIXME: implements it.
102+
return ret;
103+
}
104+
97105
#endif

trunk/src/app/srs_app_mpegts_udp.hpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ class SrsConfDirective;
3939

4040
#ifdef SRS_AUTO_STREAM_CASTER
4141

42+
#include <srs_kernel_ts.hpp>
43+
4244
/**
4345
* the mpegts over udp stream caster.
4446
*/
45-
class SrsMpegtsOverUdp
47+
class SrsMpegtsOverUdp : public ISrsTsHandler
4648
{
4749
private:
4850
SrsStream* stream;
@@ -67,6 +69,9 @@ class SrsMpegtsOverUdp
6769
* the stream contains the ts packet to parse.
6870
*/
6971
virtual int on_ts_packet(SrsStream* stream);
72+
// interface ISrsTsHandler
73+
public:
74+
virtual int on_ts_message(SrsTsMessage* msg);
7075
};
7176

7277
#endif

trunk/src/kernel/srs_kernel_error.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
226226
#define ERROR_STREAM_CASTER_TS_PSI 4016
227227
#define ERROR_STREAM_CASTER_TS_PAT 4017
228228
#define ERROR_STREAM_CASTER_TS_PMT 4018
229+
#define ERROR_STREAM_CASTER_TS_PSE 4019
229230

230231
/**
231232
* whether the error code is an system control error.

0 commit comments

Comments
 (0)