Commit 4ddfda63 authored by DrKLO's avatar DrKLO

Bug fixes

parent 5ddd8a09
......@@ -18,6 +18,7 @@ import android.content.res.Configuration;
import android.text.format.DateFormat;
import android.util.Xml;
import org.telegram.android.time.FastDateFormat;
import org.telegram.messenger.ConnectionsManager;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.R;
......
......@@ -3886,8 +3886,13 @@ public class MessagesController implements NotificationCenter.NotificationCenter
return null;
}
if (chat.seq_in != layer.out_seq_no && chat.seq_in != layer.out_seq_no - 2) {
/*TLRPC.Message decryptedMessage = processDecryptedObject(chat, message, layer.message);
if (decryptedMessage == null) {
ArrayList<TLRPC.TL_decryptedMessageHolder> arr = secretHolesQueue.get(chat.id);
if (arr == null) {
arr = new ArrayList<TLRPC.TL_decryptedMessageHolder>();
secretHolesQueue.put(chat.id, arr);
}
if (arr.size() >= 10) {
secretHolesQueue.remove(chat.id);
final TLRPC.TL_encryptedChatDiscarded newChat = new TLRPC.TL_encryptedChatDiscarded();
newChat.id = chat.id;
newChat.user_id = chat.user_id;
......@@ -3903,12 +3908,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
});
declineSecretChat(chat.id);
}*/
ArrayList<TLRPC.TL_decryptedMessageHolder> arr = secretHolesQueue.get(chat.id);
if (arr == null) {
arr = new ArrayList<TLRPC.TL_decryptedMessageHolder>();
secretHolesQueue.put(chat.id, arr);
return null;
}
TLRPC.TL_decryptedMessageHolder holder = new TLRPC.TL_decryptedMessageHolder();
holder.layer = layer;
holder.file = message.file;
......
......@@ -110,7 +110,7 @@ public class MessagesStorage {
database.executeFast("CREATE TABLE download_queue(uid INTEGER, type INTEGER, date INTEGER, data BLOB, PRIMARY KEY (uid, type));").stepThis().dispose();
database.executeFast("CREATE TABLE dialog_settings(did INTEGER PRIMARY KEY, flags INTEGER);").stepThis().dispose();
database.executeFast("CREATE TABLE messages_seq(mid INTEGER PRIMARY KEY, seq_in INTEGER, seq_out INTEGER);").stepThis().dispose();
database.executeFast("CREATE TABLE secret_holes(uid INTEGER, seq_in INTEGER, seq_out INTEGER, data BLOB, PRIMARY KEY (uid, seq_in, seq_out));").stepThis().dispose();
//database.executeFast("CREATE TABLE secret_holes(uid INTEGER, seq_in INTEGER, seq_out INTEGER, data BLOB, PRIMARY KEY (uid, seq_in, seq_out));").stepThis().dispose();
//database.executeFast("CREATE TABLE attach_data(uid INTEGER, id INTEGER, data BLOB, PRIMARY KEY (uid, id))").stepThis().dispose();
......@@ -142,7 +142,7 @@ public class MessagesStorage {
database.executeFast("CREATE INDEX IF NOT EXISTS seq_idx_messages_seq ON messages_seq(seq_in, seq_out);").stepThis().dispose();
database.executeFast("PRAGMA user_version = 8").stepThis().dispose();
database.executeFast("PRAGMA user_version = 7").stepThis().dispose();
} else {
try {
SQLiteCursor cursor = database.queryFinalized("SELECT seq, pts, date, qts, lsv, sg, pbytes FROM params WHERE id = 1");
......@@ -174,7 +174,7 @@ public class MessagesStorage {
}
int version = database.executeInt("PRAGMA user_version");
if (version < 8) {
if (version < 7) {
updateDbToLastVersion(version);
}
}
......@@ -304,11 +304,11 @@ public class MessagesStorage {
database.executeFast("PRAGMA user_version = 7").stepThis().dispose();
version = 7;
}
if (version == 7 && version < 8) {
/*if (version == 7 && version < 8) {
database.executeFast("CREATE TABLE IF NOT EXISTS secret_holes(uid INTEGER, seq_in INTEGER, seq_out INTEGER, data BLOB, PRIMARY KEY (uid, seq_in, seq_out));").stepThis().dispose();
database.executeFast("PRAGMA user_version = 8").stepThis().dispose();
version = 8;
}
}*/
} catch (Exception e) {
FileLog.e("tmessages", e);
}
......@@ -671,7 +671,7 @@ public class MessagesStorage {
}
} else {
database.executeFast("DELETE FROM enc_chats WHERE uid = " + high_id).stepThis().dispose();
database.executeFast("DELETE FROM secret_holes WHERE uid = " + high_id).stepThis().dispose();
//database.executeFast("DELETE FROM secret_holes WHERE uid = " + high_id).stepThis().dispose();
}
}
database.executeFast("UPDATE dialogs SET unread_count = 0 WHERE did = " + did).stepThis().dispose();
......@@ -2805,7 +2805,7 @@ public class MessagesStorage {
});
}
public void getHoleMessages() {
/*public void getHoleMessages() {
storageQueue.postRunnable(new Runnable() {
@Override
public void run() {
......@@ -2857,7 +2857,7 @@ public class MessagesStorage {
}
}
});
}
}*/
public void setMessageSeq(final int mid, final int seq_in, final int seq_out) {
storageQueue.postRunnable(new Runnable() {
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.telegram.android.time;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/**
* <p>DateParser is the "missing" interface for the parsing methods of
* {@link java.text.DateFormat}.</p>
*
* @since 3.2
*/
public interface DateParser {
/**
* Equivalent to DateFormat.parse(String).
* <p/>
* See {@link java.text.DateFormat#parse(String)} for more information.
*
* @param source A <code>String</code> whose beginning should be parsed.
* @return A <code>Date</code> parsed from the string
* @throws ParseException if the beginning of the specified string cannot be parsed.
*/
Date parse(String source) throws ParseException;
/**
* Equivalent to DateFormat.parse(String, ParsePosition).
* <p/>
* See {@link java.text.DateFormat#parse(String, ParsePosition)} for more information.
*
* @param source A <code>String</code>, part of which should be parsed.
* @param pos A <code>ParsePosition</code> object with index and error index information
* as described above.
* @return A <code>Date</code> parsed from the string. In case of error, returns null.
* @throws NullPointerException if text or pos is null.
*/
Date parse(String source, ParsePosition pos);
// Accessors
//-----------------------------------------------------------------------
/**
* <p>Get the pattern used by this parser.</p>
*
* @return the pattern, {@link java.text.SimpleDateFormat} compatible
*/
String getPattern();
/**
* <p>
* Get the time zone used by this parser.
* </p>
* <p/>
* <p>
* The default {@link TimeZone} used to create a {@link Date} when the {@link TimeZone} is not specified by
* the format pattern.
* </p>
*
* @return the time zone
*/
TimeZone getTimeZone();
/**
* <p>Get the locale used by this parser.</p>
*
* @return the locale
*/
Locale getLocale();
/**
* Parses text from a string to produce a Date.
*
* @param source A <code>String</code> whose beginning should be parsed.
* @return a <code>java.util.Date</code> object
* @throws ParseException if the beginning of the specified string cannot be parsed.
* @see java.text.DateFormat#parseObject(String)
*/
Object parseObject(String source) throws ParseException;
/**
* Parse a date/time string according to the given parse position.
*
* @param source A <code>String</code> whose beginning should be parsed.
* @param pos the parse position
* @return a <code>java.util.Date</code> object
* @see java.text.DateFormat#parseObject(String, ParsePosition)
*/
Object parseObject(String source, ParsePosition pos);
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.telegram.android.time;
import java.text.FieldPosition;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
/**
* <p>DatePrinter is the "missing" interface for the format methods of
* {@link java.text.DateFormat}.</p>
*
* @since 3.2
*/
public interface DatePrinter {
/**
* <p>Formats a millisecond {@code long} value.</p>
*
* @param millis the millisecond value to format
* @return the formatted string
* @since 2.1
*/
String format(long millis);
/**
* <p>Formats a {@code Date} object using a {@code GregorianCalendar}.</p>
*
* @param date the date to format
* @return the formatted string
*/
String format(Date date);
/**
* <p>Formats a {@code Calendar} object.</p>
*
* @param calendar the calendar to format
* @return the formatted string
*/
String format(Calendar calendar);
/**
* <p>Formats a milliseond {@code long} value into the
* supplied {@code StringBuffer}.</p>
*
* @param millis the millisecond value to format
* @param buf the buffer to format into
* @return the specified string buffer
*/
StringBuffer format(long millis, StringBuffer buf);
/**
* <p>Formats a {@code Date} object into the
* supplied {@code StringBuffer} using a {@code GregorianCalendar}.</p>
*
* @param date the date to format
* @param buf the buffer to format into
* @return the specified string buffer
*/
StringBuffer format(Date date, StringBuffer buf);
/**
* <p>Formats a {@code Calendar} object into the
* supplied {@code StringBuffer}.</p>
*
* @param calendar the calendar to format
* @param buf the buffer to format into
* @return the specified string buffer
*/
StringBuffer format(Calendar calendar, StringBuffer buf);
// Accessors
//-----------------------------------------------------------------------
/**
* <p>Gets the pattern used by this printer.</p>
*
* @return the pattern, {@link java.text.SimpleDateFormat} compatible
*/
String getPattern();
/**
* <p>Gets the time zone used by this printer.</p>
* <p/>
* <p>This zone is always used for {@code Date} printing. </p>
*
* @return the time zone
*/
TimeZone getTimeZone();
/**
* <p>Gets the locale used by this printer.</p>
*
* @return the locale
*/
Locale getLocale();
/**
* <p>Formats a {@code Date}, {@code Calendar} or
* {@code Long} (milliseconds) object.</p>
* <p/>
* See {@link java.text.DateFormat#format(Object, StringBuffer, FieldPosition)}
*
* @param obj the object to format
* @param toAppendTo the buffer to append to
* @param pos the position - ignored
* @return the buffer passed in
*/
StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos);
}
......@@ -11,7 +11,7 @@ package org.telegram.messenger;
import android.net.Uri;
import android.util.Log;
import org.telegram.android.FastDateFormat;
import org.telegram.android.time.FastDateFormat;
import org.telegram.ui.ApplicationLoader;
import java.io.File;
......
......@@ -89,8 +89,8 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
private float videoDuration = 0;
private long startTime = 0;
private long endTime = 0;
private int audioFramesSize = 0;
private int videoFramesSize = 0;
private long audioFramesSize = 0;
private long videoFramesSize = 0;
private int estimatedSize = 0;
private long esimatedDuration = 0;
private long originalSize = 0;
......@@ -292,7 +292,9 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
name.equals("OMX.ST.VFM.H264Enc") ||
name.equals("OMX.Exynos.avc.enc") ||
name.equals("OMX.MARVELL.VIDEO.HW.CODA7542ENCODER") ||
name.equals("OMX.MARVELL.VIDEO.H264ENCODER")) {
name.equals("OMX.MARVELL.VIDEO.H264ENCODER") ||
name.equals("OMX.k3.video.encoder.avc") || //fix this later
name.equals("OMX.TI.DUCATI1.VIDEO.H264E")) { //fix this later
compressVideo.setVisibility(View.GONE);
} else {
if (MediaController.selectColorFormat(codecInfo, MediaController.MIME_TYPE) == 0) {
......@@ -721,8 +723,8 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
for (Box box : boxes) {
TrackBox trackBox = (TrackBox)box;
int sampleSizes = 0;
int trackBitrate = 0;
long sampleSizes = 0;
long trackBitrate = 0;
try {
MediaBox mediaBox = trackBox.getMediaBox();
MediaHeaderBox mediaHeaderBox = mediaBox.getMediaHeaderBox();
......@@ -738,7 +740,7 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
TrackHeaderBox headerBox = trackBox.getTrackHeaderBox();
if (headerBox.getWidth() != 0 && headerBox.getHeight() != 0) {
trackHeaderBox = headerBox;
bitrate = trackBitrate / 100000 * 100000;
bitrate = (int)(trackBitrate / 100000 * 100000);
if (bitrate > 900000) {
bitrate = 900000;
}
......@@ -768,7 +770,7 @@ public class VideoEditorActivity extends BaseFragment implements TextureView.Sur
resultHeight *= scale;
if (bitrate != 0) {
bitrate *= Math.max(0.5f, scale);
videoFramesSize = (int)(bitrate / 8 * videoDuration);
videoFramesSize = (long)(bitrate / 8 * videoDuration);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment