PlayerTrackEmsgHandler: Release sample queue in release()

This change makes it clear the SampleQueue doesn't outlive
the wrapping PlayerTrackEmsgHandler, and releases it from
PlayerTrackEmsgHandler.release().

This change is a no-op because calling release() is the
same as reset() in this case (the behavior only differs if
a non-dummy DrmSessionManager is being used).

PiperOrigin-RevId: 289416622
This commit is contained in:
olly 2020-01-13 12:29:10 +00:00 committed by Oliver Woodman
parent 7f7632a38f
commit 15f974a277

View file

@ -196,8 +196,7 @@ public final class PlayerEmsgHandler implements Handler.Callback {
/** Returns a {@link TrackOutput} that emsg messages could be written to. */ /** Returns a {@link TrackOutput} that emsg messages could be written to. */
public PlayerTrackEmsgHandler newPlayerTrackEmsgHandler() { public PlayerTrackEmsgHandler newPlayerTrackEmsgHandler() {
return new PlayerTrackEmsgHandler( return new PlayerTrackEmsgHandler(allocator);
new SampleQueue(allocator, DrmSessionManager.getDummyDrmSessionManager()));
} }
/** Release this emsg handler. It should not be reused after this call. */ /** Release this emsg handler. It should not be reused after this call. */
@ -284,9 +283,8 @@ public final class PlayerEmsgHandler implements Handler.Callback {
private final FormatHolder formatHolder; private final FormatHolder formatHolder;
private final MetadataInputBuffer buffer; private final MetadataInputBuffer buffer;
/* package */ PlayerTrackEmsgHandler(SampleQueue sampleQueue) { /* package */ PlayerTrackEmsgHandler(Allocator allocator) {
this.sampleQueue = sampleQueue; this.sampleQueue = new SampleQueue(allocator, DrmSessionManager.getDummyDrmSessionManager());
formatHolder = new FormatHolder(); formatHolder = new FormatHolder();
buffer = new MetadataInputBuffer(); buffer = new MetadataInputBuffer();
} }
@ -349,7 +347,7 @@ public final class PlayerEmsgHandler implements Handler.Callback {
/** Release this track emsg handler. It should not be reused after this call. */ /** Release this track emsg handler. It should not be reused after this call. */
public void release() { public void release() {
sampleQueue.reset(); sampleQueue.release();
} }
// Internal methods. // Internal methods.