diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 22:30:07 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-24 22:30:07 +0000 |
commit | 9d3381548a57745b672e65fa4b487c61b0b7bf39 (patch) | |
tree | d12a7e03ca70bbce7a3a372e5969719e496e0193 /media/audio/linux/alsa_output_unittest.cc | |
parent | 4748f54e887fc85f009e8d1df2288f7f3f984d0e (diff) | |
download | chromium_src-9d3381548a57745b672e65fa4b487c61b0b7bf39.zip chromium_src-9d3381548a57745b672e65fa4b487c61b0b7bf39.tar.gz chromium_src-9d3381548a57745b672e65fa4b487c61b0b7bf39.tar.bz2 |
Provide unplayed bytes ALSA implementation of audio
BUG=19921
TEST=play an video track on linux, AV should be in sync.
Use snd_pcm_delay() to provide the number of unplayed bytes in linux's
audio implementation. This information will correct the sync problem
for linux.
Review URL: http://codereview.chromium.org/173288
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24163 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/linux/alsa_output_unittest.cc')
-rw-r--r-- | media/audio/linux/alsa_output_unittest.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/media/audio/linux/alsa_output_unittest.cc b/media/audio/linux/alsa_output_unittest.cc index d736d93..d13da89 100644 --- a/media/audio/linux/alsa_output_unittest.cc +++ b/media/audio/linux/alsa_output_unittest.cc @@ -24,6 +24,7 @@ class MockAlsaWrapper : public AlsaWrapper { MOCK_METHOD1(PcmClose, int(snd_pcm_t* handle)); MOCK_METHOD1(PcmPrepare, int(snd_pcm_t* handle)); MOCK_METHOD1(PcmDrop, int(snd_pcm_t* handle)); + MOCK_METHOD2(PcmDelay, int(snd_pcm_t* handle, snd_pcm_sframes_t* delay)); MOCK_METHOD3(PcmWritei, snd_pcm_sframes_t(snd_pcm_t* handle, const void* buffer, snd_pcm_uframes_t size)); @@ -272,6 +273,9 @@ TEST_F(AlsaPcmOutputStreamTest, StartStop) { // Expect the pre-roll. MockAudioSourceCallback mock_callback; + EXPECT_CALL(mock_alsa_wrapper_, PcmDelay(kFakeHandle, _)) + .Times(2) + .WillRepeatedly(DoAll(SetArgumentPointee<1>(0), Return(0))); EXPECT_CALL(mock_callback, OnMoreData(test_stream_.get(), _, kTestPacketSize, 0)) .Times(2) @@ -361,9 +365,11 @@ TEST_F(AlsaPcmOutputStreamTest, BufferPacket) { // Return a partially filled packet. MockAudioSourceCallback mock_callback; + EXPECT_CALL(mock_alsa_wrapper_, PcmDelay(_, _)) + .WillOnce(DoAll(SetArgumentPointee<1>(1), Return(0))); EXPECT_CALL(mock_callback, OnMoreData(test_stream_.get(), packet_.buffer.get(), - packet_.capacity, 0)) + packet_.capacity, kTestBytesPerFrame)) .WillOnce(Return(10)); test_stream_->shared_data_.set_source_callback(&mock_callback); |