From f1469a95bb645715968edfb2223a794e740b7a73 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 20 Apr 2016 13:35:57 +0200 Subject: [PATCH] FIRE-17812: Increase sounds length to 60s on OpenSim --- indra/llaudio/llvorbisencode.cpp | 20 +++++++++++++++---- indra/llaudio/llvorbisencode.h | 9 +++++++-- indra/newview/llviewerassetupload.cpp | 7 ++++++- indra/newview/llviewermenufile.cpp | 5 ++++- .../skins/default/xui/de/notifications.xml | 2 +- .../skins/default/xui/en/notifications.xml | 2 +- .../skins/default/xui/es/notifications.xml | 2 +- .../skins/default/xui/fr/notifications.xml | 2 +- .../skins/default/xui/it/notifications.xml | 2 +- .../skins/default/xui/ja/notifications.xml | 2 +- .../skins/default/xui/pl/notifications.xml | 2 +- .../skins/default/xui/pt/notifications.xml | 2 +- .../skins/default/xui/ru/notifications.xml | 2 +- .../skins/default/xui/tr/notifications.xml | 2 +- .../skins/default/xui/zh/notifications.xml | 2 +- 15 files changed, 44 insertions(+), 19 deletions(-) diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp index 2e1ed9b505..f11e33e577 100755 --- a/indra/llaudio/llvorbisencode.cpp +++ b/indra/llaudio/llvorbisencode.cpp @@ -66,7 +66,10 @@ #endif -S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg) +// FIRE-17812: Increase sounds length to 60s on OpenSim +//S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg) +S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg, bool is_in_secondlife) +// { U16 num_channels = 0; U32 sample_rate = 0; @@ -189,7 +192,10 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro F32 clip_length = (F32)raw_data_length/(F32)bytes_per_sec; - if (clip_length > LLVORBIS_CLIP_MAX_TIME) + // FIRE-17812: Increase sounds length to 60s on OpenSim + //if (clip_length > LLVORBIS_CLIP_MAX_TIME) + if (clip_length > (is_in_secondlife ? LLVORBIS_CLIP_MAX_TIME : LLVORBIS_CLIP_MAX_TIME_OPENSIM)) + // { error_msg = "SoundFileInvalidTooLong"; return(LLVORBISENC_CLIP_TOO_LONG); @@ -198,7 +204,10 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro return(LLVORBISENC_NOERR); } -S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname) +// FIRE-17812: Increase sounds length to 60s on OpenSim +//S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname) +S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname, bool is_in_secondlife) +// { #define READ_BUFFER 1024 unsigned char readbuffer[READ_BUFFER*4+44]; /* out of the data segment, not the stack */ /*Flawfinder: ignore*/ @@ -222,7 +231,10 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname S32 format_error = 0; std::string error_msg; - if ((format_error = check_for_invalid_wav_formats(in_fname, error_msg))) + // FIRE-17812: Increase sounds length to 60s on OpenSim + //if ((format_error = check_for_invalid_wav_formats(in_fname, error_msg))) + if ((format_error = check_for_invalid_wav_formats(in_fname, error_msg, is_in_secondlife))) + // { LL_WARNS() << error_msg << ": " << in_fname << LL_ENDL; return(format_error); diff --git a/indra/llaudio/llvorbisencode.h b/indra/llaudio/llvorbisencode.h index 6b22a2cb59..933200329e 100755 --- a/indra/llaudio/llvorbisencode.h +++ b/indra/llaudio/llvorbisencode.h @@ -41,6 +41,7 @@ const S32 LLVORBISENC_CLIP_TOO_LONG = 10; // source file is too l const S32 LLVORBISENC_CHUNK_SIZE_ERR = 11; // chunk size is wrong const F32 LLVORBIS_CLIP_MAX_TIME = 10.0f; +const F32 LLVORBIS_CLIP_MAX_TIME_OPENSIM = 60.0f; // FIRE-17812: Increase sounds length to 60s on OpenSim const U8 LLVORBIS_CLIP_MAX_CHANNELS = 2; const U32 LLVORBIS_CLIP_SAMPLE_RATE = 44100; const U32 LLVORBIS_CLIP_MAX_SAMPLES_PER_CHANNEL = (U32)(LLVORBIS_CLIP_MAX_TIME * LLVORBIS_CLIP_SAMPLE_RATE); @@ -52,8 +53,12 @@ const size_t LLVORBIS_CLIP_MAX_SAMPLE_DATA = LLVORBIS_CLIP_MAX_SAMPL const size_t LLVORBIS_CLIP_REJECT_SAMPLES = LLVORBIS_CLIP_MAX_SAMPLES * 3; const size_t LLVORBIS_CLIP_REJECT_SIZE = LLVORBIS_CLIP_MAX_SAMPLE_DATA * 3; -S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg); -S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname); +// FIRE-17812: Increase sounds length to 60s on OpenSim +//S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg); +//S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname); +S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& error_msg, bool is_in_secondlife); +S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname, bool is_in_secondlife); +// #endif diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index 65b4153ba3..b529273282 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -51,6 +51,8 @@ #include "llpreviewgesture.h" #include "llcoproceduremanager.h" +#include "llviewernetwork.h" + void dialog_refresh_all(); LLResourceUploadInfo::LLResourceUploadInfo(LLTransactionID transactId, @@ -392,7 +394,10 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() LL_INFOS() << "Attempting to encode wav as an ogg file" << LL_ENDL; - encodeResult = encode_vorbis_file(getFileName(), filename); + // FIRE-17812: Increase sounds length to 60s on OpenSim + //encodeResult = encode_vorbis_file(getFileName(), filename); + encodeResult = encode_vorbis_file(getFileName(), filename, LLGridManager::instance().isInSecondLife()); + // if (LLVORBISENC_NOERR != encodeResult) { diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 30506e29ab..622d8f9b6b 100755 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -80,6 +80,8 @@ #include "llinventorydefines.h" +#include "llviewernetwork.h" + class LLFileEnableUpload : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -465,11 +467,12 @@ static void show_floater_callback(const std::string& floater, const std::string& { // pre-qualify wavs to make sure the format is acceptable std::string error_msg; - if (check_for_invalid_wav_formats(filename,error_msg)) + if (check_for_invalid_wav_formats(filename, error_msg, LLGridManager::instance().isInSecondLife())) { LL_INFOS() << error_msg << ": " << filename << LL_ENDL; LLSD args; args["FILE"] = filename; + args["MAX_LENGTH"] = llformat("%.0f", (LLGridManager::instance().isInSecondLife() ? LLVORBIS_CLIP_MAX_TIME : LLVORBIS_CLIP_MAX_TIME_OPENSIM)); LLNotificationsUtil::add( error_msg, args ); return; } diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml index 66fc02be03..524ccef37f 100755 --- a/indra/newview/skins/default/xui/de/notifications.xml +++ b/indra/newview/skins/default/xui/de/notifications.xml @@ -836,7 +836,7 @@ Erwartet wurde [VALIDS] [FILE] - Audiodatei ist zu lang (max. 10 Sekunden): + Audiodatei ist zu lang (max. [MAX_LENGTH] Sekunden): [FILE] diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index c2d74934c7..966d2bd82a 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2144,7 +2144,7 @@ Wrong chunk size in WAV file: icon="alertmodal.tga" name="SoundFileInvalidTooLong" type="alertmodal"> -Audio file is too long (10 second maximum): +Audio file is too long ([MAX_LENGTH] second maximum): [FILE] fail diff --git a/indra/newview/skins/default/xui/es/notifications.xml b/indra/newview/skins/default/xui/es/notifications.xml index 623b52ff22..fba97b6821 100755 --- a/indra/newview/skins/default/xui/es/notifications.xml +++ b/indra/newview/skins/default/xui/es/notifications.xml @@ -839,7 +839,7 @@ Se admiten [VALIDS] [FILE] - El archivo de audio es demasiado largo (debe ser como máximo de10 segundos): + El archivo de audio es demasiado largo (debe ser como máximo de [MAX_LENGTH] segundos): [FILE] diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml index 60e170cf7f..0f692b8df1 100755 --- a/indra/newview/skins/default/xui/fr/notifications.xml +++ b/indra/newview/skins/default/xui/fr/notifications.xml @@ -602,7 +602,7 @@ Wrong chunk size in WAV file: [FILE] -Audio file is too long (10 second maximum): +Audio file is too long ([MAX_LENGTH] second maximum): [FILE] diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml index 5194be094f..d8a7e871d7 100755 --- a/indra/newview/skins/default/xui/it/notifications.xml +++ b/indra/newview/skins/default/xui/it/notifications.xml @@ -796,7 +796,7 @@ Attese [VALIDS] [FILE] - Il file audio è troppo lungo (deve essere al massimo 10 secondi): + Il file audio è troppo lungo (deve essere al massimo [MAX_LENGTH] secondi): [FILE] diff --git a/indra/newview/skins/default/xui/ja/notifications.xml b/indra/newview/skins/default/xui/ja/notifications.xml index 2da5b26af6..3e78b497fd 100644 --- a/indra/newview/skins/default/xui/ja/notifications.xml +++ b/indra/newview/skins/default/xui/ja/notifications.xml @@ -834,7 +834,7 @@ L$ が不足しているのでこのグループに参加することができ [FILE] - オーディオファイルが長すぎます。(最大 10 秒): + オーディオファイルが長すぎます。(最大 [MAX_LENGTH] 秒): [FILE] diff --git a/indra/newview/skins/default/xui/pl/notifications.xml b/indra/newview/skins/default/xui/pl/notifications.xml index e16d1386b6..e9d84e13a6 100755 --- a/indra/newview/skins/default/xui/pl/notifications.xml +++ b/indra/newview/skins/default/xui/pl/notifications.xml @@ -759,7 +759,7 @@ Oczekiwane: [VALIDS] [FILE] - Plik audio jest zbyt długi (10 sekund maksimum): + Plik audio jest zbyt długi ([MAX_LENGTH] sekund maksimum): [FILE] diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml index 81e9d2fca4..8502243b5b 100755 --- a/indra/newview/skins/default/xui/pt/notifications.xml +++ b/indra/newview/skins/default/xui/pt/notifications.xml @@ -792,7 +792,7 @@ Esperada [VALIDS] [FILE] - Arquivo de áudio é muito longo (no máximo 10 segundos): + Arquivo de áudio é muito longo (no máximo [MAX_LENGTH] segundos): [FILE] diff --git a/indra/newview/skins/default/xui/ru/notifications.xml b/indra/newview/skins/default/xui/ru/notifications.xml index d27952e384..54b23cfccd 100755 --- a/indra/newview/skins/default/xui/ru/notifications.xml +++ b/indra/newview/skins/default/xui/ru/notifications.xml @@ -840,7 +840,7 @@ [FILE] - Аудиофайл слишком длинный (максимум 10 секунд): + Аудиофайл слишком длинный (максимум [MAX_LENGTH] секунд): [FILE] diff --git a/indra/newview/skins/default/xui/tr/notifications.xml b/indra/newview/skins/default/xui/tr/notifications.xml index 281d8a1b5f..3401e1a4d1 100755 --- a/indra/newview/skins/default/xui/tr/notifications.xml +++ b/indra/newview/skins/default/xui/tr/notifications.xml @@ -798,7 +798,7 @@ Beklenen [VALIDS] [FILE] - Ses dosyası çok uzun (En fazla 10 saniye olmalı): + Ses dosyası çok uzun (En fazla [MAX_LENGTH] saniye olmalı): [FILE] diff --git a/indra/newview/skins/default/xui/zh/notifications.xml b/indra/newview/skins/default/xui/zh/notifications.xml index f7b7aad016..987b0d745d 100755 --- a/indra/newview/skins/default/xui/zh/notifications.xml +++ b/indra/newview/skins/default/xui/zh/notifications.xml @@ -798,7 +798,7 @@ [FILE] - 音頻檔太長(最大值 10 秒): + 音頻檔太長(最大值 [MAX_LENGTH] 秒): [FILE]