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

Unified Diff: media/audio/win/audio_output_win_unittest.cc

Issue 1487983002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test fixes. Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/win/audio_output_win_unittest.cc
diff --git a/media/audio/win/audio_output_win_unittest.cc b/media/audio/win/audio_output_win_unittest.cc
index 68f61eaf4d7395b3b91e4074e7f8fe150778e4be..1a76031eda988a8af66c573f2291d97106d2ea32 100644
--- a/media/audio/win/audio_output_win_unittest.cc
+++ b/media/audio/win/audio_output_win_unittest.cc
@@ -46,7 +46,9 @@ class TestSourceBasic : public AudioOutputStream::AudioSourceCallback {
had_error_(0) {
}
// AudioSourceCallback::OnMoreData implementation:
- int OnMoreData(AudioBus* audio_bus, uint32 total_bytes_delay) override {
+ int OnMoreData(AudioBus* audio_bus,
+ uint32_t total_bytes_delay,
+ uint32_t frames_skipped) override {
++callback_count_;
// Touch the channel memory value to make sure memory is good.
audio_bus->Zero();
@@ -80,9 +82,11 @@ class TestSourceLaggy : public TestSourceBasic {
explicit TestSourceLaggy(int lag_in_ms)
: lag_in_ms_(lag_in_ms) {
}
- int OnMoreData(AudioBus* audio_bus, uint32 total_bytes_delay) override {
+ int OnMoreData(AudioBus* audio_bus,
+ uint32_t total_bytes_delay,
+ uint32_t frames_skipped) override {
// Call the base, which increments the callback_count_.
- TestSourceBasic::OnMoreData(audio_bus, total_bytes_delay);
+ TestSourceBasic::OnMoreData(audio_bus, total_bytes_delay, frames_skipped);
if (callback_count() > kMaxNumBuffers) {
::Sleep(lag_in_ms_);
}
@@ -474,22 +478,21 @@ TEST(WinAudioTest, PCMWaveStreamPendingBytes) {
// pending bytes will go down and eventually read zero.
InSequence s;
- EXPECT_CALL(source, OnMoreData(NotNull(), 0))
- .WillOnce(Invoke(ClearData));
+ EXPECT_CALL(source, OnMoreData(NotNull(), 0, 0)).WillOnce(Invoke(ClearData));
tommi (sloooow) - chröme 2015/12/09 10:48:28 There's a compilation error for this line. "'int
Henrik Grunell 2015/12/09 10:53:10 But it has three arguments.
// Note: If AudioManagerWin::NumberOfWaveOutBuffers() ever changes, or if this
// test is run on Vista, these expectations will fail.
- EXPECT_CALL(source, OnMoreData(NotNull(), bytes_100_ms))
+ EXPECT_CALL(source, OnMoreData(NotNull(), bytes_100_ms, 0))
.WillOnce(Invoke(ClearData));
- EXPECT_CALL(source, OnMoreData(NotNull(), 2 * bytes_100_ms))
+ EXPECT_CALL(source, OnMoreData(NotNull(), 2 * bytes_100_ms, 0))
.WillOnce(Invoke(ClearData));
- EXPECT_CALL(source, OnMoreData(NotNull(), 2 * bytes_100_ms))
+ EXPECT_CALL(source, OnMoreData(NotNull(), 2 * bytes_100_ms, 0))
.Times(AnyNumber())
.WillRepeatedly(Return(0));
- EXPECT_CALL(source, OnMoreData(NotNull(), bytes_100_ms))
+ EXPECT_CALL(source, OnMoreData(NotNull(), bytes_100_ms, 0))
.Times(AnyNumber())
.WillRepeatedly(Return(0));
- EXPECT_CALL(source, OnMoreData(NotNull(), 0))
+ EXPECT_CALL(source, OnMoreData(NotNull(), 0, 0))
.Times(AnyNumber())
.WillRepeatedly(Return(0));
@@ -514,7 +517,9 @@ class SyncSocketSource : public AudioOutputStream::AudioSourceCallback {
~SyncSocketSource() override {}
// AudioSourceCallback::OnMoreData implementation:
- int OnMoreData(AudioBus* audio_bus, uint32 total_bytes_delay) override {
+ int OnMoreData(AudioBus* audio_bus,
+ uint32_t total_bytes_delay,
+ uint32_t frames_skipped) override {
socket_->Send(&total_bytes_delay, sizeof(total_bytes_delay));
uint32 size = socket_->Receive(data_.get(), data_size_);
DCHECK_EQ(static_cast<size_t>(size) % sizeof(*audio_bus_->channel(0)), 0U);
@@ -565,7 +570,7 @@ DWORD __stdcall SyncSocketThread(void* context) {
if (ctx.socket->Receive(&total_bytes_delay, sizeof(total_bytes_delay)) == 0)
break;
if ((times > 0) && (total_bytes_delay < 1000)) __debugbreak();
- sine.OnMoreData(audio_bus.get(), total_bytes_delay);
+ sine.OnMoreData(audio_bus.get(), total_bytes_delay, 0);
ctx.socket->Send(data.get(), ctx.packet_size_bytes);
++times;
}

Powered by Google App Engine
This is Rietveld 408576698