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 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 | 1397 |
1398 // Map of source id to timestamp offset to use for the next AppendData() | 1398 // Map of source id to timestamp offset to use for the next AppendData() |
1399 // operation for that source id. | 1399 // operation for that source id. |
1400 std::map<std::string, base::TimeDelta> timestamp_offset_map_; | 1400 std::map<std::string, base::TimeDelta> timestamp_offset_map_; |
1401 | 1401 |
1402 public: | 1402 public: |
1403 void InitSegmentReceived(std::unique_ptr<MediaTracks> tracks) { | 1403 void InitSegmentReceived(std::unique_ptr<MediaTracks> tracks) { |
1404 DCHECK(tracks.get()); | 1404 DCHECK(tracks.get()); |
1405 DCHECK_GT(tracks->tracks().size(), 0u); | 1405 DCHECK_GT(tracks->tracks().size(), 0u); |
1406 | 1406 |
| 1407 // Verify that track ids are unique. |
| 1408 std::set<MediaTrack::TrackId> track_ids; |
| 1409 for (const auto& track : tracks->tracks()) { |
| 1410 EXPECT_EQ(track_ids.end(), track_ids.find(track->id())); |
| 1411 track_ids.insert(track->id()); |
| 1412 } |
| 1413 |
1407 InitSegmentReceivedMock(tracks); | 1414 InitSegmentReceivedMock(tracks); |
1408 } | 1415 } |
1409 | 1416 |
1410 private: | 1417 private: |
1411 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxerTest); | 1418 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxerTest); |
1412 }; | 1419 }; |
1413 | 1420 |
1414 TEST_F(ChunkDemuxerTest, Init) { | 1421 TEST_F(ChunkDemuxerTest, Init) { |
1415 InSequence s; | 1422 InSequence s; |
1416 | 1423 |
(...skipping 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4679 cluster->size() - video_start); | 4686 cluster->size() - video_start); |
4680 | 4687 |
4681 CheckExpectedRanges(DemuxerStream::AUDIO, "{ [30,90) }"); | 4688 CheckExpectedRanges(DemuxerStream::AUDIO, "{ [30,90) }"); |
4682 CheckExpectedRanges(DemuxerStream::VIDEO, "{ [0,91) }"); | 4689 CheckExpectedRanges(DemuxerStream::VIDEO, "{ [0,91) }"); |
4683 CheckExpectedRanges("{ [30,90) }"); | 4690 CheckExpectedRanges("{ [30,90) }"); |
4684 CheckExpectedBuffers(audio_stream, "30K 40K 50K 60K 70K 80K"); | 4691 CheckExpectedBuffers(audio_stream, "30K 40K 50K 60K 70K 80K"); |
4685 CheckExpectedBuffers(video_stream, "71K 81"); | 4692 CheckExpectedBuffers(video_stream, "71K 81"); |
4686 } | 4693 } |
4687 | 4694 |
4688 } // namespace media | 4695 } // namespace media |
OLD | NEW |