зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1176300 - Add soundtouch factory functions for DLL memory handling on windows; r=padenot
This commit is contained in:
Родитель
793be989a7
Коммит
23445a5b80
|
@ -1257,6 +1257,7 @@ X11/Xos.h
|
|||
X11/Xutil.h
|
||||
zmouse.h
|
||||
soundtouch/SoundTouch.h
|
||||
soundtouch/SoundTouchFactory.h
|
||||
#if MOZ_NATIVE_PNG==1
|
||||
png.h
|
||||
#endif
|
||||
|
|
|
@ -129,6 +129,7 @@ AudioStream::AudioStream()
|
|||
, mOutChannels(0)
|
||||
, mWritten(0)
|
||||
, mAudioClock(this)
|
||||
, mTimeStretcher(nullptr)
|
||||
, mLatencyRequest(HighLatency)
|
||||
, mReadPoint(0)
|
||||
, mDumpFile(nullptr)
|
||||
|
@ -151,6 +152,9 @@ AudioStream::~AudioStream()
|
|||
if (mDumpFile) {
|
||||
fclose(mDumpFile);
|
||||
}
|
||||
if (mTimeStretcher) {
|
||||
soundtouch::destroySoundTouchObj(mTimeStretcher);
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
|
@ -173,7 +177,7 @@ nsresult AudioStream::EnsureTimeStretcherInitializedUnlocked()
|
|||
{
|
||||
mMonitor.AssertCurrentThreadOwns();
|
||||
if (!mTimeStretcher) {
|
||||
mTimeStretcher = new soundtouch::SoundTouch();
|
||||
mTimeStretcher = soundtouch::createSoundTouchObj();
|
||||
mTimeStretcher->setSampleRate(mInRate);
|
||||
mTimeStretcher->setChannels(mOutChannels);
|
||||
mTimeStretcher->setPitch(1.0);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "CubebUtils.h"
|
||||
#include "soundtouch/SoundTouch.h"
|
||||
#include "soundtouch/SoundTouchFactory.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -329,7 +329,7 @@ private:
|
|||
// Number of frames written to the buffers.
|
||||
int64_t mWritten;
|
||||
AudioClock mAudioClock;
|
||||
nsAutoPtr<soundtouch::SoundTouch> mTimeStretcher;
|
||||
soundtouch::SoundTouch* mTimeStretcher;
|
||||
nsRefPtr<AsyncLatencyLogger> mLatencyLog;
|
||||
|
||||
// copy of Latency logger's starting time for offset calculations
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <soundtouch/SoundTouch.h>
|
||||
|
||||
namespace soundtouch
|
||||
{
|
||||
|
||||
EXPORT
|
||||
soundtouch::SoundTouch*
|
||||
createSoundTouchObj()
|
||||
{
|
||||
return new soundtouch::SoundTouch();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void
|
||||
destroySoundTouchObj(soundtouch::SoundTouch* aObj)
|
||||
{
|
||||
// SoundTouch runs deletes in its destructor, meaning they need to be run in
|
||||
// the DLL context. Gecko should send its SoundTouch obj pointers here to be
|
||||
// cleaned up.
|
||||
if (aObj) {
|
||||
delete aObj;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Code for dealing with creating/deleting SoundTouch objects across DLL
|
||||
// boundaries.
|
||||
|
||||
#include <soundtouch/STTypes.h>
|
||||
#include <soundtouch/SoundTouch.h>
|
||||
|
||||
namespace soundtouch
|
||||
{
|
||||
EXPORT
|
||||
soundtouch::SoundTouch*
|
||||
createSoundTouchObj();
|
||||
|
||||
EXPORT
|
||||
void
|
||||
destroySoundTouchObj(soundtouch::SoundTouch* aObj);
|
||||
}
|
|
@ -8,6 +8,7 @@ EXPORTS.soundtouch += [
|
|||
'FIFOSamplePipe.h',
|
||||
'SoundTouch.h',
|
||||
'soundtouch_config.h',
|
||||
'SoundTouchFactory.h',
|
||||
'STTypes.h',
|
||||
]
|
||||
|
||||
|
@ -21,6 +22,7 @@ UNIFIED_SOURCES += [
|
|||
'InterpolateShannon.cpp',
|
||||
'RateTransposer.cpp',
|
||||
'SoundTouch.cpp',
|
||||
'SoundTouchFactory.cpp',
|
||||
'TDStretch.cpp',
|
||||
]
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#pragma GCC visibility push(default)
|
||||
#include "SoundTouch.h"
|
||||
#include "SoundTouchFactory.h"
|
||||
#pragma GCC visibility pop
|
||||
|
||||
#endif // MOZILLA_SOUNDTOUCH_PERMS_H
|
||||
|
|
Загрузка…
Ссылка в новой задаче