Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandar-apostolov committed Nov 21, 2024
2 parents 6e94784 + 349b2a1 commit 51c2783
Show file tree
Hide file tree
Showing 17 changed files with 308 additions and 443 deletions.
20 changes: 10 additions & 10 deletions benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
import io.getstream.video.android.Configuration
import io.getstream.video.configureFlavors

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
Expand Down Expand Up @@ -62,16 +63,15 @@ android {
}
}

flavorDimensions += "environment"
productFlavors {
create("development") {
dimension = "environment"
proguardFiles("benchmark-rules.pro")
}
create("production") {
dimension = "environment"
proguardFiles("benchmark-rules.pro")
}
// Use the same flavor dimensions as the application to allow generating Baseline Profiles on prod,
// which is more close to what will be shipped to users (no fake data), but has ability to run the
// benchmarks on demo, so we benchmark on stable data.
configureFlavors(this) { flavor ->
buildConfigField(
"String",
"APP_FLAVOR_SUFFIX",
"\"${flavor.applicationIdSuffix ?: ""}\""
)
}

targetProjectPath = ":demo-app"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal class BaselineProfileGenerator {
@Test
fun startup() =
baselineProfileRule.collect(
packageName = packageName,
packageName = PACKAGE_NAME,
stableIterations = 2,
maxIterations = 8,
includeInStartupProfile = true,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiObject2
import androidx.test.uiautomator.Until

/**
* Convenience parameter to use proper package name with regards to build type and build flavor.
*/
val PACKAGE_NAME = buildString {
append("io.getstream.video.android")
append(BuildConfig.APP_FLAVOR_SUFFIX)
}

internal fun UiDevice.waitForObject(selector: BySelector, timeout: Long = 5_000): UiObject2? {
if (wait(Until.hasObject(selector), timeout)) {
return findObject(selector)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import com.android.build.api.dsl.ApplicationExtension
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import io.getstream.video.configureAndroidCompose
import io.getstream.video.configureFlavors
import io.getstream.video.configureKotlinAndroid
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.android.build.api.dsl.ApplicationExtension
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import io.getstream.video.configureFlavors
import io.getstream.video.configureKotlinAndroid
import org.gradle.api.Plugin
import org.gradle.api.Project
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package io.getstream.video

import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.dsl.ApplicationProductFlavor
import com.android.build.api.dsl.CommonExtension
import com.android.build.api.dsl.ProductFlavor

@Suppress("EnumEntryName")
enum class FlavorDimension {
contentType
}

// The content for the app can either come from local static data which is useful for demo
// purposes, or from a production backend server which supplies up-to-date, real content.
// These two product flavors reflect this behaviour.
@Suppress("EnumEntryName")
enum class VideoDemoFlavor(val dimension: FlavorDimension, val applicationIdSuffix: String? = null) {
development(FlavorDimension.contentType, applicationIdSuffix = ".dogfooding"),
production(FlavorDimension.contentType)
}

fun configureFlavors(
commonExtension: CommonExtension<*, *, *, *, *, *>,
flavorConfigurationBlock: ProductFlavor.(flavor: VideoDemoFlavor) -> Unit = {}
) {
commonExtension.apply {
flavorDimensions += "environment"
productFlavors {
VideoDemoFlavor.values().forEach {
create(it.name) {
dimension = "environment"
flavorConfigurationBlock(this, it)
if (this@apply is ApplicationExtension && this is ApplicationProductFlavor) {
if (it.applicationIdSuffix != null) {
applicationIdSuffix = it.applicationIdSuffix
}
}
proguardFiles("benchmark-rules.pro")
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package io.getstream.video.android

object Configuration {
const val compileSdk = 34
const val targetSdk = 34
const val compileSdk = 35
const val targetSdk = 35
const val minSdk = 24
const val majorVersion = 1
const val minorVersion = 0
const val patchVersion = 19
const val patchVersion = 20
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
const val versionCode = 42
const val versionCode = 43
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
const val artifactGroup = "io.getstream"
const val streamVideoCallGooglePlayVersion = "1.1.12"
const val streamVideoCallGooglePlayVersion = "1.1.14"
const val streamWebRtcVersionName = "1.2.1"
}
25 changes: 14 additions & 11 deletions demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
import com.android.build.api.variant.BuildConfigField
import com.android.build.api.variant.ResValue
import com.github.triplet.gradle.androidpublisher.ResolutionStrategy
import io.getstream.video.FlavorDimension
import io.getstream.video.VideoDemoFlavor
import io.getstream.video.android.Configuration
import io.getstream.video.configureFlavors
import java.io.FileInputStream
import java.util.*

Expand All @@ -45,6 +48,7 @@ android {
targetSdk = Configuration.targetSdk
versionCode = 1
versionName = Configuration.streamVideoCallGooglePlayVersion
missingDimensionStrategy(FlavorDimension.contentType.name, VideoDemoFlavor.development.name)
vectorDrawables {
useSupportLibrary = true
}
Expand Down Expand Up @@ -83,6 +87,8 @@ android {
}
}

configureFlavors(this)

buildTypes {
getByName("debug") {
versionNameSuffix = "-DEBUG"
Expand All @@ -94,6 +100,7 @@ android {
}
getByName("release") {
isMinifyEnabled = true
baselineProfile.automaticGenerationDuringBuild = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand All @@ -110,17 +117,6 @@ android {
}
}

flavorDimensions += "environment"
productFlavors {
create("development") {
dimension = "environment"
applicationIdSuffix = ".dogfooding"
}
create("production") {
dimension = "environment"
}
}

buildFeatures {
resValues = true
buildConfig = true
Expand All @@ -136,6 +132,13 @@ android {

baselineProfile {
mergeIntoMain = true

// Don't build on every iteration of a full assemble.
// Instead enable generation directly for the release build variant.
automaticGenerationDuringBuild = false

// Make use of Dex Layout Optimizations via Startup Profiles
dexLayoutOptimization = true
}

playConfigs {
Expand Down
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ androidGradlePlugin = "8.4.2"
cameraCamera2 = "1.3.4"
spotless = "6.21.0"
nexusPlugin = "1.3.0"
kotlin = "2.0.20"
ksp = "2.0.20-1.0.25"
kotlinSerialization = "1.7.1"
kotlin = "2.0.21"
ksp = "2.0.21-1.0.26"
kotlinSerialization = "1.7.3"
kotlinSerializationConverter = "1.0.0"
kotlinxCoroutines = "1.9.0"

Expand All @@ -22,14 +22,14 @@ androidxActivity = "1.9.2"
androidxDataStore = "1.1.1"
googleService = "4.4.2"

androidxComposeBom = "2024.09.02"
androidxComposeBom = "2024.11.00"
androidxComposeTracing = "1.0.0-beta01"
androidxHiltNavigation = "1.2.0"
androidxComposeNavigation = "2.8.1"
androidxComposeNavigation = "2.8.4"
composeStableMarker = "1.0.5"

coil = "2.6.0"
landscapist = "2.3.6"
landscapist = "2.4.2"
accompanist = "0.34.0"
telephoto = "0.3.0"
audioswitch = "1.2.0"
Expand Down Expand Up @@ -72,7 +72,7 @@ installReferrer = "2.2"
playAuth = "20.7.0"
playAppUpdate = "2.1.0"

hilt = "2.51.1"
hilt = "2.52"
leakCanary = "2.13"
binaryCompatabilityValidator = "0.16.3"
playPublisher = "3.8.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,6 @@ public final class io/getstream/video/android/core/call/RtcSession {
public final fun setScreenShareTrack ()V
public final fun setSubscriber (Lio/getstream/video/android/core/call/connection/StreamPeerConnection;)V
public final fun setTracks (Ljava/util/Map;)V
public final fun switchSfu (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun updateTrackDimensions (Ljava/lang/String;Lstream/video/sfu/models/TrackType;ZLstream/video/sfu/models/VideoDimension;)V
public static synthetic fun updateTrackDimensions$default (Lio/getstream/video/android/core/call/RtcSession;Ljava/lang/String;Lstream/video/sfu/models/TrackType;ZLstream/video/sfu/models/VideoDimension;ILjava/lang/Object;)V
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.getstream.video.android.core

import app.cash.turbine.test
import app.cash.turbine.testIn
import com.google.common.truth.Truth.assertThat
import io.getstream.log.taggedLogger
Expand All @@ -26,7 +25,6 @@ import org.junit.Ignore
import org.junit.Test
import org.webrtc.PeerConnection
import java.util.UUID
import kotlin.time.Duration.Companion.seconds

/**
* Connection state shows if we've established a connection with the SFU
Expand Down Expand Up @@ -147,44 +145,4 @@ class ReconnectTest : IntegrationTestBase(connectCoordinatorWS = false) {
// await until disconnect a call
assertThat(connectionState.awaitItem()).isEqualTo(RealtimeConnection.Disconnected)
}

/**
* Switching an Sfu should be fast
*/
@Test
@Ignore
fun switchSfuQuickly() = runTest(timeout = 30.seconds) {
val call = client.call("default", UUID.randomUUID().toString())
// join a call
val result = call.join(create = true)
// create a turbine connection state
val connectionState = call.state.connection.testIn(backgroundScope)
// asset that the connection state is connected
val connectionStateItem = connectionState.awaitItem()
assertThat(connectionStateItem).isAnyOf(
RealtimeConnection.Connected,
RealtimeConnection.Joined(result.getOrThrow()),
)
if (connectionStateItem is RealtimeConnection.Joined) {
connectionState.awaitItem()
}

// connect to the new socket
// do an ice restart
call.session?.let {
it.switchSfu(it.sfuUrl, it.sfuToken, it.sfuToken, it.remoteIceServers, {})
}

// assert the publisher is still connected
val publisher = call.session?.publisher?.state
publisher?.test(timeout = 30.seconds) {
val connection = awaitItem()
if (connection == PeerConnection.PeerConnectionState.CONNECTED) {
awaitComplete()
}
}
// leave and clean up a call
call.leave()
call.cleanup()
}
}
Loading

0 comments on commit 51c2783

Please sign in to comment.