@@ -38,6 +38,7 @@ using namespace std;
38
38
#include < srs_kernel_buffer.hpp>
39
39
#include < srs_kernel_file.hpp>
40
40
#include < srs_core_autofree.hpp>
41
+ #include < srs_kernel_utility.hpp>
41
42
42
43
#ifdef SRS_AUTO_STREAM_CASTER
43
44
@@ -160,8 +161,8 @@ int SrsMpegtsOverUdp::on_ts_message(SrsTsMessage* msg)
160
161
// for example, when SrsTsStream of SrsTsChannel indicates stream_type is SrsTsStreamVideoMpeg4 and SrsTsStreamAudioMpeg4,
161
162
// the elementary stream can be mux in "2.11 Carriage of ISO/IEC 14496 data" in hls-mpeg-ts-iso13818-1.pdf, page 103
162
163
// @remark, the most popular stream_id is 0xe0 for h.264 over mpegts, which indicates the stream_id is video and
163
- // stream_number is 0, where I guess the elementary is specified in 13818-2(video part ).
164
- // because when audio stream_number is 0, the elementary is ADTS specified in 13818-7(aac part ).
164
+ // stream_number is 0, where I guess the elementary is specified in annexb format(H.264-AVC-ISO_IEC_14496-10.pdf, page 211 ).
165
+ // because when audio stream_number is 0, the elementary is ADTS(aac-mp4a-format-ISO_IEC_14496-3+2001.pdf, page 75, 1.A.2.2 ADTS ).
165
166
166
167
// about the bytes of PES_packet_data_byte, defined in hls-mpeg-ts-iso13818-1.pdf, page 58
167
168
// PES_packet_data_byte ¨C PES_packet_data_bytes shall be contiguous bytes of data from the elementary stream
@@ -193,11 +194,19 @@ int SrsMpegtsOverUdp::on_ts_message(SrsTsMessage* msg)
193
194
// 14496-2 video stream number xxxx
194
195
// ((stream_id >> 4) & 0x0f) == SrsTsPESStreamIdVideo
195
196
196
- srs_trace (" mpegts: got %s dts=%" PRId64" , pts=%" PRId64" , size=%d, us=%d, cc=%d, sid=%#x(%s-%d)" ,
197
- (msg->channel ->apply == SrsTsPidApplyVideo)? " Video" :" Audio" , msg->dts , msg-> pts , msg-> payload -> length (),
198
- msg->packet ->payload_unit_start_indicator , msg->continuity_counter , msg->sid ,
197
+ srs_trace (" mpegts: got %s stream=%s, dts=%" PRId64" , pts=%" PRId64" , size=%d, us=%d, cc=%d, sid=%#x(%s-%d)" ,
198
+ (msg->channel ->apply == SrsTsPidApplyVideo)? " Video" :" Audio" , srs_ts_stream2string ( msg->channel -> stream ). c_str (),
199
+ msg->dts , msg-> pts , msg-> payload -> length (), msg-> packet ->payload_unit_start_indicator , msg->continuity_counter , msg->sid ,
199
200
msg->is_audio ()? " A" :msg->is_video ()? " V" :" N" , msg->stream_number ());
200
201
202
+ // when not audio/video, or not adts/annexb format, donot support.
203
+ if (msg->stream_number () != 0 ) {
204
+ ret = ERROR_STREAM_CASTER_TS_ES;
205
+ srs_error (" mpegts: unsupported stream format, sid=%#x(%s-%d). ret=%d" ,
206
+ msg->sid , msg->is_audio ()? " A" :msg->is_video ()? " V" :" N" , msg->stream_number (), ret);
207
+ return ret;
208
+ }
209
+
201
210
// TODO: FIXME: implements it.
202
211
return ret;
203
212
}
0 commit comments