[roll] Roll fuchsia [media/sounds] Use discardable VMOs in soundplayer

This CL modifies soundplayer so it uses discardable VMOs for sounds
added with the AddSoundFromFile method. This involves keeping the fd
for the lifetime of the sound and re-reading the file should the
system discard the VMO containing the decoded content from the file.

The Sound type, which represents an added sound, now has LockForRead,
LockForWrite and Unlock methods. In the Sound type itself, these do
nothing. In the new DiscardableSound type, these methods lock and
unlock the VMO containing the decoded content. LockForRead restores
the data in the VMO if any part of the VMO was discarded.

DiscardableVmo owns the fd for the file, which is needed to restore
the VMO contents. It also has SetFormat and SetSize methods, the
latter actually allocating the VMO, if it hasn't been allocated
already. SetFormat and SetSize set those properties the first time
they're called. Subsequently, they just verify that the format and
size haven't changed. This characteristic allows the WAV and
OGG/OPUS demux/decoders to behave consistently regardless of whether
they are reading the file for the first time or restoring.

Most of the new logic is tested by the existing tests. New tests have
been added that use a subclass of DiscardableSound that always
restores on LockForRead. This tests the restore path without needing
to actually discard the VMOs, which can only be done system-wide
currently.

Test: unit tests added

Original-Fixed: fxb/105585

Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/727985
Original-Revision: c8341aaa2cf8322367edf3eb915c9fe14bca7966
GitOrigin-RevId: db2cbada910c7ee1f97b9fde9cf0e3f9b6187ad3
Change-Id: I5d8335c10d8cac1ca11d4e3de2023667406d5dfa
1 file changed
tree: baf8991804dd29fbcc995db95c5d078ede4be8cd
  1. git-hooks/
  2. infra/
  3. third_party/
  4. cts
  5. firmware
  6. flower
  7. jiri.lock
  8. minimal
  9. prebuilts
  10. README.md
  11. stem
  12. test_durations
  13. toolchain
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.