Skip to content
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

Video compression: managing npe and tracking it in MEDIA_VIDEO_CANT_OPTIMIZE event #14114

Merged
merged 2 commits into from
Mar 3, 2021

Conversation

develric
Copy link
Contributor

@develric develric commented Feb 19, 2021

Fixes #13692

This PR introduces the management of NPE when attempting to compress a video file before the upload and align the behavior in this scenario to what we already do with other cases when getting an error during compression operations (that is fallback to uploading the video uncompressed).

An npe event is tracked in the MEDIA_VIDEO_CANT_OPTIMIZE event adding the was_npe_detected=true property.

NOTE: we have an open PR contributed here that actually fixes the original issue but waiting for an eventual follow up this fix seems good enough also given it seems a pretty edge case looking at numbers in sentry with m4m string. Reporting here also this internal reference (p2y3YZ-4nh-p2) where we considered other possible approaches.

To test

Not trivial to replicate since it happens only with specific videos, but you can use the mp4 video linked in p2y3YZ-4nh-p2

  • Check Video Compression and tracks are active in the app settings
  • Place the mp4 video on your device or on google drive
  • In the Media screen, try to upload it from device
  • With the debugger (or filtering logcat with VideoOptimizer >) check you get a npe but it is managed (so no crash) and the video is uploaded uncompressed
  • Check that MEDIA_VIDEO_CANT_OPTIMIZE event is fired and contains was_npe_detected=true
  • Make same check as above in the editor trying to upload the video from device
  • Smoke test that no regression is introduced in other scenarios or with other media(s) file or type

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Feb 19, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Feb 19, 2021

You can test the changes on this Pull Request by downloading the APK here.

@develric develric modified the milestones: 16.8, 16.9 Feb 22, 2021
Copy link
Member

@renanferrari renanferrari left a comment

Choose a reason for hiding this comment

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

Hey @develric 👋

First of all, thanks for the changes! Code is looking good and I can confirm the expected behavior is happening: the NPE occurs but it is now correctly caught and the MEDIA_VIDEO_CANT_OPTIMIZE event is being fired with the correct parameter.

LGTM :shipit:

@renanferrari renanferrari merged commit 707a286 into develop Mar 3, 2021
@renanferrari renanferrari deleted the fix/skip-video-compression-on-error branch March 3, 2021 15:18
@Geoffrey1014
Copy link

Fixes #13692

This PR introduces the management of NPE when attempting to compress a video file before the upload and align the behavior in this scenario to what we already do with other cases when getting an error during compression operations (that is fallback to uploading the video uncompressed).

An npe event is tracked in the MEDIA_VIDEO_CANT_OPTIMIZE event adding the was_npe_detected=true property.

NOTE: we have an open PR contributed here that actually fixes the original issue but waiting for an eventual follow up this fix seems good enough also given it seems a pretty edge case looking at numbers in sentry with m4m string. Reporting here also this internal reference (p2y3YZ-4nh-p2) where we considered other possible approaches.

To test

Not trivial to replicate since it happens only with specific videos, but you can use the mp4 video linked in p2y3YZ-4nh-p2

  • Check Video Compression and tracks are active in the app settings
  • Place the mp4 video on your device or on google drive
  • In the Media screen, try to upload it from device
  • With the debugger (or filtering logcat with VideoOptimizer >) check you get a npe but it is managed (so no crash) and the video is uploaded uncompressed
  • Check that MEDIA_VIDEO_CANT_OPTIMIZE event is fired and contains was_npe_detected=true
  • Make same check as above in the editor trying to upload the video from device
  • Smoke test that no regression is introduced in other scenarios or with other media(s) file or type

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

hello, what do you mean of "the mp4 video linked in p2y3YZ-4nh-p2". can want to get the video to reproduce the bug.
thanks a lot

@develric
Copy link
Contributor Author

develric commented Jun 9, 2021

Hey @Geoffrey1014 👋 , thanks for your interest with this 🙇 !

what do you mean of "the mp4 video linked in p2y3YZ-4nh-p2". can want to get the video to reproduce the bug.
thanks a lot

the p2y3YZ-4nh-p2 is an internal reference; the issue is pretty rare and we could not reproduce it if not with few specific videos; those videos were kindly shared with us by users reporting the issue and they are private and belonging to them, so we cannot provide. Hope you can understand and this clarifies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash Happening on mp4 video upload from Google Drive
4 participants