diff options
author | servolk <servolk@chromium.org> | 2014-10-02 19:11:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-03 02:12:10 +0000 |
commit | d13162c7e375a4741fb9b75eb488b3e5832d57c3 (patch) | |
tree | 9d721438adc81e4a78bfe154a6240054098761ab | |
parent | ab7c20fb1a43407e6ef8ce1a48dbeed27fcf7eee (diff) | |
download | chromium_src-d13162c7e375a4741fb9b75eb488b3e5832d57c3.zip chromium_src-d13162c7e375a4741fb9b75eb488b3e5832d57c3.tar.gz chromium_src-d13162c7e375a4741fb9b75eb488b3e5832d57c3.tar.bz2 |
MSE: Allow parsing of private_stream_1 in mp2t parser
According to ITU-T Rec. H.222.0 standard, private_stream_1
has the same syntax as other audio/video streams, so our
mp2t parser should be able to handle it. We have seen .ts
files that have AAC audio in private_stream_1. VLC is able
to play such streams, and so should we.
BUG=419130
Review URL: https://codereview.chromium.org/606923003
Cr-Commit-Position: refs/heads/master@{#297970}
-rw-r--r-- | media/formats/mp2t/mp2t_stream_parser_unittest.cc | 18 | ||||
-rw-r--r-- | media/formats/mp2t/ts_section_pes.cc | 9 | ||||
-rw-r--r-- | media/test/data/bear_adts_in_private_stream_1.ts | bin | 0 -> 27261 bytes |
3 files changed, 24 insertions, 3 deletions
diff --git a/media/formats/mp2t/mp2t_stream_parser_unittest.cc b/media/formats/mp2t/mp2t_stream_parser_unittest.cc index 041ae49..bca3831 100644 --- a/media/formats/mp2t/mp2t_stream_parser_unittest.cc +++ b/media/formats/mp2t/mp2t_stream_parser_unittest.cc @@ -52,6 +52,7 @@ class Mp2tStreamParserTest : public testing::Test { config_count_(0), audio_frame_count_(0), video_frame_count_(0), + has_video_(true), audio_min_dts_(kNoDecodeTimestamp()), audio_max_dts_(kNoDecodeTimestamp()), video_min_dts_(kNoDecodeTimestamp()), @@ -66,6 +67,7 @@ class Mp2tStreamParserTest : public testing::Test { int config_count_; int audio_frame_count_; int video_frame_count_; + bool has_video_; DecodeTimestamp audio_min_dts_; DecodeTimestamp audio_max_dts_; DecodeTimestamp video_min_dts_; @@ -111,10 +113,9 @@ class Mp2tStreamParserTest : public testing::Test { const StreamParser::TextTrackConfigMap& tc) { DVLOG(1) << "OnNewConfig: audio=" << ac.IsValidConfig() << ", video=" << vc.IsValidConfig(); - // Test streams have both audio and video, verify the configs are valid. config_count_++; EXPECT_TRUE(ac.IsValidConfig()); - EXPECT_TRUE(vc.IsValidConfig()); + EXPECT_EQ(vc.IsValidConfig(), has_video_); return true; } @@ -283,5 +284,18 @@ TEST_F(Mp2tStreamParserTest, TimestampWrapAround) { DecodeTimestamp::FromSecondsD(95446.117))); } +TEST_F(Mp2tStreamParserTest, AudioInPrivateStream1) { + // Test small, non-segment-aligned appends. + InitializeParser(); + has_video_ = false; + ParseMpeg2TsFile("bear_adts_in_private_stream_1.ts", 512); + parser_->Flush(); + EXPECT_EQ(audio_frame_count_, 40); + EXPECT_EQ(video_frame_count_, 0); + // This stream has no mid-stream configuration change. + EXPECT_EQ(config_count_, 1); + EXPECT_EQ(segment_count_, 1); +} + } // namespace mp2t } // namespace media diff --git a/media/formats/mp2t/ts_section_pes.cc b/media/formats/mp2t/ts_section_pes.cc index 63225db..6c74848 100644 --- a/media/formats/mp2t/ts_section_pes.cc +++ b/media/formats/mp2t/ts_section_pes.cc @@ -146,8 +146,15 @@ bool TsSectionPes::ParseInternal(const uint8* raw_pes, int raw_pes_size) { // See ITU H.222 Table 2-22 "Stream_id assignments" bool is_audio_stream_id = ((stream_id & 0xe0) == 0xc0); bool is_video_stream_id = ((stream_id & 0xf0) == 0xe0); - if (!is_audio_stream_id && !is_video_stream_id) + // According to ETSI DVB standard (ETSI TS 101 154) section 4.1.6.1 + // AC-3 and DTS audio streams may have stream_id 0xbd. These streams + // have the same syntax as regular audio streams. + bool is_private_stream_1 = (stream_id == 0xbd); + if (!is_audio_stream_id && !is_video_stream_id && !is_private_stream_1) { + DVLOG(LOG_LEVEL_PES) << "Dropped TsPacket for stream_id=0x" + << std::hex << stream_id << std::dec; return true; + } // Read up to "pes_header_data_length". int dummy_2; diff --git a/media/test/data/bear_adts_in_private_stream_1.ts b/media/test/data/bear_adts_in_private_stream_1.ts Binary files differnew file mode 100644 index 0000000..ffe0f4c --- /dev/null +++ b/media/test/data/bear_adts_in_private_stream_1.ts |