Skip to content

[38] refactor Outgoing & Incoming flows to represent call-engine state - #67

Merged
kanat merged 2 commits into
mainfrom
task/refactor_incoming_outgoing
Nov 8, 2022
Merged

[38] refactor Outgoing & Incoming flows to represent call-engine state#67
kanat merged 2 commits into
mainfrom
task/refactor_incoming_outgoing

Conversation

@kanat

@kanat kanat commented Nov 7, 2022

Copy link
Copy Markdown
Contributor

Relates to: #38

I've created this PR to avoid a chonker one in the end.
A final merge of 3 screens will be completed in the next PR.

Main changes:

  • Outgoing & Incoming flows refactored to represent the call-engine state
  • Modified CallEngine to handle the following cases:
    • do not drop a meeting if someone leaves it (but regular calls are dropped normally)
    • do not drop a regular call if not all participants reject incoming call
  • Added fallback for latency measures (aligned with iOS)

@kanat
kanat marked this pull request as ready for review November 7, 2022 23:35
@kanat kanat linked an issue Nov 7, 2022 that may be closed by this pull request
videoApp.streamVideo,
StreamRouterImpl(this),
requireNotNull(intent.getSerializableExtra(KEY_CALL_DATA) as? IncomingCallData)
// TODO passing [this] may lead to memory leak, cause VM may live longer than Activity

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on this a bit? Any suggestions on how to avoid it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So IncomingCallViewModel keeps ref to StreamRouterImpl, which keeps ref to IncomingCallActivity, and in case of Activity recreation (like screen rotation etc), IncomingCallViewModel will keep the ref to the dead obj, through StreamRouterImpl , because VM instance will still gonna be the same.

We could resolve this by using ActivityLifecycleCallbacks inside StreamRouterImpl to let it use any running activity

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds good yeah - given that these are built for hte purposes of our apps, maybe it's not as important to expose all of this on the get go

Although, based on what we expose to users (e.g. Outgoing/Incoming screens), it might be good to just ship it too and make it clean!

logger.d { "[createCall] input: $input" }
// this._callState.value = videoClient.getCall(callId) TODO - load details

// TODO CallClient is supposed to live longer than VM

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - maybe we can create the client before the ViewModel and hten pass it in as a parameter

@filbabic filbabic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved and can be merged, just left a few small comments

@kanat
kanat merged commit 4ec3da3 into main Nov 8, 2022
@kanat
kanat deleted the task/refactor_incoming_outgoing branch November 8, 2022 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge Incoming, Outgoing, Call activities into a single one

2 participants