Log an error when seeing unsupported stream type in MPEG2TS

The error is logged only once to avoid log spamming.

Added definitions for the unsupported stream types for easy look up.

Change-Id: I097e2f05759bc84ef03f264cfabd2fb20da7c711
This commit is contained in:
KongQun Yang 2017-12-01 14:53:20 -08:00
parent e7540bf303
commit 0fdb0d02aa
3 changed files with 25 additions and 4 deletions

View File

@ -306,10 +306,13 @@ void Mp2tMediaParser::RegisterPes(int pmt_pid,
sbr_in_mimetype_)); sbr_in_mimetype_));
is_audio = true; is_audio = true;
break; break;
default: default: {
VLOG(1) << "Ignore unsupported stream type 0x" << std::hex << stream_type LOG_IF(ERROR, !stream_type_logged_once_[stream_type])
<< std::dec; << "Ignore unsupported MPEG2TS stream type 0x" << std::hex
<< stream_type << std::dec;
stream_type_logged_once_[stream_type] = true;
return; return;
}
} }
// Create the PES state here. // Create the PES state here.

View File

@ -87,6 +87,10 @@ class Mp2tMediaParser : public MediaParser {
// Whether |init_cb_| has been invoked. // Whether |init_cb_| has been invoked.
bool is_initialized_; bool is_initialized_;
// A map used to track unsupported stream types and make sure the error is
// only logged once.
std::map<uint8_t, bool> stream_type_logged_once_;
DISALLOW_COPY_AND_ASSIGN(Mp2tMediaParser); DISALLOW_COPY_AND_ASSIGN(Mp2tMediaParser);
}; };

View File

@ -15,12 +15,26 @@ namespace mp2t {
enum class TsStreamType { enum class TsStreamType {
// ISO-13818.1 / ITU H.222 Table 2-34 "Stream type assignments" // ISO-13818.1 / ITU H.222 Table 2-34 "Stream type assignments"
kMpeg1Video = 0x01, // ISO/IEC 11172-2 Video
kMpeg2Video = 0x02, // ITU-T H.262 | ISO/IEC 13818-2 Video |
// ISO/IEC 11172-2 constrained parameter video stream
kMpeg1Audio = 0x03, // ISO/IEC 11172-3 Audio
kMpeg2Audio = 0x04, // ISO/IEC 13818-3 Audio
kPesPrivateData =
0x06, // ISO/IEC 13818-1 PES packets containing private data. It is also
// used by DVB (TS 101 154 DVB specification ...) to carry AC3 in
// TS (while ATSC uses 0x81 defined below).
kAdtsAac = 0x0F, kAdtsAac = 0x0F,
kAvc = 0x1B, kAvc = 0x1B,
kHevc = 0x24, kHevc = 0x24,
// ATSC Standard A/52. // Below are extensions defined in other specifications.
// AC3 and E-AC3 are defined in ATSC Standard A/52.
// Cannot find specification for DTS-HD and DTS. They are extracted from
// https://sno.phy.queensu.ca/~phil/exiftool/TagNames/M2TS.html.
kAc3 = 0x81, kAc3 = 0x81,
kDtsHd = 0x86,
kEac3 = 0x87, kEac3 = 0x87,
kDts = 0x8A,
// MPEG-2 Stream Encryption Format for HTTP Live Streaming: // MPEG-2 Stream Encryption Format for HTTP Live Streaming:
// https://goo.gl/N7Tvqi. // https://goo.gl/N7Tvqi.
kEncryptedAc3 = 0xC1, kEncryptedAc3 = 0xC1,