Move doInterleave() call to Mp4Writer

`Mp4Writer` receives all the tracks/samples and then it adds them to
corresponding `Track` object. As the `Track` object is primarily to hold
track specific data and `Mp4Writer` is responsible for interleaving related
logic, the call to `doInterleave` should be with `Mp4Writer`. The `Track`
object should just act like a data holding class.
This will also help in reusing `Track` class for fragmented MP4 implementation.

PiperOrigin-RevId: 590138002
This commit is contained in:
sheenachhabra 2023-12-12 03:28:42 -08:00 committed by Copybara-Service
parent 90a0cbdf3d
commit 0660b55ceb

View File

@ -90,6 +90,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
throws IOException { throws IOException {
checkState(token instanceof Track); checkState(token instanceof Track);
((Track) token).writeSampleData(byteBuf, bufferInfo); ((Track) token).writeSampleData(byteBuf, bufferInfo);
doInterleave();
} }
public void close() throws IOException { public void close() throws IOException {
@ -387,7 +388,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
} }
pendingSamples.addLast(Pair.create(bufferInfo, byteBuffer)); pendingSamples.addLast(Pair.create(bufferInfo, byteBuffer));
doInterleave();
} }
@Override @Override