Bug 816664: wallpaper patch for negative delta times for video frames r=derf

This commit is contained in:
Randell Jesup 2012-12-28 15:34:01 -05:00
Родитель b3a11b3d2a
Коммит 7d951e6153
3 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@ -215,6 +215,7 @@ protected:
void AppendFromInternal(MediaSegmentBase<C, Chunk>* aSource)
{
static_cast<C*>(this)->CheckCompatible(*static_cast<C*>(aSource));
MOZ_ASSERT(aSource->mDuration >= 0);
mDuration += aSource->mDuration;
aSource->mDuration = 0;
if (!mChunks.IsEmpty() && !aSource->mChunks.IsEmpty() &&
@ -248,6 +249,7 @@ protected:
Chunk* AppendChunk(TrackTicks aDuration)
{
MOZ_ASSERT(aDuration >= 0);
Chunk* c = mChunks.AppendElement();
c->mDuration = aDuration;
mDuration += aDuration;

Просмотреть файл

@ -146,7 +146,7 @@ MediaEngineWebRTCAudioSource::NotifyPull(MediaStreamGraph* aGraph,
static TrackTicks mLastEndTime = 0;
TrackTicks target = TimeToTicksRoundUp(SAMPLE_FREQUENCY, aDesiredTime);
TrackTicks delta = target - mLastEndTime;
LOG(("Audio:NotifyPull: target %lu, delta %lu",(uint32_t) target, (uint32_t) delta));
LOG(("Audio: NotifyPull: aDesiredTime %ld, target %ld, delta %ld",(int64_t) aDesiredTime, (int64_t) target, (int64_t) delta));
mLastEndTime = target;
#endif
}

Просмотреть файл

@ -15,6 +15,7 @@ extern PRLogModuleInfo* GetMediaManagerLog();
#else
#define LOG(msg)
#endif
#define LOG_ALL_FRAMES 1
/**
* Webrtc video source.
@ -110,12 +111,16 @@ MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph,
TrackTicks target = TimeToTicksRoundUp(USECS_PER_S, aDesiredTime);
TrackTicks delta = target - mLastEndTime;
#ifdef LOG_ALL_FRAMES
LOG(("NotifyPull, target = %lu, delta = %lu", (uint64_t) target, (uint64_t) delta));
LOG(("NotifyPull, desired = %ld, target = %ld, delta = %ld", (int64_t) aDesiredTime, (int64_t) target, (int64_t) delta));
#endif
// NULL images are allowed
segment.AppendFrame(image ? image.forget() : nullptr, delta, gfxIntSize(mWidth, mHeight));
mSource->AppendToTrack(mTrackID, &(segment));
mLastEndTime = target;
// Don't append if we've already provided a frame that supposedly goes past the current aDesiredTime
// Doing so means a negative delta and thus messes up handling of the graph
if (delta > 0) {
// NULL images are allowed
segment.AppendFrame(image ? image.forget() : nullptr, delta, gfxIntSize(mWidth, mHeight));
mSource->AppendToTrack(mTrackID, &(segment));
mLastEndTime = target;
}
}
void