Do not write invalid packet duration
Configuration packets have no PTS. Do not compute a packet duration from their PTS. Fixes recording to mp4 on device rotation.
This commit is contained in:
parent
af3027a85b
commit
771bd8404d
1 changed files with 6 additions and 2 deletions
|
@ -301,8 +301,12 @@ run_recorder(void *data) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// config packets have no PTS, we must ignore them
|
||||||
|
if (rec->packet.pts != AV_NOPTS_VALUE
|
||||||
|
&& previous->packet.pts != AV_NOPTS_VALUE) {
|
||||||
// we now know the duration of the previous packet
|
// we now know the duration of the previous packet
|
||||||
previous->packet.duration = rec->packet.pts - previous->packet.pts;
|
previous->packet.duration = rec->packet.pts - previous->packet.pts;
|
||||||
|
}
|
||||||
|
|
||||||
bool ok = recorder_write(recorder, &previous->packet);
|
bool ok = recorder_write(recorder, &previous->packet);
|
||||||
record_packet_delete(previous);
|
record_packet_delete(previous);
|
||||||
|
|
Loading…
Reference in a new issue