Merge branch 'master' into 21359

This commit is contained in:
David Rowe 2017-05-20 10:11:25 +12:00
commit 0d6513c7dc
9 changed files with 34 additions and 10 deletions

View file

@ -38,13 +38,14 @@
#include "AudioMixer.h"
static const float DEFAULT_ATTENUATION_PER_DOUBLING_IN_DISTANCE = 0.5f; // attenuation = -6dB * log2(distance)
static const int DISABLE_STATIC_JITTER_FRAMES = -1;
static const float DEFAULT_NOISE_MUTING_THRESHOLD = 1.0f;
static const QString AUDIO_MIXER_LOGGING_TARGET_NAME = "audio-mixer";
static const QString AUDIO_ENV_GROUP_KEY = "audio_env";
static const QString AUDIO_BUFFER_GROUP_KEY = "audio_buffer";
static const QString AUDIO_THREADING_GROUP_KEY = "audio_threading";
int AudioMixer::_numStaticJitterFrames{ -1 };
int AudioMixer::_numStaticJitterFrames{ DISABLE_STATIC_JITTER_FRAMES };
float AudioMixer::_noiseMutingThreshold{ DEFAULT_NOISE_MUTING_THRESHOLD };
float AudioMixer::_attenuationPerDoublingInDistance{ DEFAULT_ATTENUATION_PER_DOUBLING_IN_DISTANCE };
std::map<QString, std::shared_ptr<CodecPlugin>> AudioMixer::_availableCodecs{ };
@ -56,7 +57,12 @@ QVector<AudioMixer::ReverbSettings> AudioMixer::_zoneReverbSettings;
AudioMixer::AudioMixer(ReceivedMessage& message) :
ThreadedAssignment(message) {
// Always clear settings first
// This prevents previous assignment settings from sticking around
clearDomainSettings();
// hash the available codecs (on the mixer)
_availableCodecs.clear(); // Make sure struct is clean
auto codecPlugins = PluginManager::getInstance()->getCodecPlugins();
std::for_each(codecPlugins.cbegin(), codecPlugins.cend(),
[&](const CodecPluginPointer& codec) {
@ -232,7 +238,7 @@ void AudioMixer::sendStatsPacket() {
}
// general stats
statsObject["useDynamicJitterBuffers"] = _numStaticJitterFrames == -1;
statsObject["useDynamicJitterBuffers"] = _numStaticJitterFrames == DISABLE_STATIC_JITTER_FRAMES;
statsObject["threads"] = _slavePool.numThreads();
@ -490,6 +496,16 @@ int AudioMixer::prepareFrame(const SharedNodePointer& node, unsigned int frame)
return data->checkBuffersBeforeFrameSend();
}
void AudioMixer::clearDomainSettings() {
_numStaticJitterFrames = DISABLE_STATIC_JITTER_FRAMES;
_attenuationPerDoublingInDistance = DEFAULT_ATTENUATION_PER_DOUBLING_IN_DISTANCE;
_noiseMutingThreshold = DEFAULT_NOISE_MUTING_THRESHOLD;
_codecPreferenceOrder.clear();
_audioZones.clear();
_zoneSettings.clear();
_zoneReverbSettings.clear();
}
void AudioMixer::parseSettingsObject(const QJsonObject &settingsObject) {
qDebug() << "AVX2 Support:" << (cpuSupportsAVX2() ? "enabled" : "disabled");
@ -525,7 +541,7 @@ void AudioMixer::parseSettingsObject(const QJsonObject &settingsObject) {
qDebug() << "Static desired jitter buffer frames:" << _numStaticJitterFrames;
} else {
qDebug() << "Disabling dynamic jitter buffers.";
_numStaticJitterFrames = -1;
_numStaticJitterFrames = DISABLE_STATIC_JITTER_FRAMES;
}
// check for deprecated audio settings

View file

@ -79,6 +79,7 @@ private:
QString percentageForMixStats(int counter);
void parseSettingsObject(const QJsonObject& settingsObject);
void clearDomainSettings();
float _trailingMixRatio { 0.0f };
float _throttlingRatio { 0.0f };

View file

@ -6428,7 +6428,7 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa
if (!includeAnimated) {
// Tell the dependency manager that the capture of the still snapshot has taken place.
emit DependencyManager::get<WindowScriptingInterface>()->stillSnapshotTaken(path, notify);
} else {
} else if (!SnapshotAnimated::isAlreadyTakingSnapshotAnimated()) {
// Get an animated GIF snapshot and save it
SnapshotAnimated::saveSnapshotAnimated(path, aspectRatio, qApp, DependencyManager::get<WindowScriptingInterface>());
}

View file

@ -51,6 +51,7 @@ private:
static void processFrames();
public:
static void saveSnapshotAnimated(QString pathStill, float aspectRatio, Application* app, QSharedPointer<WindowScriptingInterface> dm);
static bool isAlreadyTakingSnapshotAnimated() { return snapshotAnimatedFirstFrameTimestamp != 0; };
static Setting::Handle<bool> alsoTakeAnimatedSnapshot;
static Setting::Handle<float> snapshotAnimatedDuration;
};

View file

@ -1506,6 +1506,7 @@ bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDevice
// cleanup any previously initialized device
if (_audioOutput) {
_audioOutputIODevice.close();
_audioOutput->stop();
//must be deleted in next eventloop cycle when its called from notify()

View file

@ -94,7 +94,6 @@ public:
_audio(audio), _unfulfilledReads(0) {}
void start() { open(QIODevice::ReadOnly | QIODevice::Unbuffered); }
void stop() { close(); }
qint64 readData(char * data, qint64 maxSize) override;
qint64 writeData(const char * data, qint64 maxSize) override { return 0; }
int getRecentUnfulfilledReads() { int unfulfilledReads = _unfulfilledReads; _unfulfilledReads = 0; return unfulfilledReads; }

View file

@ -149,7 +149,8 @@ namespace ktx {
for (size_t i = 0; i < descriptors.size(); ++i) {
auto ptr = reinterpret_cast<uint32_t*>(currentDestPtr);
*ptr = descriptors[i]._imageSize;
uint32_t imageFaceSize = descriptors[i]._faceSize;
*ptr = imageFaceSize; // the imageSize written in the ktx is the FACE size
#ifdef DEBUG
ptr++;

View file

@ -44,6 +44,7 @@ function showSetupComplete() {
'<p>Snapshot location set.</p>' +
'<p>Press the big red button to take a snap!</p>' +
'</div>';
document.getElementById("snap-button").disabled = false;
}
function showSnapshotInstructions() {
var snapshotImagesDiv = document.getElementById("snapshot-images");
@ -69,7 +70,6 @@ function login() {
}));
}
function clearImages() {
document.getElementById("snap-button").disabled = false;
var snapshotImagesDiv = document.getElementById("snapshot-images");
snapshotImagesDiv.classList.remove("snapshotInstructions");
while (snapshotImagesDiv.hasChildNodes()) {
@ -300,7 +300,7 @@ function addImage(image_data, isLoggedIn, canShare, isGifLoading, isShowingPrevi
if (!isGifLoading) {
appendShareBar(id, isLoggedIn, canShare, isGif, blastButtonDisabled, hifiButtonDisabled, canBlast);
}
if (!isGifLoading && !isShowingPreviousImages) {
if (!isGifLoading || (isShowingPreviousImages && !image_data.story_id)) {
shareForUrl(id);
}
if (isShowingPreviousImages && isLoggedIn && image_data.story_id) {
@ -650,6 +650,7 @@ window.onload = function () {
shareForUrl("p1");
appendShareBar("p1", messageOptions.isLoggedIn, messageOptions.canShare, true, false, false, messageOptions.canBlast);
document.getElementById("p1").classList.remove("processingGif");
document.getElementById("snap-button").disabled = false;
}
} else {
imageCount = message.image_data.length;
@ -688,6 +689,9 @@ function takeSnapshot() {
type: "snapshot",
action: "takeSnapshot"
}));
if (document.getElementById('stillAndGif').checked === true) {
document.getElementById("snap-button").disabled = true;
}
}
function testInBrowser(test) {

View file

@ -138,10 +138,10 @@ function onMessage(message) {
isLoggedIn = Account.isLoggedIn();
if (isLoggedIn) {
print('Sharing snapshot with audience "for_url":', message.data);
Window.shareSnapshot(message.data, message.href || href);
Window.shareSnapshot(message.data, Settings.getValue("previousSnapshotHref"));
} else {
shareAfterLogin = true;
snapshotToShareAfterLogin.push({ path: message.data, href: message.href || href });
snapshotToShareAfterLogin.push({ path: message.data, href: Settings.getValue("previousSnapshotHref") });
}
}
});
@ -349,6 +349,7 @@ function takeSnapshot() {
// We will record snapshots based on the starting location. That could change, e.g., when recording a .gif.
// Even the domainId could change (e.g., if the user falls into a teleporter while recording).
href = location.href;
Settings.setValue("previousSnapshotHref", href);
domainId = location.domainId;
Settings.setValue("previousSnapshotDomainID", domainId);