Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Side by Side Diff: media/base/stream_parser_unittest.cc

Issue 447963003: Introduce DecodeTimestamp class to make it easier to distiguish presentation and decode timestamps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698