File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
lib/src/main/java/com/otaliastudios/transcoder/internal/data Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -38,9 +38,14 @@ internal class Writer(
38
38
39
39
override fun step (state : State .Ok <WriterData >, fresh : Boolean ): State <Unit > {
40
40
val (buffer, timestamp, flags) = state.value
41
+ // Note: flags does NOT include BUFFER_FLAG_END_OF_STREAM. That's passed via State.Eos.
41
42
val eos = state is State .Eos
42
43
if (eos) {
43
- info.set(0 , 0 , 0 , flags and MediaCodec .BUFFER_FLAG_END_OF_STREAM )
44
+ // Note: it may happen that at this point, buffer has some data. but creating an extra writeTrack() call
45
+ // can cause some crashes that were not properly debugged, probably related to wrong timestamp.
46
+ // I think if we could ensure that timestamp is valid (> previous, > 0) and buffer.hasRemaining(), there should
47
+ // be an extra call here. See #159. Reluctant to do so without a repro test.
48
+ info.set(0 , 0 , 0 , flags or MediaCodec .BUFFER_FLAG_END_OF_STREAM )
44
49
} else {
45
50
info.set(
46
51
buffer.position(),
You can’t perform that action at this time.
0 commit comments