refactor some mutex for how nuplayer sets up mediametrics data.
expanded locking to eliminate a couple race conditions.
Bug: 151644303
Bug: 151643722
Test: poc attached to bugs
Change-Id: I75f29a6254c5eab5d4f524ee7a7ef59f93a0b405
1) Don't count tracks with no samples as malformed for MediaMuxer, but
keep the old behavior as it is for MediaRecorder.
2) When there are no samples to be written in a track, skip that one, but
compose mpeg4 file with all other tracks in it.
3) Allow notifications in MediaMuxer during stop() process.
Bug: 144108285
Bug: 146423844
Bug: 148754639
Test: 1) Unit tested by adding a video and an audio track, once leaving
audio track with no samples and once leaving video with no
samples. Mpeg4 file with expected track was created both the times
and played well.
2) android.mediav2.cts.MuxerUnitTest$TestApi#testSimpleStartStopMuxer
3) android.media.cts.MediaMuxerTest
4) android.media.cts.MediaRecorderTest
Change-Id: If76a1f3b60d09836d53bce6f6e759e6a751f5538
Merged-In: If76a1f3b60d09836d53bce6f6e759e6a751f5538
(cherry picked from commit afc9f27233fa7dfb8c03e0fc83f612e7a19f27f2)
AudioPlaybackRate is now defined in system/audio.h
as 'struct audio_playback_rate_t' (in global namespace).
Similar for the related enums.
To accommodate the existing code, introduce AudioPlaybackRate
as a typedef in the 'android' namespace.
Update code that was forward declaring AudioPlaybackRate
as it's not a struct anymore.
Bug: 133526565
Test: m
Change-Id: Iba20f1de1e8779cd78ac4573f2082416f2b428e2
PlayerServiceFileSource had the same logic as FileSource that could
cause reading at negative data source offsets, so fix that too.
Test: build
Bug: 141242340
Change-Id: I60226d85ece83339444d9ec1c0a741271e33e127
This reverts commit d4fe6b1339.
Reason for revert:
This CL was meant to pre-init the RenderEngine to save time
on the actual thumbnail extraction. But it is using more
memory after boot.
Since HDR clips are less common at present, we'll delay the
init to first use for now.
bug: b/147047966
test: atest android.media.cts.MediaMetadataRetrieverTest
Change-Id: I5b8799bbe2f4ae496e15b5ba699203223fe3013b
This was causing a null deref in cts/security/gce-all.
Bug: 142652210
Test: Run cts/security/gce-all, observe no more crash.
Change-Id: If2003b650f69e88825219113ce1b7d70edc4731d
Check actual bytes read when feeding the data to TS parser.
Bug: 140177694
Test: poc in bug; StreamingMediaPlayerTest
Merged-In: I4b498fe375af657e17838e5839e6348e1463d559
Change-Id: I4b498fe375af657e17838e5839e6348e1463d559
Use 64bit offset in mpeg4writer. Allows us to compose/mux files more
than 4GB in size. Notify MediaMuxer and MediaRecorder users about any failure during
write() and seek(), with best effort attempt to save moov box.
SDK and NDK MediaMuxer.WriteSampleData() would throw IllegalStateException and return
INVALID_OPERATION as before, but in the very next call to this function after failure.
Earlier, writeSampleData wasn't aware of any write/seek failure.
SDK MediaMuxer.Stop() would throw relevant exception with error message.
NDK stop() would return relevant errors.
fallocate() is used to pre-allocate space for MOOV atom dynamically during
run time. If required space couldn't be allocated, then recording is
stopped and moov atom would be written to the file successfully.
Added logic to stop and release looper.
Bug: 135685864
Bug: 142060459
Bug: 142915394
Bug: 145235586
Test: 1) atest CtsMediaTestCases -- \
--module-arg CtsMediaTestCases:size:small
2) Composed files of size around 32GB using MediaMuxer and it is playing fine on the phone
and linux workstation.
3) Filled up most of the flash memory in phone and tried to compose files using MediaMuxer
and MediaRecorder separately. Writing was stopped when ::write failed due to out of space,
and all threads exited gracefully in both cases. Expected errors were reported in Java layer.
(pre-allocation was disabled in this step).
4) The same experiment as in step 3 with pre-allocation enabled, recording was stopped
when there was not enough space and moov atom was written to the output file. File played
well on phone and linux workstation.
5) atest android.media.cts.MediaMuxerTest
Change-Id: I33de67d9dce3550ce3730a99c4aa92bc71c9f7b8
FileDescriptor type in AIDL was translated into const unique_fd& in C++.
Now, it is unique_fd, i.e. passed by value, to make it easier to keep it
beyond the scope of the call.
Bug: 144943748
Test: m
Change-Id: Ic6b1a4cba71c0fedb206b5ca3fb65b9944bbd69f
Add the possibility for apps to indicate that their
capture use case is private and that a privileged Assistant
should not be able to capture concurrently.
This allows to override the default behavior tied to the audio
source (e.g VOICE_COMMUNICATION is private by default but
UNPROCESSED is not).
- Add AAudio API to set and get privacy sensitive mode on input stream
- Add MediaRecorder API to set and get privacy sensitive mode
- Modify AudioSource constructor to accept audio attributes instead of an
audio source to specify the use case.
- Modify audio policy concurrent capture logic to use audio attributes
flag instead of audio source to decide of a capture client has
requested privacy mode or not.
Bug: 137850106
Test: CTS AudioRecordTest and MediaRecorderTest, manual audio smoke tests
Change-Id: I250ea5da4c1da809ceac0da22ae9bee15b937001
These wrappers shouldn't be needed if client and server sides
are using matching interfaces.
bug: 142396029
test: DrmSessionManager_test builds & passes
Change-Id: I07573797af0ed8424e222be7f0119bd3f0ee4aaa
DrmInitialization only needs to be called on PlayerServiceFileSource
and PlayerServiceMediaHTTP, so just have those initialize the forward
lock engine automatically, which removes the need to have this in the
IDataSource interface.
Test: atest cts/tests/tests/drm/src/android/drm/cts/DRMTest.java
Change-Id: I344f46b65b5c473930b16b9b4041e4897384dc18
Merged-In: I344f46b65b5c473930b16b9b4041e4897384dc18
DrmInitialization only needs to be called on PlayerServiceFileSource
and PlayerServiceMediaHTTP, so just have those initialize the forward
lock engine automatically, which removes the need to have this in the
IDataSource interface.
Test: atest cts/tests/tests/drm/src/android/drm/cts/DRMTest.java
Change-Id: I344f46b65b5c473930b16b9b4041e4897384dc18
Instantiate media side renderengine when mediaserver
starts, and prime shader cache for the tone mapper
shaders only.
bug: 140894732
bug: 135717526
test: manually check that shader should be compiled
already when test run for first time
Change-Id: Ib02569bec948838ace0f3162206dbbcadad5b641
Added utilities to:
* Query config for IMediaDrmService usage
* Create remote vs local IDrm/ICrypto object based on aforementioned config
Bug: 134787536
Test: MediaDrmClearkeyTest#testClearKeyPlaybackCenc
Change-Id: I72df528c0bbd8a6dbd3c4962ac91eb89696bcaf7
Capturing from source AUDIO_SOURCE_FM_TUNER is possible only via @SystemApi
on one end and does not capture from an actual on the other end.
Accordingly, do not check android.permission.RECORD_AUDIO anymore but
check privileged permission android.permission.CAPTURE_AUDIO_OUTPUT instead.
Also bypass App Ops OP_RECORD_AUDIO check which is applicable only to capture from
microphones.
Also fix audio recording permission check in MediaRecordClient to use
recordingAllowed() from ServiceUtilities
Bug: 135717621
Test: CTS tests for AudioRecord
Change-Id: Ibb1d72f018d2e3ceee195338f2e262183eee2a23
Convert with minimal change to the interface itself.
Add additional test to cover DrmSessionManager's usage
of possible negative value field (which is signed now).
bug: 142396029
test: ResourceManagerService_test, DrmSessionManager_test,
CTS ResourceManagerServiceTest;
Manually check battery stats reporting.
Change-Id: I5c537a54efc2663281c96ddbdbd4ee56f23c1adf
`readBuffer` might not set `nextSubTimeUs`. It's not clear that
`mMediaClock->addTimer(msg, nextSubTimeUs);` is only called in cases
where `nextSubTimeUs` is set, so initialize it to 0 here.
This is consistent with what's done in `fetchTextData`.
Caught by the static analyzer:
frameworks/av/media/libmediaplayerservice/nuplayer/GenericSource.cpp:799:9:
warning: 2nd function call argument is an uninitialized value
[clang-analyzer-core.CallAndMessage]
Bug: None
Test: TreeHugger
Change-Id: Iae6f9d71757c1bcc6e994a448b6169b4d69c4a38
Name changes:
ClearFileSource -> FileSource
ClearMediaHTTP -> MediaHTTP
FileSource -> PlayerServiceFileSource
MediaHTTP -> PlayerServiceMediaHTTP
PlayerServiceXXX are able to handle OMA(forward-lock) files and now
moved to media/libmediaplayerservice/datasource since they only work
on mediaserver process.
Bug: 142567168
Test: build and DrmTest
Change-Id: I9292dba33d149efe17cf566017dcce1710cc8c88
This is preparation for having a subclass of DataSourceFactory which
is only used in mediaserver process with OMA (forward-lock) use case.
Test: build
Bug: 142567168
Change-Id: I2a1ab3d1ae89f657a84376d9a95d4e814b545b4f