Bug 825611 - Fix unit tests to match fix to MediaPipeline. r=jesup
authorEKR <ekr@rtfm.com>
Sat, 05 Jan 2013 14:52:11 -0800
changeset 126867 1b88be2c5e1f682198d9192c4528254b00fe2a7b
parent 126866 b5ae74de191091f920efa2053381f9dae0a7e085
child 126868 c8faf027d3626f6698ca41ad3ac1c9a92e188c31
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs825611
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 825611 - Fix unit tests to match fix to MediaPipeline. r=jesup
media/webrtc/signaling/test/FakeMediaStreams.h
media/webrtc/signaling/test/FakeMediaStreamsImpl.h
--- a/media/webrtc/signaling/test/FakeMediaStreams.h
+++ b/media/webrtc/signaling/test/FakeMediaStreams.h
@@ -27,30 +27,29 @@ namespace mozilla {
    class MediaStreamGraph;
    class MediaSegment;
 };
 
 class Fake_SourceMediaStream;
 
 class Fake_MediaStreamListener
 {
-public:
+ public:
   virtual ~Fake_MediaStreamListener() {}
 
   virtual void NotifyQueuedTrackChanges(mozilla::MediaStreamGraph* aGraph, mozilla::TrackID aID,
                                         mozilla::TrackRate aTrackRate,
                                         mozilla::TrackTicks aTrackOffset,
                                         uint32_t aTrackEvents,
                                         const mozilla::MediaSegment& aQueuedMedia)  = 0;
   virtual void NotifyPull(mozilla::MediaStreamGraph* aGraph, mozilla::StreamTime aDesiredTime) = 0;
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Fake_MediaStreamListener)
 };
 
-
 // Note: only one listener supported
 class Fake_MediaStream {
  public:
   Fake_MediaStream () : mListeners(), mMutex("Fake MediaStream") {}
   virtual ~Fake_MediaStream() { Stop(); }
 
   void AddListener(Fake_MediaStreamListener *aListener) {
     mozilla::MutexAutoLock lock(mMutex);
@@ -95,16 +94,17 @@ protected:
   Fake_MediaStream *mStream;
   int mCount;
 };
 
 
 class Fake_SourceMediaStream : public Fake_MediaStream {
  public:
   Fake_SourceMediaStream() : mSegmentsAdded(0),
+                             mDesiredTime(0),
                              mPullEnabled(false),
                              mStop(false),
                              mPeriodic(new Fake_MediaPeriodic(this)) {}
 
   void AddTrack(mozilla::TrackID aID, mozilla::TrackRate aRate, mozilla::TrackTicks aStart,
                 mozilla::MediaSegment* aSegment) {}
 
   void AppendToTrack(mozilla::TrackID aID, mozilla::MediaSegment* aSegment) {
@@ -161,16 +161,17 @@ class Fake_SourceMediaStream : public Fa
   virtual void Periodic();
 
   virtual int GetSegmentsAdded() {
     return mSegmentsAdded;
   }
 
  protected:
   int mSegmentsAdded;
+  uint64_t mDesiredTime;
   bool mPullEnabled;
   bool mStop;
   nsRefPtr<Fake_MediaPeriodic> mPeriodic;
   nsCOMPtr<nsITimer> mTimer;
 };
 
 
 class Fake_nsDOMMediaStream : public nsIDOMMediaStream
--- a/media/webrtc/signaling/test/FakeMediaStreamsImpl.h
+++ b/media/webrtc/signaling/test/FakeMediaStreamsImpl.h
@@ -48,17 +48,18 @@ nsresult Fake_SourceMediaStream::Stop() 
 void Fake_SourceMediaStream::Periodic() {
   mozilla::MutexAutoLock lock(mMutex);
   // Pull more audio-samples iff pulling is enabled
   // and we are not asked by the signaling agent to stop
   //pulling data.
   if (mPullEnabled && !mStop) {
     for (std::set<Fake_MediaStreamListener *>::iterator it =
              mListeners.begin(); it != mListeners.end(); ++it) {
-      (*it)->NotifyPull(NULL, mozilla::MillisecondsToMediaTime(10));
+      mDesiredTime += 10;
+      (*it)->NotifyPull(NULL, mozilla::MillisecondsToMediaTime(mDesiredTime));
     }
   }
 }
 
 // Fake_MediaStreamBase
 nsresult Fake_MediaStreamBase::Start() {
   mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
   if (!mTimer) {