Clear the vector which holds all tracks when the
GenericSource is reset to prevent any stale access
Author: Umesh Pandey <umeshp@codeaurora.org>
Bug: 70919418
Test: TBD
Change-Id: If7042b3344ce36ba56e38df1a43bc2bb287cc40c
nuplayer's updateMetrics() referenced an unprotected shared stats buffer.
It's a small buffer, so we now make a copy during updateMetrics()
[at a point where we are mutexed] instead of putting a mutex on the
underlying frequently used construct.
Ensure that nuplayer2 has the same protections.
Bug: 123256408
Test: race condition
Check if MediaAnalyticsItem class is valid before
calling any of its functions.
Author: Paras Nagda <pnagda@codeaurora.org>
Bug: 70919418
Test: TBD
Change-Id: I2d5704063b9479301f03d6f57ce74108873ef4cc
IMPORTANT NOTE:
CL depends on another CL in frameworks/base
https://partner-android-review.googlesource.com/c/platform/frameworks/base/+/1206275
AudioProductStrategies offers the possibility to dynamically
translate attributes to stream types (and vice versa) within
audio policy engine.
Legacy engine has hard coded rules to maintain the translation
service.
This patch removes the hardcoded translation within the helper
and replaces them by AudioProductStrategy APIs.
Test: AudioPolicyTests: AudioProductStrategiesAllStreamsTest
It loops on all stream types supported by strategy and ensures
device selection matches. Hard coded stuff would prevent right device
selection.
Test: CTS: AudioTrackTest AudioRecordTest
Test: audio smoke test on sailfish, walleye blueline
Change-Id: I76589df5555136ed49dbacc7aac9b0b5e828bef2
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
there is a clamping value in getDurationUsIfPlayedAtSampleRate function
numFrames parameter is uint32_t type. when return value, cast uint32_t to int32_t.
that make clamp value of numFrames
Signed-off-by : Hyoungjun Byun <hyoungjun.byun@lge.com>
Change-Id: Ib97d89b33a8e5b6bea3d499e4b44d1056d7fae66
When the system partition is a later version than vendor,
new MediaDrm APIs will not have HAL implementations. In
this case throw java.lang.UnsupportedOperationException.
bug:110701831
bug:123375769
test: cts media test cases, gts media tests
Change-Id: Ib631bf4d4d245d857e61bd3fe0e5808e430a034d
Check if variables used in AudioOutput::open()
are 0 before using them as a divisor.
Bug: 123375287
Change-Id: I1c65a80a12eda84d11e7526fe0c730cb10565c36
CRs-Fixed: 2286455
(cherry picked from commit 9e67171a2f4e2b7dc38017789700f629a3885734)
Currently, there is a lot of logspam in nudriver. Reduce the spam.
Test: flash the device and let it idle. Open 'adb logcat'. Observe.
Before the change: logspam @ about 10 messages / second
After the change: no logspam
Bug: 65494379
Change-Id: Ie952fdcab61aa89bb72d9c6dc63487643febd974
Move DataSourceBase and MediaSource to libstagefright, and
MediaBuffer, MediaBufferGroup and MetaData to libstagefright_foundation.
Test: build
Change-Id: I4f0ae01d40a32f4b773a2f74d5f2ae136e375322
initFromDataSource and onPrepareAsync are called with mLock acquired.
When initFromDataSource returns with error, notifyPreparedAndCleanup
will be called and it requires mLock acquired.
Test: cts
Bug: 122564587
Change-Id: I430dbc5f1f30c06223ea22438282bd388174f7df
When audio reaches EOS and MediaClock has not started, use video
timestamp to start MediaClock.
Test: MediaPlayer sends MEDIA_PLAYBACK_COMPLETE
Bug: 122052445
Change-Id: Ia37643b8d5260cda0e7cde22dea883804511cff6
(cherry picked from commit 1225b93293)
When audio reaches EOS and MediaClock has not started, use video
timestamp to start MediaClock.
Test: MediaPlayer sends MEDIA_PLAYBACK_COMPLETE
Bug: 122052445
Change-Id: Ia37643b8d5260cda0e7cde22dea883804511cff6
Add method to retrieve unique port ID for the AudioRecord instance
associated with a MediaRecorder.
Bug: 111438757
Test: CTS tests for MediaRecorder
Change-Id: I77295ccd163bfa2319a492ed64186a28b691ac38
Webm, OGG container extensions to hold opus.
hooks so we can say that we're recording in opus format.
OMX-specific changes are omitted since our target is Codec2
Bug: 111850384
Test: with separate omx routines
Change-Id: Iecb8b53df3fbd8506d2e6f007602284eb2d0decc
Remove diagnostics mode from CFI across the board. This should reduce
performance overhead and also allows the minimal runtime to work when
other ubsan sanitizers are enabled. CFI stack dumps should include a
cfi related function, so it should be apparent when a crash is CFI-related.
Bug: 117417735
Test: make -j
Change-Id: Id2cb6cb64425c4c89c031d93156fb1a20be5fa7b
Previously all WAV/FLAC files were extracted as 16 bit data.
Changes this so that 24/32 bit are extracted as float data
to maintain the higher quality.
Note: Update for master branch supersedes iot branches.
Bug: 63770882
Bug: 110480091
Test: Used media player to play 24 bit, 32 bit, and float wav files, plus 16 bit and 24 bit FLAC files,
ensured data went through successfully without loss of quality
Change-Id: Ic09bd2fe994bbf3ed8441549904712c534030c96
For cases when StagefrightRecorder is used for recording
videos with a different capture and frame ratio (time lapse
or slow motion) with a surface source, recorded video
is incorrectly updated by a capture/recorded fps ratio.
To fix this, such factor will be used only with camera source.
Bug: 119070689
Test: timelapse/slowmotion and pause/resume with surface input
Change-Id: Id9df526324f3ead8117eb4571f9459beceea9fff
In MediaPlayer2, we don't need to call setNetworkForUser
since the framework already handles data usage billing
for application processes.
Test: build
Bug: 112767419
Change-Id: I0d4464f7ac024e0a0cf41e1d5cc97372c3e37017
Add FALLTHROUGH_INTENDED for clang compiler.
Bug: 112564944
Test: build with global -Wimplicit-fallthrough.
Change-Id: I5b7ab7abb46884b363e13284382eddf7a256a3e2
It is no longer needed in libmediaextractor, and moving it back
to libstagefright will avoid a circular dependency later.
Bug: 111407253
Test: build, boot, play some files
Change-Id: I1373a9eedee27998e7733ea23ae1a375e45cc9c3
undo earlier change moving this to the handler thread, instead using
a mutex to protect the contended resources: mAudioDecoder and
mVideoDecoder.
Bug: 110855771
Bug: 78365291
Bug: 111910846
Test: playback with persist.debug.sfstats=={0,1}
Change-Id: If8822dba9dae6ac0698b142166604371cd6742b2
This will ensure the index of tracks when writing to parcel.
Test: media post submit tests passed
Bug: 78175875
Change-Id: Id7c26e7fa9865d89d08a344d3751090203c24055
eos-only frames at the end are not rendered. However, these must
not be counted as dropped since they are empty eos outputs
Bug: 79493409
Change-Id: Idabaf5cbaaa990860a148bbc6ecafc85f053d5ef
move NuPlayer::getStats() functionality to handler thread so that to avoid race condition
with other mVideoDecoder references.
Bug: 78365291
Test: cts-tradefed run cts -m CtsMediaTestCases -t android.media.cts.MediaPlayerTest
Change-Id: Ib62a640a77c90cf3f849aa1da960169496a460e6
The tags property is (and has always been) unused by Soong. The property has
been defined as a list of strings, and the `androidmk` converted any
LOCAL_MODULE_TAGS entries over to it, but we've never done anything with it.
In preparation for removing the definition from Soong, I'm removing it from all
Android.bp files in the tree.
Since this has never done anything, this is a no-op, but if you really did want
the Android.mk behavior, the proper way to define a module to be installed in
userdebug / eng builds is to use PRODUCT_PACKAGES_DEBUG or PRODUCT_PACKAGES_ENG
in the appropriate product makefile.
Change-Id: I4a6a26cd7e139c19f63e02d6e1e7a2617c55b72d
Exempt-From-Owner-Approval: global no-op build change
Test: remove `tags` from Soong, see errors go away.
Add an api to IMediaMetadataRetriever to decode image rect.
It will reuse the same full frame IMemory, and decode only
the requested rect. For now, StagefrightMetadataRetriever
will only allow decoding of rect that's a full row of tiles,
and the requested must be issued sequentially (i.e. no
arbitrary rects). When the extract side is fixed to allow
seeking by tiles, it can be extended to allow arbitrary
rects.
This allows HeifDecoderImpl (on client side) to start
processing the getScanlines in parallel with the decoding.
Test: CTS MediaMetadataRetrieverTest;
Manual testing of HEIF decoding of files with or without tiles;
Manual testing of HEIF thumbnails generation in Downloads app.
bug: 78475896
Change-Id: I820b21cdf33f80593ee6092d8e1ba68b3beb65dd
This change refactors ImageDecoder to prepare it for reuse
for multi-slice decoding. There is no functional change.
bug: 78475896
Test: CTS MediaMetadataRetrieverTest;
Manual test of HEIF image decoding and thumbnail extraction.
Change-Id: I8c16042020c7db3d3714d22322e6304ea4192e33
When extracting bitmaps, MediaMetadataRetriever does a copy from
StagefrightMetadataRetriever's VideoFrame to IMemory. We could
just allocate IMemory directly and return that to the client.
bug: 78475896
Change-Id: Ibe07e7d2c68f031261470308476089c2fa9298ea
This fix is for an offload track if paused and invalidated.
when an offload track is paused, it would startAudioOffloadPauseTimeout().
But if the offload track is invalidated and fall back to non offload mode,
the timeout would not stop, and will tear down the track after timeout.
Test: self-tested more then 50 times when fall back to non offload happens.
Bug: 77182500
Test: bug is fixed.
Change-Id: I424fc96e6a5811afacd362409b472c2493c4bb71
Signed-off-by: andysu <andysu@android.com>
When audio played with MediaPlayer without offloaded, if we pause the player,
then call start. It may be occured that the position get from getCurrentPosition
increase first, and then decrease after a while. We found that, when call
getCurrentPosition after start() was called, mAudioSink->getPlayedOutDurationUs
retrun 0, and MediaClock was update with mAudioFirstAnchorTimeMediaUs. In this case,
audiosink has not start to play actually, but the pts will be caculated refered to
mAudioFirstAnchorTimeMediaUs. After audiosink start successfully, onNewAudioMediaTime
will be called, which will call updateAnchor to set pts. As a result, the position get
by calling getCurrentPosition get descreased, which will be observed from our UI.
Return mAudioFirstAnchorTimeMediaUs without updateAnchor before valid value obtain from
getPlayedOutDurationUs will fix this issue.
Test: NA
Change-Id: I94b644e5f31c66e1b720c7f60ed8d656842f6285
Signed-off-by: zengjing <zengjing@xiaomi.com>
Add plumbing to retieve the embedded thumbnail from
MPEG4Extractor/ItemTable.
bug: 74395267
Test: CTS MediaMetadataRetriever test; manual test of thumbnail
extraction by browsing new folders containing heif files in
Downloads app.
Change-Id: Ic49f6dfa47eddc229b9f4b0e1835d58df1dce9f8
Currently, stats are printed only when clip reaches EOS. If
The app stops by calling reset(), stats are not printed. To
get the stats in such scenarios, we need to dump the stats in
the reset() method.
Bug: 64121714
Change-Id: If064b8391ed01a6605791625ddead4fdef50aa1d
Prior to this CL, if an AudioTrack client wrote audio data after
AudioTrack stop(), but before the track was drained by the server,
the newly written client data would be consumed in the drain.
We now limit the server read to the client write position on stop.
This interlocking is essential for rapid asynchronous AudioTrack
command processing.
Test: AudioTrack CTS, SoundPool looping, bug test case
Bug: 75788313
Change-Id: Ib70e3dc46afe047a8c6cf1fb906a618b3c66cc7f
capture the output mime times (audio + video)
capture duration recorded
capture info about how the 'pause' capability is used [duration + count]
Bug: 73774549
Test: manual recordings w&w/o pauses
Change-Id: Iae3d95984a97babb52afdbbb09872e44dd869573
(cherry picked from commit 6145803cf8)
audio.h used to have *_CNT and *_MAX values in its enum
mostly for enum iteration.
This was not compatible with Treble as it denied any enum
inheritance.
*_CNT and *_MAX are now implemented with macro that can
be updated and are not part of the API.
Bug: 38184704
Test: Compile
Change-Id: I3921fdf3435ba114ca77a4595ba8fc97a5e0438d
Merged-In: I3921fdf3435ba114ca77a4595ba8fc97a5e0438d
Cherry-picked from master
Signed-off-by: Kevin Rocard <krocard@google.com>
Fixes problem where playback time was being cleared as part of
a reset before media.metrics stats were logged.
Added code so that getMetrics() calls will return proper in-progress
playback time (previously, playback time was added to the metrics data
only at the end).
Added initialization of timestamp tracking pauses for rebuffering.
Bug: 74008613
Test: dumpsys media.metrics observation
- Add MetaDataBase base class that MetaData derives from, but which
does not derive from RefBase.
- MediaBuffer::meta_data() now returns a MetaDataBase& rather than an
sp<MetaData>
- Rename MediaSourceBase to MediaTrack.
- MediaSource no longer derives from MediaSourceBase (or MediaTrack)
- MediaTrack::getFormat(), MediaExtractor::getTrackMetaData() and
MediaExtractor::getMetaData() all take a MetaDataBase& parameter that
they fill out, rather than returning a MetaData directly (the
corresponding methods on MediaSource and RemoteMediaExtractor continue
to return MetaData)
Bug: 67908544
Test: CTS MediaPlayerTest, DecoderTest, EncodeDecodeTest, manually record video
Change-Id: Ib531ab309061290be33d40d6100c9a8127e22083
Relocate drm and crypto headers from media
to mediadrm to have finer grained ownership
bug:73556221
Change-Id: I7d1b5944f261f9b1fdeed7605e4c0b4b4ca43e1a
MediaBuffer class exposes internal classes, ABuffer and IMemory, which
we don't want to expose to plugins. This change introduces
MediaBufferBase which does not expose any classes from system library.
Test: build and post-submit media cts tests
Bug: 67908556
Change-Id: Ic9ee239caf9b84b2b3740e2d533257afa25c8784
This reverts commit 514674257e.
The original change Iaba6d9be is no longer needed since we
separated out DataSourceBase from DataSource. Now, DataSource
may have a method relying on a class from libmedia, IDataSource.
Test: checked the correct wrapping path with 'dumpsys media.extractor'
Bug: 72869975
Change-Id: Ib0d5ca863fa70a4a96f97b3377c209e1f288f443
add comments to native media.metrics code pointing to how they
are (and aren't) to be kept in synch with their java counterparts
that are part of the public API (and therefore pretty much fixed).
Bug: 72492234
Test: compilation
Change-Id: Ic096545a5cdfb2160c6b66438d345d8e625384b9
the 'finalized' concept didn't pan out -- remove references to it.
Simplifies the code flow.
Also purged some uses of generateSessionID().
Bug: 71874686
Test: logcat/dumpsys
Change-Id: I39e48526a5696158d8195f47154881ca6ecda266
This is part of device enumeration. With the new add API, developer
could get the active microphones information for each channel.
Bug: 64038649
Test: Run cts and check the print log.
Change-Id: I01941d8d1ca0f49d0af48210ef8b1149de31676a
This reverts commit 95a8bfab98a73a75eb60ecf2cc8683f4a1f04b35.
Plus, keeps 'virtual' keyword for ~MediaBuffer which has a child class.
Test: cts-tradefed run cts-dev --module CtsMediaTestCases --compatibility:module-arg
CtsMediaTestCases:include-annotation:android.platform.test.annotations.RequiresDevice
Bug: 67908542
Change-Id: Ib94d574d6bbd6245c174dd1c9bcca379015724cc
Removed MediaBufferBase in favor of MediaBufferHolder
which contains a MediaBuffer inside. Instead of set/getMediaBufferBase,
now it set/finds MediaBufferHolder in ABuffer->meta().
Test: build. pass MediaPlayerDrmTest and EncodeDecodeTest.
Bug: 67908542
Change-Id: Icb4f7ac350a7876f5e4596bae8be2a9e95956c2f
Originally added with Ie03b285265099db, but the use case was gone with
OMXCodec.
Test: make checkbuild
Bug: 67908542
Change-Id: I6c4953126ab80f876a6dca258e112bb2eaee440d
Currently, constants in IStreamSource are being used in ATSParser while
they are separate entities. This defines those constants in MediaKeys.h
so that ATSParser can be used without depending on IStreamSource.
This removes libmedia dependency from libmpeg2extractor.
Test: build.
Bug: 67908537
Change-Id: I503a4cdb530825b1932463efae999d120b839e56
augment both nuplayer and nuplayer2 so that the state information
they emit to media metrics for error exits is symbolic, not numeric.
Bug: 70525617
Test: manual
Change-Id: Ie43266cd75810ff4ea6e00f32a1666dc9a5a37dc
The logic for requesting file data source to media extractor service
moved to MediaExtractorFactory from GenericSource.
Bug: 65851881, Bug: 63934228
Test: MediaCts post commit tests
Change-Id: Iaba6d9bec560f0cd8a826f47d74bf491a34c83e9
nuplayer counts frames: both total and dropped. One path during
intentional skipping counted those frames as dropped, but not as
part of the total. This moves the accumulation of total frames up
to a point where it will also include these intentionally
skipped/dropped frames.
Bug: 70297008
Test: manual
track the time the player spends rebuffering content so that it
can be logged through media.metrics for later analysis. records
time rebuffering, number of rebuffering events, and whether player
was rebuffering at exit time (e.g. did user get impatient and quit)
Bug: 69616719
Test: playback on deliberately lossy network
This essentially reverts commit ba40190c5e,
which was made originally for b/69110957.
The change in addition to reverting is the reordering of calls in
main_codecservice.cpp. This CL makes the call to SetUpMinijail() come
before the call to ProcessState::self()->startThreadPool().
Test: make cts -j123 && cts-tradefed run cts-dev -m \
CtsMediaTestCases --compatibility:module-arg \
CtsMediaTestCases:include-annotation:\
android.platform.test.annotations.RequiresDevice
Test: make vts -j123 && vts-tradefed run commandAndExit vts \
--skip-all-system-status-check \
--skip-preconditions -m VtsHalMediaOmxV1_0Host \
-l INFO
Bug: 67990472
Change-Id: Ic62acf3ae1aa3f9249e5c3ce542fb4f95689704e
This allows disconnect() to be done quickly in order to not block
reset() in mediaplayer.
Test: pass android.media.cts.MediaPlayerFlakyNetworkTest
Bug: 68954085
Change-Id: I3ebfef66098066f2169d9946c417fe530cc1fa1b
Some field records sometimes showed non-zero frames played, but zero
playback time; a combination that should not be possible. Tracked to
alternate exit conditions that didn't go through the existing 'update
the stat here'. Now managing time at some other identified possible
paths for playback exit.
Bug: 68273679
Test: manual video playback
Change-Id: I196120c49ec92d2e30d53a6e9eed9c60f1b8f2a7
libmedia_omx_defaults includes source files and this default was
used in both libmedia.so and libmedia_omx.so. This is an issue because
libmedia_omx and libmedia are both loaded in the framework process
through dependency chains such as libstagefright ->
libstagefright_omx_utils -> libmedia_omx.
To fix the issue, libmedia_omx_defaults is removed from libmedia and
libmedia now depends on libmedia_omx. Other modules/libs that originally
depended on libmedia and need access to libmedia_omx_defaults' source
files, now depend on libmedia_omx as well.
Bug: 67871061
Test: mma -j and boot test
Change-Id: I93a10df1fed3c7cea93b580d00f33ba749d80e95
Bug: 64038649
Test: Run cts in RoutingTest
Switch output device when playing music/video with MediaPlayer
Change-Id: I5b5c288e6557199b0a6986785f9335a18a80ab89
This reverts commit 85e88d9b45.
Also, this fixes the crash that would happen on devices that do not have
full Treble enabled.
Test: make cts -j123 && cts-tradefed run cts-dev -m \
CtsMediaTestCases --compatibility:module-arg \
CtsMediaTestCases:include-annotation:\
android.platform.test.annotations.RequiresDevice
Test: make vts -j123 && vts-tradefed run commandAndExit vts \
--skip-all-system-status-check \
--skip-preconditions -m VtsHalMediaOmxV1_0Host \
-l INFO
Bug: 68340092
Bug: 67990472
Change-Id: I6d96cecb8eaa8691c4c0f15fe0c8e60d0c74b440
Adding support for two new sets of APIs on MediaMetadataRetriever:
- getImageAtIndex() and getPrimaryImage()
- getFrameAtIndex() and getFramesAtIndex()
Outline of changes:
- Proper indexing of all displayable still images, so that they
can be retrieved by getImageAtIndex()
- Exposing still images as "image/x.android.heic" tracks in
MediaExtractor with necessary descriptive keys (such as "grid-*")
- Support to retrieve video frames by absolute index instead
of timestamps, as image use cases mostly are interested in
getting the images and care less about timing.
- Support to retrieve video frames in batches because retrieving
one frame at a time is inefficient.
- Refactor image / frame decoding code into FrameDecoder, and split
still image decoding and video sequence decoding into to sub
classes to facilite future development.
bug: 63633199
test:
cts-tradefed run cts-dev --module CtsMediaTestCases --compatibility:module-arg CtsMediaTestCases:include-annotation:android.platform.test.annotations.RequiresDevice
Change-Id: I2fe8519fb6907f315a8b513921fc1cc7f436e28d
All devices should use Treble with OMX hals now.
This CL removes
1. Non-Treble implementations of OMX and OMXStore
2. MediaCodecService
3. All dependencies on sysprop system.persist.treble_omx
Test: make cts -j123 && cts-tradefed run cts-dev -m \
CtsMediaTestCases --compatibility:module-arg \
CtsMediaTestCases:include-annotation:\
android.platform.test.annotations.RequiresDevice
Test: make vts -j123 && vts-tradefed run commandAndExit vts \
--skip-all-system-status-check \
--skip-preconditions -m VtsHalMediaOmxV1_0Host \
-l INFO
Bug: 67990472
Change-Id: I245ecf89d30d532f232e05e362e1cea76f5c37de
Also fix possible racing conditions. Now buffering control is time based
only.
Test: media post submit tests passed
Bug: 66952371
Change-Id: Ia115787511b2f3e612167a61c8df3a9a2b2d9abf
* changes:
Remove libmedia and libstagefright dependency from extractors
Clean move of files to keep the git history
Sort shared libs in Android.bp for extractors
- MediaSource, DataSource and MediaExtractor are moved to
libmediaextractor so that they can be used by extractor
implementations without depending on libmedia and libstagefright.
- XXXFactory classes has been added in order not to expose CreateXXX
methods in libmediaextractor.
- avc_utils is moved to libstagefright_foundation since most of
extractor implementations are relying on that.
Test: build + post submit media CTS tests
Bug: 65851881
Change-Id: I7d5cf18dd25abc10478ac3f6e7d1828ad023e3fb
This allows the just scheduled video frame to be rendered when its timestamp
is larger than max audio media time.
Test: media post-submit tests passed
Bug: 67854291
Bug: 65204641
Change-Id: Iadee5690b8895b1d9be3fdefcafe3535837d12e8
Test: make cts -j123 && cts-tradefed run cts-dev -m \
CtsMediaTestCases --compatibility:module-arg \
CtsMediaTestCases:include-annotation:\
android.platform.test.annotations.RequiresDevice
Test: Run the poc in b/38234812
Bug: 38234812
Change-Id: I28322e5a812c02c8e449ab8773715f60b9f5d976