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

Allow processing of last output buffer in MediaCodecTrackRenderer drainOutputBuffer #417

Closed
ptran-gpfw opened this issue Apr 24, 2015 · 4 comments
Labels

Comments

@ptran-gpfw
Copy link

In my own usage of MediaCodec (separate from ExoPlayer) I have observed dequeueOutputBuffer return info on an output buffer that has both a) a valid buffer index and b) a flag bitfield that contains MediaCodec.BUFFER_FLAG_END_OF_STREAM.

In MediaCodecTrackRenderer drainOutputBuffer (line 832), the detection of BUFFER_FLAG_END_OF_STREAM causes the method to return before the call to processOutputBuffer. This prevents processing of the last output buffer.

@ojw28
Copy link
Contributor

ojw28 commented Apr 25, 2015

Hm. Doesn't this depend on how you use BUFFER_FLAG_END_OF_STREAM when queuing input buffers? If you set it on the final real input buffer then I'd expect to see it when dequeuing the final real output buffer. If you set it separately on an input buffer that follows the final real one, then I wouldn't expect that. ExoPlayer does the latter, hence why we don't handle the output buffer on which it is set.

If you have a concrete example (media + device combination) where this happens, then we can/should fix it. I'm not yet convinced there's a problem though ;).

@ptran-gpfw
Copy link
Author

I'll try to repro with exoplayer demo and post an update.

@ojw28 ojw28 added the question label Apr 27, 2015
@ojw28
Copy link
Contributor

ojw28 commented May 1, 2015

Please re-open if you manage to repro this. Thanks!

@ojw28 ojw28 closed this as completed May 1, 2015
@ojw28 ojw28 reopened this Jun 25, 2015
@ojw28 ojw28 added bug and removed question labels Jun 25, 2015
@ojw28
Copy link
Contributor

ojw28 commented Jun 25, 2015

Turns out the standard Google AAC decoder does this, so we end up dropping the last frame of audio. Not particularly important, but we should fix it nevertheless.

ojw28 added a commit that referenced this issue Jun 26, 2015
@ojw28 ojw28 closed this as completed Jun 26, 2015
ojw28 added a commit that referenced this issue Jul 15, 2015
1. Workaround for decoders that fail to handle the END_OF_STREAM flag.
2. Revert processing of final output buffer if it's non-empty. This
   introduced another bug (#596)

Reverts: b88012f
Issue: #417
Issue: #596
@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants