History

avformat: don't unconditionally call ff_read_frame_flush() when trying to seek.

This prevents flushing the packet buffer when the input format does not support seeking.

Justin Ruggles committed 15 years ago

Commit 0041cdb1 parent c6ac30c1 file · +14 −10Browse files

Unified · Split

libavformat/utils.c+14−10
@@ -1749,10 +1749,10 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f · 1748 unmodified lines
17491749 int ret;
17501750 AVStream *st;
17511751
1752− ff_read_frame_flush(s);
1753−
1754− if(flags & AVSEEK_FLAG_BYTE)
1752+ if (flags & AVSEEK_FLAG_BYTE) {
1753+ ff_read_frame_flush(s);
17551754 return seek_frame_byte(s, stream_index, timestamp, flags);
1755+ }
17561756
17571757 if(stream_index < 0){
17581758 stream_index= av_find_default_stream_index(s);
@@ -1765,18 +1765,22 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f · 6 unmodified lines
17651765 }
17661766
17671767 /* first, we try the format specific seek */
1768− if (s->iformat->read_seek)
1768+ if (s->iformat->read_seek) {
1769+ ff_read_frame_flush(s);
17691770 ret = s->iformat->read_seek(s, stream_index, timestamp, flags);
1770− else
1771+ } else
17711772 ret = -1;
17721773 if (ret >= 0) {
17731774 return 0;
17741775 }
17751776
1776− if(s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH))
1777+ if (s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH)) {
1778+ ff_read_frame_flush(s);
17771779 return av_seek_frame_binary(s, stream_index, timestamp, flags);
1778− else if (!(s->iformat->flags & AVFMT_NOGENSEARCH))
1780+ } else if (!(s->iformat->flags & AVFMT_NOGENSEARCH)) {
1781+ ff_read_frame_flush(s);
17791782 return seek_frame_generic(s, stream_index, timestamp, flags);
1783+ }
17801784 else
17811785 return -1;
17821786 }
@@ -1786,10 +1790,10 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int · 3 unmodified lines
17861790 if(min_ts > ts || max_ts < ts)
17871791 return -1;
17881792
1789− ff_read_frame_flush(s);
1790−
1791− if (s->iformat->read_seek2)
1793+ if (s->iformat->read_seek2) {
1794+ ff_read_frame_flush(s);
17921795 return s->iformat->read_seek2(s, stream_index, min_ts, ts, max_ts, flags);
1796+ }
17931797
17941798 if(s->iformat->read_timestamp){
17951799 //try to seek via read_timestamp()

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t