Chromium Code Reviews| Index: media/filters/chunk_demuxer_unittest.cc |
| diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc |
| index db320ba00e0e5ea5a0afccbcc2b0e2beb0222b25..c1864f7056845af72ab1064fd2f4e24a9168589d 100644 |
| --- a/media/filters/chunk_demuxer_unittest.cc |
| +++ b/media/filters/chunk_demuxer_unittest.cc |
| @@ -82,6 +82,8 @@ const int kVideoTrackSizeWidth = 8; |
| const int kVideoTrackEntryHeaderSize = |
| kVideoTrackSizeOffset + kVideoTrackSizeWidth; |
|
chcunningham
2016/06/02 21:24:45
Similar test for ffmpeg_demuxer would be good
servolk
2016/06/02 23:53:11
FFmpeg demuxer currently doesn't support mid-strea
|
| +// Track numbers AKA bytestream track ids. Bytestream track ids might change |
| +// within a single playback session if there is only one track of a given type. |
| const int kVideoTrackNum = 1; |
| const int kAudioTrackNum = 2; |
| const int kTextTrackNum = 3; |
| @@ -89,6 +91,14 @@ const int kAlternateVideoTrackNum = 4; |
| const int kAlternateAudioTrackNum = 5; |
| const int kAlternateTextTrackNum = 6; |
| +// These value represent externally assigned track ids (for example track ids |
| +// assigned by blink). Not to be confused with bytestream track ids above. The |
| +// main difference is that these track ids must stay the same for the duration |
| +// of the playback session, whereas track numbers / bytestream track ids might |
|
chcunningham
2016/06/02 21:24:45
I was surprised to read this. Looking at the code
servolk
2016/06/02 23:53:11
That's right. If we encounter a new bytestream tra
chcunningham
2016/06/03 20:42:49
I see. Are we missing some code in SourceBuffer.cp
|
| +// change in subsequent init segments. |
| +const int kVideoTrackId = 10; |
|
chcunningham
2016/06/02 21:24:45
Also, can you name these in a way that describes t
servolk
2016/06/02 23:53:11
Done.
|
| +const int kAudioTrackId = 11; |
| + |
| const int kAudioBlockDuration = 23; |
| const int kVideoBlockDuration = 33; |
| const int kTextBlockDuration = 100; |
| @@ -1404,6 +1414,18 @@ class ChunkDemuxerTest : public ::testing::Test { |
| DCHECK(tracks.get()); |
| DCHECK_GT(tracks->tracks().size(), 0u); |
|
chcunningham
2016/06/02 21:24:45
This is busted for multi-track right? You might as
servolk
2016/06/02 23:53:11
Yes, but there are many other places in Chromium m
|
| + std::vector<unsigned> track_ids; |
| + for (const auto& track : tracks->tracks()) { |
| + if (track->type() == MediaTrack::Audio) { |
| + track_ids.push_back(kAudioTrackId); |
| + } else if (track->type() == MediaTrack::Video) { |
| + track_ids.push_back(kVideoTrackId); |
| + } else { |
| + NOTREACHED(); |
| + } |
| + } |
| + demuxer_->OnTrackIdsAssigned(*tracks.get(), track_ids); |
| + |
| InitSegmentReceivedMock(tracks); |
| } |
| @@ -1603,6 +1625,8 @@ TEST_F(ChunkDemuxerTest, AudioVideoTrackIdsChange) { |
| DemuxerStream* video_stream = demuxer_->GetStream(DemuxerStream::VIDEO); |
| ASSERT_TRUE(audio_stream); |
| ASSERT_TRUE(video_stream); |
| + ASSERT_EQ(audio_stream, demuxer_->GetDemuxerStreamByTrackId(kAudioTrackId)); |
| + ASSERT_EQ(video_stream, demuxer_->GetDemuxerStreamByTrackId(kVideoTrackId)); |
| AppendMuxedCluster(MuxedStreamInfo(kAudioTrackNum, "0K 23K", 23), |
| MuxedStreamInfo(kVideoTrackNum, "0K 30", 30)); |
| @@ -1616,6 +1640,8 @@ TEST_F(ChunkDemuxerTest, AudioVideoTrackIdsChange) { |
| CheckExpectedRanges("{ [0,92) }"); |
| CheckExpectedBuffers(audio_stream, "0K 23K 46K 69K"); |
| CheckExpectedBuffers(video_stream, "0K 30 60K"); |
| + ASSERT_EQ(audio_stream, demuxer_->GetDemuxerStreamByTrackId(kAudioTrackId)); |
| + ASSERT_EQ(video_stream, demuxer_->GetDemuxerStreamByTrackId(kVideoTrackId)); |
| ShutdownDemuxer(); |
| } |