OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // their sequence of decode timestamps; a |kEnd| timestamp indicates the | 43 // their sequence of decode timestamps; a |kEnd| timestamp indicates the |
44 // end of the sequence and no buffer is appended for it. Each new buffer's | 44 // end of the sequence and no buffer is appended for it. Each new buffer's |
45 // type will be |type| with track ID set to |track_id|. | 45 // type will be |type| with track ID set to |track_id|. |
46 static void GenerateBuffers(const int* decode_timestamps, | 46 static void GenerateBuffers(const int* decode_timestamps, |
47 StreamParserBuffer::Type type, | 47 StreamParserBuffer::Type type, |
48 TrackId track_id, | 48 TrackId track_id, |
49 BufferQueue* queue) { | 49 BufferQueue* queue) { |
50 DCHECK(decode_timestamps); | 50 DCHECK(decode_timestamps); |
51 DCHECK(queue); | 51 DCHECK(queue); |
52 DCHECK_NE(type, DemuxerStream::UNKNOWN); | 52 DCHECK_NE(type, DemuxerStream::UNKNOWN); |
53 DCHECK_LT(type, DemuxerStream::NUM_TYPES); | 53 DCHECK_LE(type, DemuxerStream::TYPE_MAX); |
54 for (int i = 0; decode_timestamps[i] != kEnd; ++i) { | 54 for (int i = 0; decode_timestamps[i] != kEnd; ++i) { |
55 scoped_refptr<StreamParserBuffer> buffer = | 55 scoped_refptr<StreamParserBuffer> buffer = |
56 StreamParserBuffer::CopyFrom(kFakeData, sizeof(kFakeData), | 56 StreamParserBuffer::CopyFrom(kFakeData, sizeof(kFakeData), |
57 true, type, track_id); | 57 true, type, track_id); |
58 buffer->SetDecodeTimestamp( | 58 buffer->SetDecodeTimestamp( |
59 DecodeTimestamp::FromMicroseconds(decode_timestamps[i])); | 59 DecodeTimestamp::FromMicroseconds(decode_timestamps[i])); |
60 queue->push_back(buffer); | 60 queue->push_back(buffer); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 VerifyMergeSuccess(expected, true); | 364 VerifyMergeSuccess(expected, true); |
365 | 365 |
366 // But appending something with a lower timestamp than the last timestamp | 366 // But appending something with a lower timestamp than the last timestamp |
367 // in the pre-existing merge result should fail. | 367 // in the pre-existing merge result should fail. |
368 int more_audio_timestamps[] = { 106, kEnd }; | 368 int more_audio_timestamps[] = { 106, kEnd }; |
369 GenerateAudioBuffers(more_audio_timestamps); | 369 GenerateAudioBuffers(more_audio_timestamps); |
370 VerifyMergeFailure(); | 370 VerifyMergeFailure(); |
371 } | 371 } |
372 | 372 |
373 } // namespace media | 373 } // namespace media |
OLD | NEW |