Backed out changeset 4a57673e2054 (bug 1894110) for causing MinGW build bustages & crashtest failures CLOSED TREE

This commit is contained in:
Sandor Molnar 2024-05-03 09:48:45 +03:00
Родитель f2652865c6
Коммит 4c1d4ee8ec
4 изменённых файлов: 8 добавлений и 27 удалений

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

@ -168,12 +168,7 @@ size_t AudioStream::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
nsresult AudioStream::EnsureTimeStretcherInitialized() {
AssertIsOnAudioThread();
if (!mTimeStretcher) {
auto timestretcher = MakeUnique<RLBoxSoundTouch>();
if (!timestretcher || !timestretcher->Init()) {
return NS_ERROR_FAILURE;
}
mTimeStretcher = timestretcher.release();
mTimeStretcher = new RLBoxSoundTouch();
mTimeStretcher->setSampleRate(mAudioClock.GetInputRate());
mTimeStretcher->setChannels(mOutChannels);
mTimeStretcher->setPitch(1.0);

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

@ -621,9 +621,6 @@ void AudioDecoderInputTrack::EnsureTimeStretcher() {
AssertOnGraphThread();
if (!mTimeStretcher) {
mTimeStretcher = new RLBoxSoundTouch();
MOZ_RELEASE_ASSERT(mTimeStretcher);
MOZ_RELEASE_ASSERT(mTimeStretcher->Init());
mTimeStretcher->setSampleRate(Graph()->GraphRate());
mTimeStretcher->setChannels(GetChannelCountForTimeStretcher());
mTimeStretcher->setPitch(1.0);

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

@ -10,34 +10,24 @@ using namespace rlbox;
using namespace mozilla;
using namespace soundtouch;
bool RLBoxSoundTouch::Init() {
RLBoxSoundTouch::RLBoxSoundTouch() {
#ifdef MOZ_WASM_SANDBOXING_SOUNDTOUCH
const bool success = mSandbox.create_sandbox(false /* infallible */);
mSandbox.create_sandbox(true /* infallible */);
#else
const bool success = true;
mSandbox.create_sandbox();
#endif
if (!success){
return false;
}
mTimeStretcher = mSandbox.invoke_sandbox_function(createSoundTouchObj);
// Allocate buffer in sandbox to receive samples.
mSampleBuffer = mSandbox.malloc_in_sandbox<AudioDataValue>(mSampleBufferSize);
MOZ_RELEASE_ASSERT(mSampleBuffer);
mCreated = true;
return true;
}
RLBoxSoundTouch::~RLBoxSoundTouch() {
if (mCreated) {
mSandbox.free_in_sandbox(mSampleBuffer);
mSandbox.invoke_sandbox_function(destroySoundTouchObj, mTimeStretcher);
mTimeStretcher = nullptr;
mSandbox.destroy_sandbox();
}
mSandbox.free_in_sandbox(mSampleBuffer);
mSandbox.invoke_sandbox_function(destroySoundTouchObj, mTimeStretcher);
mTimeStretcher = nullptr;
mSandbox.destroy_sandbox();
}
void RLBoxSoundTouch::setSampleRate(uint aRate) {

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

@ -46,7 +46,7 @@ namespace mozilla {
class RLBoxSoundTouch {
public:
RLBOX_SOUNDTOUCH_API
bool Init();
RLBoxSoundTouch();
RLBOX_SOUNDTOUCH_API
~RLBoxSoundTouch();
@ -76,7 +76,6 @@ class RLBoxSoundTouch {
void flush();
private:
bool mCreated{false};
uint mChannels{0};
rlbox_sandbox_soundtouch mSandbox;
tainted_soundtouch<mozilla::AudioDataValue*> mSampleBuffer{nullptr};