changeset 24598:5411b440eb24

Fix playback of streams with more than one audio track (only one supported).
author cehoyos
date Tue, 25 Sep 2007 22:34:01 +0000
parents 27ffe16edf57
children 1889da7f76f3
files libmpdemux/demux_rtp.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_rtp.cpp	Tue Sep 25 19:49:03 2007 +0000
+++ b/libmpdemux/demux_rtp.cpp	Tue Sep 25 22:34:01 2007 +0000
@@ -164,6 +164,7 @@
     rtpState->firstSyncTime.tv_sec = rtpState->firstSyncTime.tv_usec = 0;
     demuxer->priv = rtpState;
 
+    int audiofound = 0;
     // Create RTP receivers (sources) for each subsession:
     MediaSubsessionIterator iter(*mediaSession);
     MediaSubsession* subsession;
@@ -171,6 +172,10 @@
     while ((subsession = iter.next()) != NULL) {
       // Ignore any subsession that's not audio or video:
       if (strcmp(subsession->mediumName(), "audio") == 0) {
+	if (audiofound) {
+	  fprintf(stderr, "Additional subsession \"audio/%s\" skipped\n", subsession->codecName());
+	  continue;
+	}
 	desiredReceiveBufferSize = 100000;
       } else if (strcmp(subsession->mediumName(), "video") == 0) {
 	desiredReceiveBufferSize = 2000000;
@@ -203,6 +208,8 @@
 	  // Issue a RTSP "SETUP" command on the chosen subsession:
 	  if (!rtspClient->setupMediaSubsession(*subsession, False,
 						rtspStreamOverTCP)) break;
+	  if (!strcmp(subsession->mediumName(), "audio"))
+	    audiofound = 1;
 	}
       }
     }