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
3 // found in the LICENSE file.
5 #include "media/base/video_frame.h"
6 #include "media/cast/test/utility/audio_utility.h"
7 #include "testing/gtest/include/gtest/gtest.h"
14 TEST(AudioTimestampTest
, Small
) {
15 std::vector
<float> samples(480);
16 for (int32 in_timestamp
= 0; in_timestamp
< 65536; in_timestamp
+= 177) {
17 EncodeTimestamp(in_timestamp
, 0, samples
.size(), &samples
.front());
20 DecodeTimestamp(&samples
.front(), samples
.size(), &out_timestamp
));
21 ASSERT_EQ(in_timestamp
, out_timestamp
);
25 TEST(AudioTimestampTest
, Negative
) {
26 std::vector
<float> samples(480);
29 DecodeTimestamp(&samples
.front(), samples
.size(), &out_timestamp
));
32 TEST(AudioTimestampTest
, CheckPhase
) {
33 std::vector
<float> samples(4800);
34 EncodeTimestamp(4711, 0, samples
.size(), &samples
.front());
35 while (samples
.size() > 240) {
38 DecodeTimestamp(&samples
.front(), samples
.size(), &out_timestamp
));
39 ASSERT_EQ(4711, out_timestamp
);
41 samples
.erase(samples
.begin(), samples
.begin() + 73);