Advertisement
Guest User

Untitled

a guest
Dec 13th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. From 1a314c73992979a9b10bbf0369a14aad5742c1b0 Mon Sep 17 00:00:00 2001
  2. From: Joakim Plate <elupus@ecce.se>
  3. Date: Fri, 13 Dec 2013 22:13:39 +0100
  4. Subject: [PATCH 1/1] mpegts: speed up find_stream_info for mpegts
  5.  
  6. This disable NOHEADER after finding PMT, find_stream_info
  7. will always exhaust probe size for mpegts since this flag
  8. is set.
  9.  
  10. This is very problematically for live streams since read speed
  11. will be limited. rtsp, udp and any protocol streaming a live
  12. mpegts will have dramatically faster startup time.
  13. ---
  14. lib/ffmpeg/libavformat/mpegts.c | 10 +++++-----
  15. 1 file changed, 5 insertions(+), 5 deletions(-)
  16.  
  17. diff --git a/lib/ffmpeg/libavformat/mpegts.c b/lib/ffmpeg/libavformat/mpegts.c
  18. index 4f25686..6545ba1 100644
  19. --- a/lib/ffmpeg/libavformat/mpegts.c
  20. +++ b/lib/ffmpeg/libavformat/mpegts.c
  21. @@ -1531,6 +1531,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
  22. if (!ts->stream->nb_streams)
  23. ts->stop_parse = 2;
  24.  
  25. + // stop find_stream_info from waiting for more streams
  26. + ts->stream->ctx_flags &= ~AVFMTCTX_NOHEADER;
  27. +
  28. for(;;) {
  29. st = 0;
  30. pes = NULL;
  31. @@ -2080,6 +2083,8 @@ static int mpegts_read_header(AVFormatContext *s)
  32. ts->stream = s;
  33. ts->auto_guess = 0;
  34.  
  35. + s->ctx_flags |= AVFMTCTX_NOHEADER;
  36. +
  37. if (s->iformat == &ff_mpegts_demuxer) {
  38. /* normal demux */
  39.  
  40. @@ -2100,11 +2105,6 @@ static int mpegts_read_header(AVFormatContext *s)
  41. ts->auto_guess = 1;
  42.  
  43. av_dlog(ts->stream, "tuning done\n");
  44. -
  45. - /* only flag NOHEADER if we are in file mode,
  46. - in streaming mode scanning may take too long for users */
  47. - if (pb->seekable)
  48. - s->ctx_flags |= AVFMTCTX_NOHEADER;
  49. } else {
  50. AVStream *st;
  51. int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l;
  52. --
  53. 1.8.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement