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 <deque> | 5 #include <deque> |
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 "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "media/base/data_buffer.h" | 10 #include "media/base/data_buffer.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 base::Unretained(&statistics_cb_))); | 71 base::Unretained(&statistics_cb_))); |
72 | 72 |
73 message_loop_.RunUntilIdle(); | 73 message_loop_.RunUntilIdle(); |
74 } | 74 } |
75 | 75 |
76 void ReadPacket(const DemuxerStream::ReadCB& read_cb) { | 76 void ReadPacket(const DemuxerStream::ReadCB& read_cb) { |
77 CHECK(!encoded_audio_.empty()) << "ReadPacket() called too many times"; | 77 CHECK(!encoded_audio_.empty()) << "ReadPacket() called too many times"; |
78 | 78 |
79 scoped_refptr<DecoderBuffer> buffer(encoded_audio_.front()); | 79 scoped_refptr<DecoderBuffer> buffer(encoded_audio_.front()); |
80 DemuxerStream::Status status = | 80 DemuxerStream::Status status = |
81 buffer ? DemuxerStream::kOk : DemuxerStream::kAborted; | 81 buffer.get() ? DemuxerStream::kOk : DemuxerStream::kAborted; |
82 encoded_audio_.pop_front(); | 82 encoded_audio_.pop_front(); |
83 read_cb.Run(status, buffer); | 83 read_cb.Run(status, buffer); |
84 } | 84 } |
85 | 85 |
86 void Read() { | 86 void Read() { |
87 decoder_->Read(base::Bind( | 87 decoder_->Read(base::Bind( |
88 &FFmpegAudioDecoderTest::DecodeFinished, base::Unretained(this))); | 88 &FFmpegAudioDecoderTest::DecodeFinished, base::Unretained(this))); |
89 message_loop_.RunUntilIdle(); | 89 message_loop_.RunUntilIdle(); |
90 } | 90 } |
91 | 91 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 EXPECT_CALL(*demuxer_, Read(_)) | 163 EXPECT_CALL(*demuxer_, Read(_)) |
164 .WillOnce(InvokeReadPacket(this)); | 164 .WillOnce(InvokeReadPacket(this)); |
165 Read(); | 165 Read(); |
166 | 166 |
167 EXPECT_EQ(decoded_audio_.size(), 1u); | 167 EXPECT_EQ(decoded_audio_.size(), 1u); |
168 EXPECT_TRUE(decoded_audio_[0].get() == NULL); | 168 EXPECT_TRUE(decoded_audio_[0].get() == NULL); |
169 } | 169 } |
170 | 170 |
171 } // namespace media | 171 } // namespace media |
OLD | NEW |