[FFmpeg-devel] [PATCH 1/2] rtsp: Don't use AVStream->priv_data for mapping RTSPStreams to AVStreams

Martin Storsjö martin
Fri Feb 11 08:20:19 CET 2011


Since a few weeks ago, AVStream->priv_data isn't set. The much
more straightforward solution is to use RTSPStream->stream_index
instead.
---
Btw, are there any better-working RealRTSP samples than the ones
on multimediawiki? The audio-only ones work fine, but most of
the ones with video crash ffplay sooner or later (unrelated
to these patches).

 libavformat/rtspdec.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 45ed7bb..31a51f8 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -281,9 +281,9 @@ retry:
             snprintf(cmd, sizeof(cmd),
                      "Subscribe: ");
             for (i = 0; i < rt->nb_rtsp_streams; i++) {
+                int r = rt->rtsp_streams[i]->stream_index;
                 rule_nr = 0;
-                for (r = 0; r < s->nb_streams; r++) {
-                    if (s->streams[r]->priv_data == rt->rtsp_streams[i]) {
+                if (r >= 0) {
                         if (s->streams[r]->discard != AVDISCARD_ALL) {
                             if (!first)
                                 av_strlcat(rt->last_subscription, ",",
@@ -294,7 +294,6 @@ retry:
                             first = 0;
                         }
                         rule_nr++;
-                    }
                 }
             }
             av_strlcatf(cmd, sizeof(cmd), "%s\r\n", rt->last_subscription);
-- 
1.7.3.1




More information about the ffmpeg-devel mailing list