summaryrefslogtreecommitdiff
path: root/libavformat/nutenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-29 03:20:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-29 03:20:04 +0200
commitdf889be0a89a8711640eccbf99b5e807ae588dbe (patch)
treea807f5a5500e1689abda625ac269d68c05b259e0 /libavformat/nutenc.c
parent6b041cb617e5d5e4fc46c8be91c127c6b366bc79 (diff)
nutenc: avoid av_tree_find() operation per syncpoint
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/nutenc.c')
-rw-r--r--libavformat/nutenc.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 33d0194c30..74ba1e8d5a 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -991,7 +991,7 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
if (store_sp &&
(!(nut->flags & NUT_PIPE) || nut->last_syncpoint_pos == INT_MIN)) {
- Syncpoint *sp, dummy = { .pos = INT64_MAX };
+ int64_t sp_pos = INT64_MAX;
ff_nut_reset_ts(nut, *nus->time_base, pkt->dts);
for (i = 0; i < s->nb_streams; i++) {
@@ -1003,19 +1003,15 @@ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
int index = av_index_search_timestamp(st, dts_tb,
AVSEEK_FLAG_BACKWARD);
if (index >= 0)
- dummy.pos = FFMIN(dummy.pos, st->index_entries[index].pos);
+ sp_pos = FFMIN(sp_pos, st->index_entries[index].pos);
}
- if (dummy.pos == INT64_MAX)
- dummy.pos = 0;
- sp = av_tree_find(nut->syncpoints, &dummy, (void *)ff_nut_sp_pos_cmp,
- NULL);
nut->last_syncpoint_pos = avio_tell(bc);
ret = avio_open_dyn_buf(&dyn_bc);
if (ret < 0)
return ret;
put_tt(nut, nus->time_base, dyn_bc, pkt->dts);
- ff_put_v(dyn_bc, sp ? (nut->last_syncpoint_pos - sp->pos) >> 4 : 0);
+ ff_put_v(dyn_bc, sp_pos != INT64_MAX ? (nut->last_syncpoint_pos - sp_pos) >> 4 : 0);
if (nut->flags & NUT_BROADCAST) {
put_tt(nut, nus->time_base, dyn_bc,