| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "media/base/stream_parser.h" | 9 #include "media/base/stream_parser.h" |
| 10 #include "media/base/stream_parser_buffer.h" | 10 #include "media/base/stream_parser_buffer.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 BufferQueue* queue) { | 46 BufferQueue* queue) { |
| 47 DCHECK(decode_timestamps); | 47 DCHECK(decode_timestamps); |
| 48 DCHECK(queue); | 48 DCHECK(queue); |
| 49 DCHECK_NE(type, DemuxerStream::UNKNOWN); | 49 DCHECK_NE(type, DemuxerStream::UNKNOWN); |
| 50 DCHECK_LT(type, DemuxerStream::NUM_TYPES); | 50 DCHECK_LT(type, DemuxerStream::NUM_TYPES); |
| 51 for (int i = 0; decode_timestamps[i] != kEnd; ++i) { | 51 for (int i = 0; decode_timestamps[i] != kEnd; ++i) { |
| 52 scoped_refptr<StreamParserBuffer> buffer = | 52 scoped_refptr<StreamParserBuffer> buffer = |
| 53 StreamParserBuffer::CopyFrom(kFakeData, sizeof(kFakeData), | 53 StreamParserBuffer::CopyFrom(kFakeData, sizeof(kFakeData), |
| 54 true, type, track_id); | 54 true, type, track_id); |
| 55 buffer->SetDecodeTimestamp( | 55 buffer->SetDecodeTimestamp( |
| 56 base::TimeDelta::FromMicroseconds(decode_timestamps[i])); | 56 DecodeTimestamp::FromMicroseconds(decode_timestamps[i])); |
| 57 queue->push_back(buffer); | 57 queue->push_back(buffer); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 class StreamParserTest : public testing::Test { | 61 class StreamParserTest : public testing::Test { |
| 62 protected: | 62 protected: |
| 63 StreamParserTest() {} | 63 StreamParserTest() {} |
| 64 | 64 |
| 65 // Returns the number of buffers in |merged_buffers_| for which |predicate| | 65 // Returns the number of buffers in |merged_buffers_| for which |predicate| |
| 66 // returns true. | 66 // returns true. |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 VerifyMergeSuccess(expected, true); | 372 VerifyMergeSuccess(expected, true); |
| 373 | 373 |
| 374 // But appending something with a lower timestamp than the last timestamp | 374 // But appending something with a lower timestamp than the last timestamp |
| 375 // in the pre-existing merge result should fail. | 375 // in the pre-existing merge result should fail. |
| 376 int more_audio_timestamps[] = { 106, kEnd }; | 376 int more_audio_timestamps[] = { 106, kEnd }; |
| 377 GenerateAudioBuffers(more_audio_timestamps); | 377 GenerateAudioBuffers(more_audio_timestamps); |
| 378 VerifyMergeFailure(); | 378 VerifyMergeFailure(); |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace media | 381 } // namespace media |
| 382 | |
| OLD | NEW |