Skip to content

Commit

Permalink
Revert 282424 "Remove media::AudioRendererImpl::now_cb_ and clea..."
Browse files Browse the repository at this point in the history
MSVC evaluates functions in a different order, causing test failures.

> Remove media::AudioRendererImpl::now_cb_ and clean up tests.
> 
> It's no longer needed as of r282376.
> 
> BUG=370634
> R=rileya@chromium.org
> 
> Review URL: https://codereview.chromium.org/380893002

TBR=scherkus@chromium.org

Review URL: https://codereview.chromium.org/380303004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282436 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
scherkus@chromium.org committed Jul 10, 2014
1 parent 8d93614 commit f72e58b
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 57 deletions.
1 change: 1 addition & 0 deletions media/filters/audio_renderer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ AudioRendererImpl::AudioRendererImpl(
decoders.Pass(),
set_decryptor_ready_cb),
hardware_config_(hardware_config),
now_cb_(base::Bind(&base::TimeTicks::Now)),
state_(kUninitialized),
buffering_state_(BUFFERING_HAVE_NOTHING),
rendering_(false),
Expand Down
9 changes: 9 additions & 0 deletions media/filters/audio_renderer_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ class MEDIA_EXPORT AudioRendererImpl
virtual void StartPlayingFrom(base::TimeDelta timestamp) OVERRIDE;
virtual void SetVolume(float volume) OVERRIDE;

// Allows injection of a custom time callback for non-realtime testing.
typedef base::Callback<base::TimeTicks()> NowCB;
void set_now_cb_for_testing(const NowCB& now_cb) {
now_cb_ = now_cb;
}

private:
friend class AudioRendererImplTest;

Expand Down Expand Up @@ -215,6 +221,9 @@ class MEDIA_EXPORT AudioRendererImpl
// Callback provided to Flush().
base::Closure flush_cb_;

// Typically calls base::TimeTicks::Now() but can be overridden by a test.
NowCB now_cb_;

// After Initialize() has completed, all variables below must be accessed
// under |lock_|. ------------------------------------------------------------
base::Lock lock_;
Expand Down
Loading

0 comments on commit f72e58b

Please sign in to comment.