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

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

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added implementation for ALSA. Created 4 years, 5 months 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 fe9bfdfbaa69dd5a8cadb61d366743f595ed9352..fc39ca90e46996c38663bb9734a7d9f2f3ba7fa9 100644
--- a/media/audio/win/audio_output_win_unittest.cc
+++ b/media/audio/win/audio_output_win_unittest.cc
@@ -38,7 +38,8 @@ namespace media {
static int ClearData(AudioBus* audio_bus,
uint32_t total_bytes_delay,
- uint32_t frames_skipped) {
+ uint32_t frames_skipped,
+ const AudioTimestamp& timestamp) {
audio_bus->Zero();
return audio_bus->frames();
}
@@ -54,7 +55,8 @@ class TestSourceBasic : public AudioOutputStream::AudioSourceCallback {
// AudioSourceCallback::OnMoreData implementation:
int OnMoreData(AudioBus* audio_bus,
uint32_t total_bytes_delay,
- uint32_t frames_skipped) override {
+ uint32_t frames_skipped,
+ const AudioTimestamp& timestamp) override {
++callback_count_;
// Touch the channel memory value to make sure memory is good.
audio_bus->Zero();
@@ -90,9 +92,11 @@ class TestSourceLaggy : public TestSourceBasic {
}
int OnMoreData(AudioBus* audio_bus,
uint32_t total_bytes_delay,
- uint32_t frames_skipped) override {
+ uint32_t frames_skipped,
+ const AudioTimestamp& timestamp) override {
// Call the base, which increments the callback_count_.
- TestSourceBasic::OnMoreData(audio_bus, total_bytes_delay, frames_skipped);
+ TestSourceBasic::OnMoreData(audio_bus, total_bytes_delay, frames_skipped,
+ timestamp);
if (callback_count() > kMaxNumBuffers) {
::Sleep(lag_in_ms_);
}
@@ -496,21 +500,24 @@ TEST_F(WinAudioTest, PCMWaveStreamPendingBytes) {
// pending bytes will go down and eventually read zero.
InSequence s;
- EXPECT_CALL(source, OnMoreData(NotNull(), 0, 0)).WillOnce(Invoke(ClearData));
+ EXPECT_CALL(source, OnMoreData(NotNull(), 0, 0, AudioTimestamp()))
+ .WillOnce(Invoke(ClearData));
// 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, 0))
+ EXPECT_CALL(source, OnMoreData(NotNull(), bytes_100_ms, 0, AudioTimestamp()))
.WillOnce(Invoke(ClearData));
- EXPECT_CALL(source, OnMoreData(NotNull(), 2 * bytes_100_ms, 0))
+ EXPECT_CALL(source,
+ OnMoreData(NotNull(), 2 * bytes_100_ms, 0, AudioTimestamp()))
.WillOnce(Invoke(ClearData));
- EXPECT_CALL(source, OnMoreData(NotNull(), 2 * bytes_100_ms, 0))
+ EXPECT_CALL(source,
+ OnMoreData(NotNull(), 2 * bytes_100_ms, 0, AudioTimestamp()))
.Times(AnyNumber())
.WillRepeatedly(Return(0));
- EXPECT_CALL(source, OnMoreData(NotNull(), bytes_100_ms, 0))
+ EXPECT_CALL(source, OnMoreData(NotNull(), bytes_100_ms, 0, AudioTimestamp()))
.Times(AnyNumber())
.WillRepeatedly(Return(0));
- EXPECT_CALL(source, OnMoreData(NotNull(), 0, 0))
+ EXPECT_CALL(source, OnMoreData(NotNull(), 0, 0, AudioTimestamp()))
.Times(AnyNumber())
.WillRepeatedly(Return(0));
@@ -537,7 +544,8 @@ class SyncSocketSource : public AudioOutputStream::AudioSourceCallback {
// AudioSourceCallback::OnMoreData implementation:
int OnMoreData(AudioBus* audio_bus,
uint32_t total_bytes_delay,
- uint32_t frames_skipped) override {
+ uint32_t frames_skipped,
+ const AudioTimestamp& timestamp) override {
socket_->Send(&total_bytes_delay, sizeof(total_bytes_delay));
uint32_t size = socket_->Receive(data_.get(), data_size_);
DCHECK_EQ(static_cast<size_t>(size) % sizeof(*audio_bus_->channel(0)), 0U);

Powered by Google App Engine
This is Rietveld 408576698