Skip to content

[fix] steaming fixes #5168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 56 commits into from
Mar 5, 2025
Merged

[fix] steaming fixes #5168

merged 56 commits into from
Mar 5, 2025

Conversation

prateekmedia
Copy link
Member

@prateekmedia prateekmedia commented Feb 25, 2025

Description

  • Update queuing logic
  • Use native_video_player + exoplayer branch to fix artifacts for android
  • Support newer namespace and sdk 35
  • Store failures and don't retry them
  • Modify how sync file data status is happening i.e. don't remote sync everytime we need to update previewIds, instead update it locally
  • Add bandwidth check before queuing
  • Remove rotate metadata parameter

Now the player decision logic is:

  • Android: Native video Player for both Stream and original source
  • iOS: Media Kit for stream and Native Video Player for Original

The UseMediaKitEvent is still there in case of any error or if user long presses on that button (android) for original source.

Tests

@prateekmedia prateekmedia marked this pull request as ready for review February 25, 2025 09:35
Comment on lines 63 to 65
if (!initSuccess) {
_putFilesForPreviewCreation();
}
Copy link
Member

Choose a reason for hiding this comment

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

This will always run on app init as initSuccess will be false?

Copy link
Member Author

Choose a reason for hiding this comment

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

It will basically not trigger again in sync is ran again by any other function. I have updated the logic how it will be set and reset based on the state of the logic.

@@ -118,6 +127,15 @@ class UploadLocksDB {
PRIMARY KEY (${_partsTable.columnObjectKey}, ${_partsTable.columnPartNumber})
)
''',
'''
CREATE TABLE IF NOT EXISTS ${_streamUploadErrorTable.table} (
${_streamUploadErrorTable.columnID} INTEGER PRIMARY KEY,
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason for adding separate id? Why can't we just use uploadedFileID as the primary key?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok It's fine to remove that.

@@ -29,6 +29,12 @@ class FileDataService {
_prefs = prefs;
}

void appendPreview(int id) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you document what this method does and why do we need it? Unable to infer quickly while looking that the code

Copy link
Member Author

Choose a reason for hiding this comment

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

I have documented, let me know if it seems fine?

Copy link
Member

Choose a reason for hiding this comment

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

Understood. Don't we have objectID and size information avoid at this point? If yes, why not just append that?

Copy link
Member Author

@prateekmedia prateekmedia Mar 4, 2025

Choose a reason for hiding this comment

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

Got it, we do have that info as it is just uploaded.

@@ -1,3 +1,4 @@
org.gradle.jvmargs=-Xmx4608m
android.useAndroidX=true
android.enableJetifier=true
android.enableR8.fullMode=false
Copy link
Member

Choose a reason for hiding this comment

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

Let's add an comment here why this is disable, with may be some references for relevant Github Issues. So that in future, if someone revisits this, they will have some context.

class PreviewVideoStore {
final LinkedHashMap<int, PreviewItem> _items = LinkedHashMap();
LinkedHashMap<int, PreviewItem> get previews => _items;
late Set<int> _failureFiles;
Copy link
Member

Choose a reason for hiding this comment

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

It might be better to either define this as emptySet or nullable.
Ideally, late variables should be initialized in the construction phase. Otherwise there's a risk of running into late variable not initialized error

Comment on lines 316 to 324
await db.insert(
_streamUploadErrorTable.table,
{
_streamUploadErrorTable.columnUploadedFileID: uploadedFileID,
_streamUploadErrorTable.columnErrorMessage: errorMessage,
_streamUploadErrorTable.columnLastAttemptedAt:
DateTime.now().millisecondsSinceEpoch,
},
);
Copy link
Member

Choose a reason for hiding this comment

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

Let's specify the conflict resolution here. insertOrReplace?

Copy link
Member Author

Choose a reason for hiding this comment

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

insertOrReplace is not a method.

@ua741 ua741 merged commit 5e4862c into main Mar 5, 2025
3 checks passed
@ua741 ua741 deleted the stream-queue-fix branch March 5, 2025 05:13
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.

2 participants