mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 1061046. Part 15: Remove most usage of TimeToTicksRoundUp. r=karlt
This commit is contained in:
parent
807d6426df
commit
7b67a29b15
@ -1194,12 +1194,6 @@ MediaStreamGraphImpl::PrepareUpdatesToMainThreadState(bool aFinalUpdate)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns smallest value of t such that
|
||||
* TimeToTicksRoundUp(aSampleRate, t) is a multiple of WEBAUDIO_BLOCK_SIZE
|
||||
* and floor(TimeToTicksRoundUp(aSampleRate, t)/WEBAUDIO_BLOCK_SIZE) >
|
||||
* floor(TimeToTicksRoundUp(aSampleRate, aTime)/WEBAUDIO_BLOCK_SIZE).
|
||||
*/
|
||||
GraphTime
|
||||
MediaStreamGraphImpl::RoundUpToNextAudioBlock(GraphTime aTime)
|
||||
{
|
||||
|
@ -285,10 +285,8 @@ public:
|
||||
GraphTime aTime, GraphTime aEndBlockingDecisions,
|
||||
GraphTime* aEnd);
|
||||
/**
|
||||
* Returns smallest value of t such that
|
||||
* TimeToTicksRoundUp(aSampleRate, t) is a multiple of WEBAUDIO_BLOCK_SIZE
|
||||
* and floor(TimeToTicksRoundUp(aSampleRate, t)/WEBAUDIO_BLOCK_SIZE) >
|
||||
* floor(TimeToTicksRoundUp(aSampleRate, aTime)/WEBAUDIO_BLOCK_SIZE).
|
||||
* Returns smallest value of t such that t is a multiple of
|
||||
* WEBAUDIO_BLOCK_SIZE and t > aTime.
|
||||
*/
|
||||
GraphTime RoundUpToNextAudioBlock(GraphTime aTime);
|
||||
/**
|
||||
|
@ -192,7 +192,7 @@ TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) :
|
||||
// Round up the track start time so the track, if anything, starts a
|
||||
// little later than the true time. This means we'll have enough
|
||||
// samples in our input stream to go just beyond the destination time.
|
||||
TrackTicks outputStart = TimeToTicksRoundUp(rate, GraphTimeToStreamTime(aFrom));
|
||||
TrackTicks outputStart = GraphTimeToStreamTime(aFrom);
|
||||
|
||||
nsAutoPtr<MediaSegment> segment;
|
||||
segment = aTrack->GetSegment()->CreateEmptyClone();
|
||||
@ -219,6 +219,7 @@ TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) :
|
||||
map->mSegment = aTrack->GetSegment()->CreateEmptyClone();
|
||||
return mTrackMap.Length() - 1;
|
||||
}
|
||||
|
||||
void TrackUnionStream::EndTrack(uint32_t aIndex)
|
||||
{
|
||||
StreamBuffer::Track* outputTrack = mBuffer.FindTrack(mTrackMap[aIndex].mOutputTrackID);
|
||||
@ -244,7 +245,6 @@ TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) :
|
||||
StreamBuffer::Track* outputTrack = mBuffer.FindTrack(map->mOutputTrackID);
|
||||
MOZ_ASSERT(outputTrack && !outputTrack->IsEnded(), "Can't copy to ended track");
|
||||
|
||||
TrackRate rate = outputTrack->GetRate();
|
||||
MediaSegment* segment = map->mSegment;
|
||||
MediaStream* source = map->mInputPort->GetSource();
|
||||
|
||||
@ -271,9 +271,8 @@ TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) :
|
||||
StreamTime outputEnd = GraphTimeToStreamTime(interval.mEnd);
|
||||
TrackTicks startTicks = outputTrack->GetEnd();
|
||||
StreamTime outputStart = GraphTimeToStreamTime(interval.mStart);
|
||||
MOZ_ASSERT(startTicks == TimeToTicksRoundUp(rate, outputStart), "Samples missing");
|
||||
TrackTicks endTicks = TimeToTicksRoundUp(rate, outputEnd);
|
||||
TrackTicks ticks = endTicks - startTicks;
|
||||
MOZ_ASSERT(startTicks == outputStart, "Samples missing");
|
||||
TrackTicks ticks = outputEnd - startTicks;
|
||||
StreamTime inputStart = source->GraphTimeToStreamTime(interval.mStart);
|
||||
|
||||
if (interval.mInputIsBlocked) {
|
||||
|
@ -240,9 +240,7 @@ MediaEngineDefaultVideoSource::NotifyPull(MediaStreamGraph* aGraph,
|
||||
|
||||
// Note: we're not giving up mImage here
|
||||
nsRefPtr<layers::Image> image = mImage;
|
||||
TrackTicks target =
|
||||
aSource->TimeToTicksRoundUp(aSource->GraphRate(), aDesiredTime);
|
||||
TrackTicks delta = target - aLastEndTime;
|
||||
TrackTicks delta = aDesiredTime - aLastEndTime;
|
||||
|
||||
if (delta > 0) {
|
||||
// nullptr images are allowed
|
||||
@ -251,7 +249,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)) {
|
||||
aLastEndTime = target;
|
||||
aLastEndTime = aDesiredTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,11 +53,9 @@ MediaEngineGonkVideoSource::NotifyPull(MediaStreamGraph* aGraph,
|
||||
|
||||
// Note: we're not giving up mImage here
|
||||
nsRefPtr<layers::Image> image = mImage;
|
||||
TrackTicks target = aSource->TimeToTicksRoundUp(
|
||||
aSource->GraphRate(), aDesiredTime);
|
||||
TrackTicks delta = target - aLastEndTime;
|
||||
LOGFRAME(("NotifyPull, desired = %ld, target = %ld, delta = %ld %s", (int64_t) aDesiredTime,
|
||||
(int64_t) target, (int64_t) delta, image ? "" : "<null>"));
|
||||
TrackTicks delta = aDesiredTime - aLastEndTime;
|
||||
LOGFRAME(("NotifyPull, desired = %ld, delta = %ld %s", (int64_t) aDesiredTime,
|
||||
(int64_t) delta, image ? "" : "<null>"));
|
||||
|
||||
// Bug 846188 We may want to limit incoming frames to the requested frame rate
|
||||
// mFps - if you want 30FPS, and the camera gives you 60FPS, this could
|
||||
@ -76,7 +74,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))) {
|
||||
aLastEndTime = target;
|
||||
aLastEndTime = aDesiredTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,9 +200,7 @@ MediaEngineTabVideoSource::NotifyPull(MediaStreamGraph*,
|
||||
|
||||
// Note: we're not giving up mImage here
|
||||
nsRefPtr<layers::CairoImage> image = mImage;
|
||||
TrackTicks target = aSource->TimeToTicksRoundUp(
|
||||
aSource->GraphRate(), aDesiredTime);
|
||||
TrackTicks delta = target - aLastEndTime;
|
||||
TrackTicks delta = aDesiredTime - aLastEndTime;
|
||||
if (delta > 0) {
|
||||
// nullptr images are allowed
|
||||
gfx::IntSize size = image ? image->GetSize() : IntSize(0, 0);
|
||||
@ -210,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))) {
|
||||
aLastEndTime = target;
|
||||
aLastEndTime = aDesiredTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -401,10 +401,10 @@ MediaEngineWebRTCAudioSource::NotifyPull(MediaStreamGraph* aGraph,
|
||||
{
|
||||
// Ignore - we push audio data
|
||||
#ifdef DEBUG
|
||||
TrackTicks target = aSource->TimeToTicksRoundUp(SAMPLE_FREQUENCY, aDesiredTime);
|
||||
TrackTicks delta = target - aLastEndTime;
|
||||
LOG_FRAMES(("Audio: NotifyPull: aDesiredTime %ld, target %ld, delta %ld",(int64_t) aDesiredTime, (int64_t) target, (int64_t) delta));
|
||||
aLastEndTime = target;
|
||||
TrackTicks delta = aDesiredTime - aLastEndTime;
|
||||
LOG(("Audio: NotifyPull: aDesiredTime %ld, delta %ld",(int64_t) aDesiredTime,
|
||||
(int64_t) delta));
|
||||
aLastEndTime = aDesiredTime;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -134,11 +134,9 @@ MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph,
|
||||
// So mState could be kReleased here. We really don't care about the state,
|
||||
// though.
|
||||
|
||||
TrackTicks target = aSource->TimeToTicksRoundUp(
|
||||
aSource->GraphRate(), aDesiredTime);
|
||||
TrackTicks delta = target - aLastEndTime;
|
||||
LOGFRAME(("NotifyPull, desired = %ld, target = %ld, delta = %ld %s", (int64_t) aDesiredTime,
|
||||
(int64_t) target, (int64_t) delta, mImage ? "" : "<null>"));
|
||||
TrackTicks delta = aDesiredTime - aLastEndTime;
|
||||
LOGFRAME(("NotifyPull, desired = %ld, delta = %ld %s", (int64_t) aDesiredTime,
|
||||
(int64_t) delta, mImage.get() ? "" : "<null>"));
|
||||
|
||||
// Bug 846188 We may want to limit incoming frames to the requested frame rate
|
||||
// mFps - if you want 30FPS, and the camera gives you 60FPS, this could
|
||||
@ -153,7 +151,7 @@ MediaEngineWebRTCVideoSource::NotifyPull(MediaStreamGraph* aGraph,
|
||||
if (delta > 0) {
|
||||
// nullptr images are allowed
|
||||
if (AppendToTrack(aSource, mImage, aID, delta)) {
|
||||
aLastEndTime = target;
|
||||
aLastEndTime = aDesiredTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1543,9 +1543,7 @@ NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) {
|
||||
nsRefPtr<layers::Image> image = image_;
|
||||
// our constructor sets track_rate_ to the graph rate
|
||||
MOZ_ASSERT(track_rate_ == source_->GraphRate());
|
||||
TrackTicks target = source_->TimeToTicksRoundUp(
|
||||
source_->GraphRate(), desired_time);
|
||||
TrackTicks delta = target - played_ticks_;
|
||||
TrackTicks delta = desired_time - played_ticks_;
|
||||
|
||||
// Don't append if we've already provided a frame that supposedly
|
||||
// goes past the current aDesiredTime Doing so means a negative
|
||||
@ -1555,7 +1553,7 @@ NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) {
|
||||
segment.AppendFrame(image.forget(), delta, IntSize(width_, height_));
|
||||
// Handle track not actually added yet or removed/finished
|
||||
if (source_->AppendToTrack(track_id_, &segment)) {
|
||||
played_ticks_ = target;
|
||||
played_ticks_ = desired_time;
|
||||
} else {
|
||||
MOZ_MTLOG(ML_ERROR, "AppendToTrack failed");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user