Skip to content

Commit

Permalink
Update to 5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DrKLO committed Mar 3, 2019
1 parent f338a88 commit e397bd9
Show file tree
Hide file tree
Showing 200 changed files with 16,847 additions and 8,237 deletions.
40 changes: 27 additions & 13 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ configurations {
dependencies {
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-config:16.1.3'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
Expand Down Expand Up @@ -86,6 +86,16 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

debugMultidex {
initWith debug
minifyEnabled false
multiDexEnabled true
dependencies{
implementation 'com.android.support:multidex:1.0.3'
}
manifestPlaceholders = [applicationClassName:"MultiDexApplicationLoader"]
}

HA {
debuggable false
jniDebuggable false
Expand All @@ -103,20 +113,19 @@ android {
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

foss {
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
}
}

defaultConfig.versionCode = 1497
defaultConfig.versionCode = 1517

sourceSets.debug {
manifest.srcFile 'config/debug/AndroidManifest.xml'
}

sourceSets.debugMultidex {
manifest.srcFile 'config/debug/AndroidManifest.xml'
java.srcDirs = ['src/multidex/java']
}

sourceSets.HA {
manifest.srcFile 'config/debug/AndroidManifest.xml'
}
Expand All @@ -125,10 +134,6 @@ android {
manifest.srcFile 'config/release/AndroidManifest.xml'
}

sourceSets.foss {
manifest.srcFile 'config/foss/AndroidManifest.xml'
}

flavorDimensions "minApi"

productFlavors {
Expand Down Expand Up @@ -249,10 +254,17 @@ android {
}
}

variantFilter { variant ->
def names = variant.flavors*.name
if(variant.buildType.name!="release" && !names.contains("afat")){
setIgnore(true)
}
}

defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionName "5.3.1"
versionName "5.4.0"

vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']

Expand All @@ -262,6 +274,8 @@ android {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}

manifestPlaceholders = [applicationClassName:"ApplicationLoader"]
}
}

Expand Down
22 changes: 19 additions & 3 deletions TMessagesProj/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := swscale

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_SRC_FILES := ./ffmpeg/armv7-a/libswscale.a
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_SRC_FILES := ./ffmpeg/arm64/libswscale.a
else ifeq ($(TARGET_ARCH_ABI),x86)
LOCAL_SRC_FILES := ./ffmpeg/i686/libswscale.a
else ifeq ($(TARGET_ARCH_ABI),x86_64)
LOCAL_SRC_FILES := ./ffmpeg/x86_64/libswscale.a
endif

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := crypto

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
Expand Down Expand Up @@ -255,13 +271,13 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false

LOCAL_MODULE := tmessages.29
LOCAL_MODULE := tmessages.30
LOCAL_CFLAGS := -w -std=c11 -Os -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1
LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math -D__STDC_CONSTANT_MACROS
LOCAL_CPPFLAGS := -DBSD=1 -ffast-math -Os -funroll-loops -std=c++11
LOCAL_LDLIBS := -ljnigraphics -llog -lz -latomic -lEGL -lGLESv2 -landroid
LOCAL_STATIC_LIBRARIES := webp sqlite tgnet avformat avcodec avresample avutil voip flac
LOCAL_STATIC_LIBRARIES := webp sqlite tgnet swscale avformat avcodec avresample avutil voip flac

LOCAL_SRC_FILES := \
./opus/src/opus.c \
Expand Down Expand Up @@ -523,10 +539,10 @@ endif
LOCAL_SRC_FILES += \
./jni.c \
./audio.c \
./utils.c \
./image.c \
./video.c \
./intro/IntroRenderer.c \
./utilities.cpp \
./gifvideo.cpp \
./SqliteWrapper.cpp \
./TgNetWrapper.cpp \
Expand Down
14 changes: 7 additions & 7 deletions TMessagesProj/jni/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <time.h>
#include <opusfile.h>
#include <math.h>
#include "utils.h"
#include "c_utils.h"

typedef struct {
int version;
Expand Down Expand Up @@ -335,7 +335,7 @@ int initRecorder(const char *path) {
}

#ifdef OPUS_SET_LSB_DEPTH
result = opus_encoder_ctl(_encoder, OPUS_SET_LSB_DEPTH(max(8, min(24, inopt.samplesize))));
result = opus_encoder_ctl(_encoder, OPUS_SET_LSB_DEPTH(MAX(8, MIN(24, inopt.samplesize))));
if (result != OPUS_OK) {
LOGE("Warning OPUS_SET_LSB_DEPTH returned: %s", opus_strerror(result));
}
Expand Down Expand Up @@ -447,7 +447,7 @@ int writeFrame(uint8_t *framePcmBytes, uint32_t frameByteCount) {

enc_granulepos += cur_frame_size * 48000 / coding_rate;
size_segments = (nbBytes + 255) / 255;
min_bytes = min(nbBytes, min_bytes);
min_bytes = MIN(nbBytes, min_bytes);
}

while ((((size_segments <= 255) && (last_segments + size_segments > 255)) || (enc_granulepos - last_granulepos > max_ogg_delay)) && ogg_stream_flush_fill(&os, &og, 255 * 255)) {
Expand Down Expand Up @@ -548,7 +548,7 @@ JNIEXPORT jbyteArray Java_org_telegram_messenger_MediaController_getWaveform2(JN
uint16_t *samples = malloc(100 * 2);
uint64_t sampleIndex = 0;
uint16_t peakSample = 0;
int32_t sampleRate = (int32_t) max(1, length / resultSamples);
int32_t sampleRate = (int32_t) MAX(1, length / resultSamples);
int32_t index = 0;

for (int32_t i = 0; i < length; i++) {
Expand Down Expand Up @@ -588,7 +588,7 @@ JNIEXPORT jbyteArray Java_org_telegram_messenger_MediaController_getWaveform2(JN
uint8_t *bytes = malloc(bitstreamLength + 4);
memset(bytes, 0, bitstreamLength + 4);
for (int32_t i = 0; i < resultSamples; i++) {
int32_t value = min(31, abs((int32_t) samples[i]) * 31 / peak);
int32_t value = MIN(31, abs((int32_t) samples[i]) * 31 / peak);
set_bits(bytes, i * 5, value & 31);
}
(*env)->SetByteArrayRegion(env, result, 0, bitstreamLength, (jbyte *) bytes);
Expand All @@ -609,7 +609,7 @@ JNIEXPORT jbyteArray Java_org_telegram_messenger_MediaController_getWaveform(JNI
if (opusFile != NULL && error == OPUS_OK) {
int64_t totalSamples = op_pcm_total(opusFile, -1);
const uint32_t resultSamples = 100;
int32_t sampleRate = max(1, (int32_t) (totalSamples / resultSamples));
int32_t sampleRate = MAX(1, (int32_t) (totalSamples / resultSamples));

uint16_t *samples = malloc(100 * 2);

Expand Down Expand Up @@ -667,7 +667,7 @@ JNIEXPORT jbyteArray Java_org_telegram_messenger_MediaController_getWaveform(JNI
memset(bytes, 0, bitstreamLength + 4);

for (int32_t i = 0; i < resultSamples; i++) {
int32_t value = min(31, abs((int32_t) samples[i]) * 31 / peak);
int32_t value = MIN(31, abs((int32_t) samples[i]) * 31 / peak);
set_bits(bytes, i * 5, value & 31);
}

Expand Down
10 changes: 4 additions & 6 deletions TMessagesProj/jni/utils.h → TMessagesProj/jni/c_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@
#define LOGV(...)
#endif

#ifndef max
#define max(x, y) ((x) > (y)) ? (x) : (y)
#ifndef MAX
#define MAX(x, y) ((x) > (y)) ? (x) : (y)
#endif
#ifndef min
#define min(x, y) ((x) < (y)) ? (x) : (y)
#ifndef MIN
#define MIN(x, y) ((x) < (y)) ? (x) : (y)
#endif

void throwException(JNIEnv *env, char *format, ...);

#endif
Binary file modified TMessagesProj/jni/ffmpeg/arm64/libavcodec.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/arm64/libavformat.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/arm64/libavresample.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/arm64/libavutil.a
Binary file not shown.
Binary file added TMessagesProj/jni/ffmpeg/arm64/libswscale.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armv7-a/libavcodec.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armv7-a/libavformat.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armv7-a/libavresample.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/armv7-a/libavutil.a
Binary file not shown.
Binary file added TMessagesProj/jni/ffmpeg/armv7-a/libswscale.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/i686/libavcodec.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/i686/libavformat.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/i686/libavresample.a
Binary file not shown.
Binary file modified TMessagesProj/jni/ffmpeg/i686/libavutil.a
Binary file not shown.
Binary file added TMessagesProj/jni/ffmpeg/i686/libswscale.a
Binary file not shown.
Loading

0 comments on commit e397bd9

Please sign in to comment.