mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 892492 - Fix automation on AudioBufferSourceNode.playbackRate. r=ehsan
This commit is contained in:
parent
5d8d3ba243
commit
aacae3cd50
@ -70,6 +70,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void SetSourceStream(AudioNodeStream* aSource)
|
||||
{
|
||||
mSource = aSource;
|
||||
}
|
||||
|
||||
virtual void SetTimelineParameter(uint32_t aIndex,
|
||||
const dom::AudioParamTimeline& aValue,
|
||||
TrackRate aSampleRate) MOZ_OVERRIDE
|
||||
@ -86,7 +91,7 @@ public:
|
||||
speex_resampler_destroy(mResampler);
|
||||
mResampler = nullptr;
|
||||
}
|
||||
WebAudioUtils::ConvertAudioParamToTicks(mPlaybackRateTimeline, nullptr, mDestination);
|
||||
WebAudioUtils::ConvertAudioParamToTicks(mPlaybackRateTimeline, mSource, mDestination);
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Bad AudioBufferSourceNodeEngine TimelineParameter");
|
||||
@ -425,6 +430,7 @@ public:
|
||||
float mPlaybackRate;
|
||||
float mDopplerShift;
|
||||
AudioNodeStream* mDestination;
|
||||
AudioNodeStream* mSource;
|
||||
AudioParamTimeline mPlaybackRateTimeline;
|
||||
bool mLoop;
|
||||
};
|
||||
@ -444,9 +450,9 @@ AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)
|
||||
, mStartCalled(false)
|
||||
, mStopped(false)
|
||||
{
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(
|
||||
new AudioBufferSourceNodeEngine(this, aContext->Destination()),
|
||||
MediaStreamGraph::SOURCE_STREAM);
|
||||
AudioBufferSourceNodeEngine* engine = new AudioBufferSourceNodeEngine(this, aContext->Destination());
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::SOURCE_STREAM);
|
||||
engine->SetSourceStream(static_cast<AudioNodeStream*>(mStream.get()));
|
||||
mStream->AddMainThreadListener(this);
|
||||
}
|
||||
|
||||
|
@ -19,15 +19,9 @@ struct ConvertTimeToTickHelper
|
||||
static int64_t Convert(double aTime, void* aClosure)
|
||||
{
|
||||
ConvertTimeToTickHelper* This = static_cast<ConvertTimeToTickHelper*> (aClosure);
|
||||
if (This->mSourceStream) {
|
||||
MOZ_ASSERT(This->mSourceStream->SampleRate() == This->mDestinationStream->SampleRate());
|
||||
return WebAudioUtils::ConvertDestinationStreamTimeToSourceStreamTime(
|
||||
aTime, This->mSourceStream, This->mDestinationStream);
|
||||
} else {
|
||||
StreamTime streamTime = This->mDestinationStream->GetCurrentPosition();
|
||||
TrackRate sampleRate = This->mDestinationStream->SampleRate();
|
||||
return TimeToTicksRoundUp(sampleRate, streamTime + SecondsToMediaTime(aTime));
|
||||
}
|
||||
MOZ_ASSERT(This->mSourceStream->SampleRate() == This->mDestinationStream->SampleRate());
|
||||
return WebAudioUtils::ConvertDestinationStreamTimeToSourceStreamTime(
|
||||
aTime, This->mSourceStream, This->mDestinationStream);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user