mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1021328: ensure no paths lose far-end audio chunks in getUserMedia r=mccr8
This commit is contained in:
parent
861dfcddf0
commit
95cb2ee7a0
@ -43,7 +43,7 @@ private:
|
||||
uint32_t mChunkSize;
|
||||
|
||||
// chunking to 10ms support
|
||||
nsAutoPtr<FarEndAudioChunk> mSaved;
|
||||
FarEndAudioChunk *mSaved; // can't be nsAutoPtr since we need to use moz_free()
|
||||
uint32_t mSamplesSaved;
|
||||
};
|
||||
|
||||
|
@ -54,6 +54,7 @@ AudioOutputObserver::AudioOutputObserver()
|
||||
: mPlayoutFreq(0)
|
||||
, mPlayoutChannels(0)
|
||||
, mChunkSize(0)
|
||||
, mSaved(nullptr)
|
||||
, mSamplesSaved(0)
|
||||
{
|
||||
// Buffers of 10ms chunks
|
||||
@ -69,8 +70,9 @@ void
|
||||
AudioOutputObserver::Clear()
|
||||
{
|
||||
while (mPlayoutFifo->size() > 0) {
|
||||
(void) mPlayoutFifo->Pop();
|
||||
moz_free(mPlayoutFifo->Pop());
|
||||
}
|
||||
moz_free(mSaved);
|
||||
mSaved = nullptr;
|
||||
}
|
||||
|
||||
@ -154,7 +156,8 @@ AudioOutputObserver::InsertFarEnd(const AudioDataValue *aBuffer, uint32_t aSampl
|
||||
// thread safety issues.
|
||||
break;
|
||||
} else {
|
||||
mPlayoutFifo->Push((int8_t *) mSaved.forget()); // takes ownership
|
||||
mPlayoutFifo->Push((int8_t *) mSaved); // takes ownership
|
||||
mSaved = nullptr;
|
||||
mSamplesSaved = 0;
|
||||
}
|
||||
}
|
||||
@ -517,8 +520,7 @@ MediaEngineWebRTCAudioSource::Process(int channel,
|
||||
if (!mStarted) {
|
||||
mStarted = true;
|
||||
while (gFarendObserver->Size() > 1) {
|
||||
FarEndAudioChunk *buffer = gFarendObserver->Pop(); // only call if size() > 0
|
||||
free(buffer);
|
||||
moz_free(gFarendObserver->Pop()); // only call if size() > 0
|
||||
}
|
||||
}
|
||||
|
||||
@ -526,15 +528,16 @@ MediaEngineWebRTCAudioSource::Process(int channel,
|
||||
FarEndAudioChunk *buffer = gFarendObserver->Pop(); // only call if size() > 0
|
||||
if (buffer) {
|
||||
int length = buffer->mSamples;
|
||||
if (mVoERender->ExternalPlayoutData(buffer->mData,
|
||||
int res = mVoERender->ExternalPlayoutData(buffer->mData,
|
||||
gFarendObserver->PlayoutFrequency(),
|
||||
gFarendObserver->PlayoutChannels(),
|
||||
mPlayoutDelay,
|
||||
length) == -1) {
|
||||
length);
|
||||
moz_free(buffer);
|
||||
if (res == -1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
|
Loading…
Reference in New Issue
Block a user