Commit 15f974a2 by olly Committed by Oliver Woodman

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
parent 7f7632a3
...@@ -196,8 +196,7 @@ public final class PlayerEmsgHandler implements Handler.Callback { ...@@ -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 { ...@@ -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 { ...@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment