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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 // |queue|. |decode_timestamps| determines the number of appended buffers and | 42 // |queue|. |decode_timestamps| determines the number of appended buffers and |
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_LT(type, DemuxerStream::UNKNOWN); |
jrummell
2016/10/14 22:13:24
Should this not be TYPE_MAX? UNKNOWN is 0. Maybe k
xhwang
2016/10/15 05:13:22
Good catch. Done.
| |
53 DCHECK_LT(type, DemuxerStream::NUM_TYPES); | |
54 for (int i = 0; decode_timestamps[i] != kEnd; ++i) { | 53 for (int i = 0; decode_timestamps[i] != kEnd; ++i) { |
55 scoped_refptr<StreamParserBuffer> buffer = | 54 scoped_refptr<StreamParserBuffer> buffer = |
56 StreamParserBuffer::CopyFrom(kFakeData, sizeof(kFakeData), | 55 StreamParserBuffer::CopyFrom(kFakeData, sizeof(kFakeData), |
57 true, type, track_id); | 56 true, type, track_id); |
58 buffer->SetDecodeTimestamp( | 57 buffer->SetDecodeTimestamp( |
59 DecodeTimestamp::FromMicroseconds(decode_timestamps[i])); | 58 DecodeTimestamp::FromMicroseconds(decode_timestamps[i])); |
60 queue->push_back(buffer); | 59 queue->push_back(buffer); |
61 } | 60 } |
62 } | 61 } |
63 | 62 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 VerifyMergeSuccess(expected, true); | 363 VerifyMergeSuccess(expected, true); |
365 | 364 |
366 // But appending something with a lower timestamp than the last timestamp | 365 // But appending something with a lower timestamp than the last timestamp |
367 // in the pre-existing merge result should fail. | 366 // in the pre-existing merge result should fail. |
368 int more_audio_timestamps[] = { 106, kEnd }; | 367 int more_audio_timestamps[] = { 106, kEnd }; |
369 GenerateAudioBuffers(more_audio_timestamps); | 368 GenerateAudioBuffers(more_audio_timestamps); |
370 VerifyMergeFailure(); | 369 VerifyMergeFailure(); |
371 } | 370 } |
372 | 371 |
373 } // namespace media | 372 } // namespace media |
OLD | NEW |