Backed out changeset 0661a1b7ec14 (bug 1109644) for M-3 Test failures

This commit is contained in:
Carsten "Tomcat" Book 2014-12-17 14:50:00 +01:00
parent e57f3ff4ab
commit 833d021469
13 changed files with 45 additions and 38 deletions

View File

@ -89,6 +89,8 @@ public:
mStream = aStream;
mAudioSource = aAudioSource;
mVideoSource = aVideoSource;
mLastEndTimeAudio = 0;
mLastEndTimeVideo = 0;
mStream->AddListener(this);
}
@ -185,10 +187,10 @@ public:
// Currently audio sources ignore NotifyPull, but they could
// watch it especially for fake audio.
if (mAudioSource) {
mAudioSource->NotifyPull(aGraph, mStream, kAudioTrack, aDesiredTime);
mAudioSource->NotifyPull(aGraph, mStream, kAudioTrack, aDesiredTime, mLastEndTimeAudio);
}
if (mVideoSource) {
mVideoSource->NotifyPull(aGraph, mStream, kVideoTrack, aDesiredTime);
mVideoSource->NotifyPull(aGraph, mStream, kVideoTrack, aDesiredTime, mLastEndTimeVideo);
}
}
@ -237,6 +239,8 @@ private:
nsRefPtr<MediaEngineSource> mAudioSource; // threadsafe refcnt
nsRefPtr<MediaEngineSource> mVideoSource; // threadsafe refcnt
nsRefPtr<SourceMediaStream> mStream; // threadsafe refcnt
StreamTime mLastEndTimeAudio;
StreamTime mLastEndTimeVideo;
bool mFinished;
// Accessed from MainThread and MSG thread

View File

@ -110,7 +110,8 @@ public:
virtual void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream *aSource,
TrackID aId,
StreamTime aDesiredTime) = 0;
StreamTime aDesiredTime,
StreamTime &aLastEndTime) = 0;
/* Stop the device and release the corresponding MediaStream */
virtual nsresult Stop(SourceMediaStream *aSource, TrackID aID) = 0;

View File

@ -61,8 +61,6 @@ bool MediaEngineCameraVideoSource::AppendToTrack(SourceMediaStream* aSource,
IntSize size(image ? mWidth : 0, image ? mHeight : 0);
segment.AppendFrame(image.forget(), delta, size);
mProducedDuration += delta;
// This is safe from any thread, and is safe if the track is Finished
// or Destroyed.
// This can fail if either a) we haven't added the track yet, or b)

View File

@ -25,7 +25,6 @@ public:
, mMonitor(aMonitorName)
, mWidth(0)
, mHeight(0)
, mProducedDuration(0)
, mInitDone(false)
, mHasDirectListeners(false)
, mCaptureIndex(aIndex)
@ -92,8 +91,6 @@ protected:
nsTArray<SourceMediaStream*> mSources; // When this goes empty, we shut down HW
StreamTime mProducedDuration;
bool mInitDone;
bool mHasDirectListeners;
int mCaptureIndex;

View File

@ -47,7 +47,6 @@ MediaEngineDefaultVideoSource::MediaEngineDefaultVideoSource()
, mTimer(nullptr)
, mMonitor("Fake video")
, mCb(16), mCr(16)
, mProducedDuration(0)
{
mImageContainer = layers::LayerManager::CreateImageContainer();
}
@ -245,7 +244,8 @@ void
MediaEngineDefaultVideoSource::NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream *aSource,
TrackID aID,
StreamTime aDesiredTime)
StreamTime aDesiredTime,
StreamTime &aLastEndTime)
{
// AddTrack takes ownership of segment
VideoSegment segment;
@ -256,7 +256,7 @@ MediaEngineDefaultVideoSource::NotifyPull(MediaStreamGraph* aGraph,
// Note: we're not giving up mImage here
nsRefPtr<layers::Image> image = mImage;
StreamTime delta = aDesiredTime - mProducedDuration;
StreamTime delta = aDesiredTime - aLastEndTime;
if (delta > 0) {
// nullptr images are allowed
@ -265,7 +265,7 @@ MediaEngineDefaultVideoSource::NotifyPull(MediaStreamGraph* aGraph,
// This can fail if either a) we haven't added the track yet, or b)
// we've removed or finished the track.
if (aSource->AppendToTrack(aID, &segment)) {
mProducedDuration = aDesiredTime;
aLastEndTime = aDesiredTime;
}
// Generate null data for fake tracks.
if (mHasFakeTracks) {

View File

@ -53,7 +53,8 @@ public:
virtual void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream *aSource,
TrackID aId,
StreamTime aDesiredTime) MOZ_OVERRIDE;
StreamTime aDesiredTime,
StreamTime &aLastEndTime);
virtual bool SatisfiesConstraintSets(
const nsTArray<const dom::MediaTrackConstraintSet*>& aConstraintSets)
{
@ -95,8 +96,6 @@ protected:
MediaEnginePrefs mOpts;
int mCb;
int mCr;
StreamTime mProducedDuration;
};
class SineWaveGenerator;
@ -123,7 +122,8 @@ public:
virtual void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream *aSource,
TrackID aId,
StreamTime aDesiredTime) {}
StreamTime aDesiredTime,
StreamTime &aLastEndTime) {}
virtual bool IsFake() {
return true;

View File

@ -45,7 +45,8 @@ void
MediaEngineGonkVideoSource::NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream* aSource,
TrackID aID,
StreamTime aDesiredTime)
StreamTime aDesiredTime,
StreamTime& aLastEndTime)
{
VideoSegment segment;
@ -56,7 +57,7 @@ MediaEngineGonkVideoSource::NotifyPull(MediaStreamGraph* aGraph,
// Note: we're not giving up mImage here
nsRefPtr<layers::Image> image = mImage;
StreamTime delta = aDesiredTime - mProducedDuration;
StreamTime delta = aDesiredTime - aLastEndTime;
LOGFRAME(("NotifyPull, desired = %ld, delta = %ld %s", (int64_t) aDesiredTime,
(int64_t) delta, image ? "" : "<null>"));
@ -77,7 +78,7 @@ MediaEngineGonkVideoSource::NotifyPull(MediaStreamGraph* aGraph,
// This can fail if either a) we haven't added the track yet, or b)
// we've removed or finished the track.
if (aSource->AppendToTrack(aID, &(segment))) {
mProducedDuration = aDesiredTime;
aLastEndTime = aDesiredTime;
}
}
}

View File

@ -48,11 +48,9 @@ public:
: MediaEngineCameraVideoSource(aIndex, "GonkCamera.Monitor")
, mCallbackMonitor("GonkCamera.CallbackMonitor")
, mCameraControl(nullptr)
, mProducedDuration(0)
, mRotation(0)
, mBackCamera(false)
, mOrientationChanged(true)
// Correct the orientation at first time takePhoto.
, mOrientationChanged(true) // Correct the orientation at first time takePhoto.
{
Init();
}
@ -65,7 +63,8 @@ public:
virtual void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream* aSource,
TrackID aId,
StreamTime aDesiredTime) MOZ_OVERRIDE;
StreamTime aDesiredTime,
StreamTime &aLastEndTime) MOZ_OVERRIDE;
virtual bool SatisfiesConstraintSets(
const nsTArray<const dom::MediaTrackConstraintSet*>& aConstraintSets)
{
@ -107,7 +106,6 @@ protected:
// This is only modified on MainThread (AllocImpl and DeallocImpl)
nsRefPtr<ICameraControl> mCameraControl;
nsCOMPtr<nsIDOMFile> mLastCapture;
StreamTime mProducedDuration;
// These are protected by mMonitor in parent class
nsTArray<nsRefPtr<PhotoCallback>> mPhotoCallbacks;

View File

@ -33,8 +33,7 @@ using dom::ConstrainLongRange;
NS_IMPL_ISUPPORTS(MediaEngineTabVideoSource, nsIDOMEventListener, nsITimerCallback)
MediaEngineTabVideoSource::MediaEngineTabVideoSource()
: mProducedDuration(0)
, mMonitor("MediaEngineTabVideoSource")
: mMonitor("MediaEngineTabVideoSource"), mTabSource(nullptr)
{
}
@ -193,14 +192,15 @@ MediaEngineTabVideoSource::Start(SourceMediaStream* aStream, TrackID aID)
void
MediaEngineTabVideoSource::NotifyPull(MediaStreamGraph*,
SourceMediaStream* aSource,
TrackID aID, StreamTime aDesiredTime)
TrackID aID, StreamTime aDesiredTime,
StreamTime& aLastEndTime)
{
VideoSegment segment;
MonitorAutoLock mon(mMonitor);
// Note: we're not giving up mImage here
nsRefPtr<layers::CairoImage> image = mImage;
StreamTime delta = aDesiredTime - mProducedDuration;
StreamTime delta = aDesiredTime - aLastEndTime;
if (delta > 0) {
// nullptr images are allowed
gfx::IntSize size = image ? image->GetSize() : IntSize(0, 0);
@ -208,7 +208,7 @@ MediaEngineTabVideoSource::NotifyPull(MediaStreamGraph*,
// This can fail if either a) we haven't added the track yet, or b)
// we've removed or finished the track.
if (aSource->AppendToTrack(aID, &(segment))) {
mProducedDuration = aDesiredTime;
aLastEndTime = aDesiredTime;
}
}
}

View File

@ -25,7 +25,7 @@ class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventList
virtual nsresult Deallocate();
virtual nsresult Start(mozilla::SourceMediaStream*, mozilla::TrackID);
virtual void SetDirectListeners(bool aHasDirectListeners) {};
virtual void NotifyPull(mozilla::MediaStreamGraph*, mozilla::SourceMediaStream*, mozilla::TrackID, mozilla::StreamTime) MOZ_OVERRIDE;
virtual void NotifyPull(mozilla::MediaStreamGraph*, mozilla::SourceMediaStream*, mozilla::TrackID, mozilla::StreamTime, mozilla::StreamTime&);
virtual nsresult Stop(mozilla::SourceMediaStream*, mozilla::TrackID);
virtual nsresult Config(bool, uint32_t, bool, uint32_t, bool, uint32_t, int32_t);
virtual bool IsFake();
@ -79,7 +79,6 @@ private:
nsCOMPtr<nsIDOMWindow> mWindow;
nsRefPtr<layers::CairoImage> mImage;
nsCOMPtr<nsITimer> mTimer;
StreamTime mProducedDuration;
Monitor mMonitor;
nsCOMPtr<nsITabSource> mTabSource;
};

View File

@ -97,7 +97,8 @@ public:
virtual void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream* aSource,
TrackID aId,
StreamTime aDesiredTime) MOZ_OVERRIDE;
StreamTime aDesiredTime,
StreamTime &aLastEndTime);
virtual const MediaSourceType GetMediaSource() {
return mMediaSource;
@ -179,7 +180,8 @@ public:
virtual void NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream* aSource,
TrackID aId,
StreamTime aDesiredTime) MOZ_OVERRIDE;
StreamTime aDesiredTime,
StreamTime &aLastEndTime);
virtual bool IsFake() {
return false;

View File

@ -398,11 +398,15 @@ void
MediaEngineWebRTCAudioSource::NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream *aSource,
TrackID aID,
StreamTime aDesiredTime)
StreamTime aDesiredTime,
StreamTime &aLastEndTime)
{
// Ignore - we push audio data
#ifdef DEBUG
LOG(("Audio: NotifyPull: aDesiredTime %ld", aDesiredTime));
StreamTime delta = aDesiredTime - aLastEndTime;
LOG(("Audio: NotifyPull: aDesiredTime %ld, delta %ld",(int64_t) aDesiredTime,
(int64_t) delta));
aLastEndTime = aDesiredTime;
#endif
}

View File

@ -124,7 +124,8 @@ void
MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph,
SourceMediaStream* aSource,
TrackID aID,
StreamTime aDesiredTime)
StreamTime aDesiredTime,
StreamTime &aLastEndTime)
{
VideoSegment segment;
@ -133,7 +134,7 @@ MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph,
// So mState could be kReleased here. We really don't care about the state,
// though.
StreamTime delta = aDesiredTime - mProducedDuration;
StreamTime delta = aDesiredTime - aLastEndTime;
LOGFRAME(("NotifyPull, desired = %ld, delta = %ld %s", (int64_t) aDesiredTime,
(int64_t) delta, mImage.get() ? "" : "<null>"));
@ -149,7 +150,9 @@ MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph,
// Doing so means a negative delta and thus messes up handling of the graph
if (delta > 0) {
// nullptr images are allowed
AppendToTrack(aSource, mImage, aID, delta);
if (AppendToTrack(aSource, mImage, aID, delta)) {
aLastEndTime = aDesiredTime;
}
}
}