mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #250, demux PES stream ok, only support h.264(annexb) and aac(adts) in mpegts over udp. 3.0.109.
This commit is contained in:
parent
bce78fdab6
commit
66fccdbbd1
5 changed files with 32 additions and 6 deletions
|
@ -38,6 +38,7 @@ using namespace std;
|
||||||
#include <srs_kernel_buffer.hpp>
|
#include <srs_kernel_buffer.hpp>
|
||||||
#include <srs_kernel_file.hpp>
|
#include <srs_kernel_file.hpp>
|
||||||
#include <srs_core_autofree.hpp>
|
#include <srs_core_autofree.hpp>
|
||||||
|
#include <srs_kernel_utility.hpp>
|
||||||
|
|
||||||
#ifdef SRS_AUTO_STREAM_CASTER
|
#ifdef SRS_AUTO_STREAM_CASTER
|
||||||
|
|
||||||
|
@ -160,8 +161,8 @@ int SrsMpegtsOverUdp::on_ts_message(SrsTsMessage* msg)
|
||||||
// for example, when SrsTsStream of SrsTsChannel indicates stream_type is SrsTsStreamVideoMpeg4 and SrsTsStreamAudioMpeg4,
|
// for example, when SrsTsStream of SrsTsChannel indicates stream_type is SrsTsStreamVideoMpeg4 and SrsTsStreamAudioMpeg4,
|
||||||
// the elementary stream can be mux in "2.11 Carriage of ISO/IEC 14496 data" in hls-mpeg-ts-iso13818-1.pdf, page 103
|
// the elementary stream can be mux in "2.11 Carriage of ISO/IEC 14496 data" in hls-mpeg-ts-iso13818-1.pdf, page 103
|
||||||
// @remark, the most popular stream_id is 0xe0 for h.264 over mpegts, which indicates the stream_id is video and
|
// @remark, the most popular stream_id is 0xe0 for h.264 over mpegts, which indicates the stream_id is video and
|
||||||
// stream_number is 0, where I guess the elementary is specified in 13818-2(video part).
|
// stream_number is 0, where I guess the elementary is specified in annexb format(H.264-AVC-ISO_IEC_14496-10.pdf, page 211).
|
||||||
// because when audio stream_number is 0, the elementary is ADTS specified in 13818-7(aac part).
|
// 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).
|
||||||
|
|
||||||
// about the bytes of PES_packet_data_byte, defined in hls-mpeg-ts-iso13818-1.pdf, page 58
|
// about the bytes of PES_packet_data_byte, defined in hls-mpeg-ts-iso13818-1.pdf, page 58
|
||||||
// PES_packet_data_byte ¨C PES_packet_data_bytes shall be contiguous bytes of data from the elementary stream
|
// 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)
|
||||||
// 14496-2 video stream number xxxx
|
// 14496-2 video stream number xxxx
|
||||||
// ((stream_id >> 4) & 0x0f) == SrsTsPESStreamIdVideo
|
// ((stream_id >> 4) & 0x0f) == SrsTsPESStreamIdVideo
|
||||||
|
|
||||||
srs_trace("mpegts: got %s dts=%"PRId64", pts=%"PRId64", size=%d, us=%d, cc=%d, sid=%#x(%s-%d)",
|
srs_trace("mpegts: got %s stream=%s, dts=%"PRId64", pts=%"PRId64", size=%d, us=%d, cc=%d, sid=%#x(%s-%d)",
|
||||||
(msg->channel->apply == SrsTsPidApplyVideo)? "Video":"Audio", msg->dts, msg->pts, msg->payload->length(),
|
(msg->channel->apply == SrsTsPidApplyVideo)? "Video":"Audio", srs_ts_stream2string(msg->channel->stream).c_str(),
|
||||||
msg->packet->payload_unit_start_indicator, msg->continuity_counter, msg->sid,
|
msg->dts, msg->pts, msg->payload->length(), msg->packet->payload_unit_start_indicator, msg->continuity_counter, msg->sid,
|
||||||
msg->is_audio()? "A":msg->is_video()? "V":"N", msg->stream_number());
|
msg->is_audio()? "A":msg->is_video()? "V":"N", msg->stream_number());
|
||||||
|
|
||||||
|
// when not audio/video, or not adts/annexb format, donot support.
|
||||||
|
if (msg->stream_number() != 0) {
|
||||||
|
ret = ERROR_STREAM_CASTER_TS_ES;
|
||||||
|
srs_error("mpegts: unsupported stream format, sid=%#x(%s-%d). ret=%d",
|
||||||
|
msg->sid, msg->is_audio()? "A":msg->is_video()? "V":"N", msg->stream_number(), ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: FIXME: implements it.
|
// TODO: FIXME: implements it.
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// current release version
|
// current release version
|
||||||
#define VERSION_MAJOR 2
|
#define VERSION_MAJOR 2
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 108
|
#define VERSION_REVISION 109
|
||||||
|
|
||||||
// server info.
|
// server info.
|
||||||
#define RTMP_SIG_SRS_KEY "SRS"
|
#define RTMP_SIG_SRS_KEY "SRS"
|
||||||
|
|
|
@ -227,6 +227,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#define ERROR_STREAM_CASTER_TS_PAT 4017
|
#define ERROR_STREAM_CASTER_TS_PAT 4017
|
||||||
#define ERROR_STREAM_CASTER_TS_PMT 4018
|
#define ERROR_STREAM_CASTER_TS_PMT 4018
|
||||||
#define ERROR_STREAM_CASTER_TS_PSE 4019
|
#define ERROR_STREAM_CASTER_TS_PSE 4019
|
||||||
|
#define ERROR_STREAM_CASTER_TS_ES 4020
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* whether the error code is an system control error.
|
* whether the error code is an system control error.
|
||||||
|
|
|
@ -402,6 +402,21 @@ SrsMpegtsFrame::SrsMpegtsFrame()
|
||||||
key = false;
|
key = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string srs_ts_stream2string(SrsTsStream stream)
|
||||||
|
{
|
||||||
|
switch (stream) {
|
||||||
|
case SrsTsStreamReserved: return "Reserved";
|
||||||
|
case SrsTsStreamAudioMp3: return "MP3";
|
||||||
|
case SrsTsStreamAudioAAC: return "AAC";
|
||||||
|
case SrsTsStreamAudioAC3: return "AC3";
|
||||||
|
case SrsTsStreamAudioDTS: return "AudioDTS";
|
||||||
|
case SrsTsStreamVideoH264: return "H.264";
|
||||||
|
case SrsTsStreamVideoMpeg4: return "MP4";
|
||||||
|
case SrsTsStreamAudioMpeg4: return "MP4A";
|
||||||
|
default: return "Other";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SrsTsChannel::SrsTsChannel()
|
SrsTsChannel::SrsTsChannel()
|
||||||
{
|
{
|
||||||
pid = 0;
|
pid = 0;
|
||||||
|
|
|
@ -174,6 +174,7 @@ enum SrsTsStream
|
||||||
SrsTsStreamAudioAC3 = 0x81,
|
SrsTsStreamAudioAC3 = 0x81,
|
||||||
SrsTsStreamAudioDTS = 0x8a,
|
SrsTsStreamAudioDTS = 0x8a,
|
||||||
};
|
};
|
||||||
|
std::string srs_ts_stream2string(SrsTsStream stream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the ts channel.
|
* the ts channel.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue