Ship "instant" video playback.

This commit is contained in:
Nicholas Tinsley
2024-05-21 17:10:12 -04:00
committed by Cody Henthorne
parent 8a7c2c1e20
commit bc5cb454bf
5 changed files with 3 additions and 23 deletions

View File

@@ -8,7 +8,6 @@ import org.thoughtcrime.securesms.blurhash.BlurHash
import org.thoughtcrime.securesms.database.AttachmentTable.TransformProperties
import org.thoughtcrime.securesms.mms.PartAuthority
import org.thoughtcrime.securesms.stickers.StickerLocator
import org.thoughtcrime.securesms.util.FeatureFlags
import org.thoughtcrime.securesms.util.ParcelUtil
class DatabaseAttachment : Attachment {
@@ -143,7 +142,7 @@ class DatabaseAttachment : Attachment {
}
override val uri: Uri?
get() = if (hasData || FeatureFlags.instantVideoPlayback() && getIncrementalDigest() != null) {
get() = if (hasData || getIncrementalDigest() != null) {
PartAuthority.getAttachmentDataUri(attachmentId)
} else {
null

View File

@@ -9,7 +9,6 @@ import org.signal.core.util.requireLong
import org.signal.core.util.requireNonNullString
import org.thoughtcrime.securesms.attachments.DatabaseAttachment
import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.util.FeatureFlags
import org.thoughtcrime.securesms.util.MediaUtil
import org.thoughtcrime.securesms.util.MediaUtil.SlideType
@@ -153,11 +152,7 @@ class MediaTable internal constructor(context: Context?, databaseHelper: SignalD
@JvmOverloads
fun getGalleryMediaForThread(threadId: Long, sorting: Sorting, limit: Int = 0): Cursor {
var query = if (FeatureFlags.instantVideoPlayback()) {
sorting.applyToQuery(applyEqualityOperator(threadId, GALLERY_MEDIA_QUERY_INCLUDING_TEMP_VIDEOS))
} else {
sorting.applyToQuery(applyEqualityOperator(threadId, GALLERY_MEDIA_QUERY))
}
var query = sorting.applyToQuery(applyEqualityOperator(threadId, GALLERY_MEDIA_QUERY_INCLUDING_TEMP_VIDEOS))
val args = arrayOf(threadId.toString() + "")
if (limit > 0) {

View File

@@ -107,7 +107,6 @@ public final class FeatureFlags {
public static final String PROMPT_FOR_NOTIFICATION_LOGS = "android.logs.promptNotifications";
private static final String PROMPT_FOR_NOTIFICATION_CONFIG = "android.logs.promptNotificationsConfig";
public static final String PROMPT_BATTERY_SAVER = "android.promptBatterySaver";
public static final String INSTANT_VIDEO_PLAYBACK = "android.instantVideoPlayback.1";
public static final String CRASH_PROMPT_CONFIG = "android.crashPromptConfig";
private static final String SEPA_DEBIT_DONATIONS = "android.sepa.debit.donations.5";
private static final String IDEAL_DONATIONS = "android.ideal.donations.5";
@@ -192,7 +191,6 @@ public final class FeatureFlags {
PROMPT_FOR_NOTIFICATION_LOGS,
PROMPT_FOR_NOTIFICATION_CONFIG,
PROMPT_BATTERY_SAVER,
INSTANT_VIDEO_PLAYBACK,
CRASH_PROMPT_CONFIG,
SEPA_DEBIT_DONATIONS,
IDEAL_DONATIONS,
@@ -636,14 +634,6 @@ public final class FeatureFlags {
return getLong(MAX_ATTACHMENT_SIZE_BYTES, ByteUnit.MEGABYTES.toBytes(100));
}
/**
* Allow the video players to read from the temporary download files for attachments.
* @return whether this functionality is enabled.
*/
public static boolean instantVideoPlayback() {
return getBoolean(INSTANT_VIDEO_PLAYBACK, false);
}
public static String promptForDelayedNotificationLogs() {
return getString(PROMPT_FOR_NOTIFICATION_LOGS, "*");
}

View File

@@ -473,9 +473,6 @@ public class MediaUtil {
}
public static boolean isInstantVideoSupported(Slide slide) {
if (!FeatureFlags.instantVideoPlayback()) {
return false;
}
final Attachment attachment = slide.asAttachment();
final boolean isIncremental = attachment.getIncrementalDigest() != null;
final boolean hasIncrementalMacChunkSizeDefined = attachment.incrementalMacChunkSize > 0;

View File

@@ -18,7 +18,6 @@ import org.thoughtcrime.securesms.database.AttachmentTable;
import org.thoughtcrime.securesms.database.SignalDatabase;
import org.thoughtcrime.securesms.mms.PartUriParser;
import org.signal.core.util.Base64;
import org.thoughtcrime.securesms.util.FeatureFlags;
import org.whispersystems.signalservice.api.crypto.AttachmentCipherInputStream;
import java.io.EOFException;
@@ -61,7 +60,7 @@ class PartDataSource implements DataSource {
final String attachmentKey = attachment.remoteKey;
final boolean hasData = attachment.hasData;
if (inProgress && !hasData && hasIncrementalDigest && attachmentKey != null && FeatureFlags.instantVideoPlayback()) {
if (inProgress && !hasData && hasIncrementalDigest && attachmentKey != null) {
final byte[] decode = Base64.decode(attachmentKey);
final File transferFile = attachmentDatabase.getOrCreateTransferFile(attachment.attachmentId);
try {