-
Notifications
You must be signed in to change notification settings - Fork 6k
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
File allocating tons of memory #3670
Comments
The problem is that your m4a file contains a video and an audio track and both are very poorly interleaved. Actually, the video track contains one frame only to display the artwork of the audio file. Because the player needs to present video and audio synchronously, it needs to load the file up to the point where it has encountered all the audio and video data needed to play to a certain timestamp. There are multiple possible solutions:
|
Marking as a bug because ExoPlayer shouldn't just crash but rather detect the problem and handle it gracefully. |
Thanks. So when I never use video I can always safely call setRendererDisabled for the video track? My use case is the linked audiobook player above so it's really all kind of files I don't control. |
So i disabled the video track: private fun disableVideoTracks(player : ExoPlayer, trackSelector : DefaultTrackSelector) {
for (i in 0 until player.rendererCount) {
val isVideo = player.getRendererType(i) == C.TRACK_TYPE_VIDEO
trackSelector.setRendererDisabled(i, isVideo)
}
} Should this be done only once when creating the player? The other think I tried was like suggested and leave out the buildVideoRenderers, but that did not have an effect either: val factory = object : DefaultRenderersFactory(context) {
override fun buildVideoRenderers(
context: Context?,
drmSessionManager: DrmSessionManager<FrameworkMediaCrypto>?,
allowedVideoJoiningTimeMs: Long,
eventHandler: Handler?,
eventListener: VideoRendererEventListener?,
extensionRendererMode: Int,
out: ArrayList<Renderer>?
) {
}
}
player = ExoPlayerFactory.newSimpleInstance(factory, DefaultTrackSelector()) |
Indeed. Seems like we ignore the selected/enabled tracks when checking whether we are ready to play. |
FYI: We are working on a proper fix to allow playback of your file and other files with similar problems. In the meantime, if this problem is blocking your work and you really would like to have a workaround, you could replace the method
|
When determining the next sample to load, the Mp4Extractor now takes into account how far one stream is reading ahead of the others. If one stream is reading ahead more than a threshold (default: 10 seconds), the extractor continues reading the other stream even though it needs to reload the source at a new position. GitHub:#3481 GitHub:#3214 GitHub:#3670 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=182504396
Any news on this? Still present in 2.7.2. |
Unfortunately not. We pushed a fix for the general problem of badly aligned streams. However, your problem is special because it has this strange one-sample video stream with a sample time of zero. This problem is not really high-priority as it is somewhat unusual. Have you tried the workaround I posted above which at least lets you disable the video stream to play the files? |
If I understand correctly that would mean I had to pull the whole library in? Also I have extensions building /https://github.com/PaulWoitaschek/ExoPlayer-Extensions) for an open source project so I rather wait. |
You could also fork just |
I'm getting more and more bug reports with files like this. Could this be pushed in priority? |
Maybe we should put a workaround in where we just drop video tracks that consist of a single sample, where that sample is also the last sample in the stream. @tonihei - WDYT? |
@PaulWoitaschek Have you tried the workaround I proposed above? That is, fork @ojw28 I'd rather implement the proposed solution [internal ref: b/71624068] if we have the time instead of putting a workaround in code which just works for this one case. |
Agreed the proposed solution is what we should aim for long term, but we haven't found time to do that in the past 8 months. So the question is whether we can do something reasonable in a couple of hours to mitigate the issue until we get round to it. |
I received a mail where you asked me to send you the file again.
Did you receive the link I sent you? |
…ion. The buffered position is currently based on the mimimum queued timestamp of all AV tracks. If the tracks have unequal lengths, one track continues loading without bounds as the "buffered position" will always stay at the shorter track's duration. This change adds an optional buffer flag to mark the last sample of the stream. This is set in the Mp4Extractor only so far. ExtractorMediaSource uses this flag to ignore AV streams in the buffered duration calculation if they already finished loading. Issue:#3670 PiperOrigin-RevId: 229359899
…ion. The buffered position is currently based on the mimimum queued timestamp of all AV tracks. If the tracks have unequal lengths, one track continues loading without bounds as the "buffered position" will always stay at the shorter track's duration. This change adds an optional buffer flag to mark the last sample of the stream. This is set in the Mp4Extractor only so far. ExtractorMediaSource uses this flag to ignore AV streams in the buffered duration calculation if they already finished loading. Issue:#3670 PiperOrigin-RevId: 229359899
Closing as fixed. |
Thanks a lot! |
I have a m4a audio file that when trying to play it just allocates tons of memory in constantly triggers the garbage collection and finally lets the device crash.
I reproduced this on a Nexus 5x with Android 8.1 and ExoPlayer 2.6.0 and 2.6.1
Audio file incoming via mail. Please let me know when I can take down the file.
The text was updated successfully, but these errors were encountered: