OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/filters/chunk_demuxer.h" | 5 #include "media/filters/chunk_demuxer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 | 1398 |
1399 // Map of source id to timestamp offset to use for the next AppendData() | 1399 // Map of source id to timestamp offset to use for the next AppendData() |
1400 // operation for that source id. | 1400 // operation for that source id. |
1401 std::map<std::string, base::TimeDelta> timestamp_offset_map_; | 1401 std::map<std::string, base::TimeDelta> timestamp_offset_map_; |
1402 | 1402 |
1403 public: | 1403 public: |
1404 void InitSegmentReceived(std::unique_ptr<MediaTracks> tracks) { | 1404 void InitSegmentReceived(std::unique_ptr<MediaTracks> tracks) { |
1405 DCHECK(tracks.get()); | 1405 DCHECK(tracks.get()); |
1406 DCHECK_GT(tracks->tracks().size(), 0u); | 1406 DCHECK_GT(tracks->tracks().size(), 0u); |
1407 | 1407 |
| 1408 // Verify that track ids are unique. |
| 1409 std::set<MediaTrack::Id> track_ids; |
| 1410 for (const auto& track : tracks->tracks()) { |
| 1411 EXPECT_EQ(track_ids.end(), track_ids.find(track->id())); |
| 1412 track_ids.insert(track->id()); |
| 1413 } |
| 1414 |
1408 InitSegmentReceivedMock(tracks); | 1415 InitSegmentReceivedMock(tracks); |
1409 } | 1416 } |
1410 | 1417 |
1411 private: | 1418 private: |
1412 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxerTest); | 1419 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxerTest); |
1413 }; | 1420 }; |
1414 | 1421 |
1415 TEST_F(ChunkDemuxerTest, Init) { | 1422 TEST_F(ChunkDemuxerTest, Init) { |
1416 InSequence s; | 1423 InSequence s; |
1417 | 1424 |
(...skipping 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4680 cluster->size() - video_start); | 4687 cluster->size() - video_start); |
4681 | 4688 |
4682 CheckExpectedRanges(DemuxerStream::AUDIO, "{ [30,90) }"); | 4689 CheckExpectedRanges(DemuxerStream::AUDIO, "{ [30,90) }"); |
4683 CheckExpectedRanges(DemuxerStream::VIDEO, "{ [0,91) }"); | 4690 CheckExpectedRanges(DemuxerStream::VIDEO, "{ [0,91) }"); |
4684 CheckExpectedRanges("{ [30,90) }"); | 4691 CheckExpectedRanges("{ [30,90) }"); |
4685 CheckExpectedBuffers(audio_stream, "30K 40K 50K 60K 70K 80K"); | 4692 CheckExpectedBuffers(audio_stream, "30K 40K 50K 60K 70K 80K"); |
4686 CheckExpectedBuffers(video_stream, "71K 81"); | 4693 CheckExpectedBuffers(video_stream, "71K 81"); |
4687 } | 4694 } |
4688 | 4695 |
4689 } // namespace media | 4696 } // namespace media |
OLD | NEW |