OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "media/base/audio_decoder_config.h" | 9 #include "media/base/audio_decoder_config.h" |
10 #include "media/base/decoder_buffer.h" | 10 #include "media/base/decoder_buffer.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 DCHECK(number >= 0 && number < GG_LONGLONG(0x00FFFFFFFFFFFFFF)); | 81 DCHECK(number >= 0 && number < GG_LONGLONG(0x00FFFFFFFFFFFFFF)); |
82 buffer[0] = 0x01; | 82 buffer[0] = 0x01; |
83 int64 tmp = number; | 83 int64 tmp = number; |
84 for (int i = 7; i > 0; i--) { | 84 for (int i = 7; i > 0; i--) { |
85 buffer[i] = tmp & 0xff; | 85 buffer[i] = tmp & 0xff; |
86 tmp >>= 8; | 86 tmp >>= 8; |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 MATCHER_P(HasTimestamp, timestamp_in_ms, "") { | 90 MATCHER_P(HasTimestamp, timestamp_in_ms, "") { |
91 return arg && !arg->IsEndOfStream() && | 91 return arg.get() && !arg->IsEndOfStream() && |
92 arg->GetTimestamp().InMilliseconds() == timestamp_in_ms; | 92 arg->GetTimestamp().InMilliseconds() == timestamp_in_ms; |
93 } | 93 } |
94 | 94 |
95 MATCHER(IsEndOfStream, "") { | 95 MATCHER(IsEndOfStream, "") { return arg.get() && arg->IsEndOfStream(); } |
96 return arg && arg->IsEndOfStream(); | |
97 } | |
98 | 96 |
99 static void OnReadDone(const base::TimeDelta& expected_time, | 97 static void OnReadDone(const base::TimeDelta& expected_time, |
100 bool* called, | 98 bool* called, |
101 DemuxerStream::Status status, | 99 DemuxerStream::Status status, |
102 const scoped_refptr<DecoderBuffer>& buffer) { | 100 const scoped_refptr<DecoderBuffer>& buffer) { |
103 EXPECT_EQ(status, DemuxerStream::kOk); | 101 EXPECT_EQ(status, DemuxerStream::kOk); |
104 EXPECT_EQ(expected_time, buffer->GetTimestamp()); | 102 EXPECT_EQ(expected_time, buffer->GetTimestamp()); |
105 *called = true; | 103 *called = true; |
106 } | 104 } |
107 | 105 |
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2468 // Normally this would return an audio buffer at timestamp zero, but | 2466 // Normally this would return an audio buffer at timestamp zero, but |
2469 // all reads should return EOS buffers when disabled. | 2467 // all reads should return EOS buffers when disabled. |
2470 bool audio_read_done = false; | 2468 bool audio_read_done = false; |
2471 stream->Read(base::Bind(&OnReadDone_EOSExpected, &audio_read_done)); | 2469 stream->Read(base::Bind(&OnReadDone_EOSExpected, &audio_read_done)); |
2472 message_loop_.RunUntilIdle(); | 2470 message_loop_.RunUntilIdle(); |
2473 | 2471 |
2474 EXPECT_TRUE(audio_read_done); | 2472 EXPECT_TRUE(audio_read_done); |
2475 } | 2473 } |
2476 | 2474 |
2477 } // namespace media | 2475 } // namespace media |
OLD | NEW |