libhb: fix incorrect error message when adding substreams to ts list
authorjstebbins <jstebbins.hb@gmail.com>
Tue, 21 Jun 2011 10:35:55 +0000 (10:35 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Tue, 21 Jun 2011 10:35:55 +0000 (10:35 +0000)
The error message was meant to catch the case were a source has
more than 2 substreams in a stream.  But due to incorrect order of
conditionals, it triggered when both substreams have been seen and
we try to add one of them again (which is allowed and should do nothing).

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4071 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/stream.c

index ddf20602ba89330bca07d757c64fb7eeaf444bc9..83169ccc7cf38c95fbdafc7108f81266ca6ed6ba 100644 (file)
@@ -754,20 +754,20 @@ hb_stream_t * hb_bd_stream_open( hb_title_t *title )
             d->ts[d->ts_number_pids].stream_kind = A;
             d->ts_number_pids++;
         }
-        else if ( d->ts[idx].number_substreams < kMaxNumberDecodeSubStreams )
+        // Only add substream if it has not already been added.
+        else if ( index_of_substream( d, pid, substream_type ) < 0 )
         {
-            // Only add substream if it has not already been added.
-            if ( index_of_substream( d, pid, substream_type ) < 0 )
+            if ( d->ts[idx].number_substreams < kMaxNumberDecodeSubStreams )
             {
                 d->ts[idx].substream_type[d->ts[idx].number_substreams] = 
-                                                                substream_type;
+                                        substream_type;
                 d->ts[idx].number_substreams++;
                 d->ts[idx].stream_kind = A;
             }
-        }
-        else
-        {
-            hb_error( "hb_bd_stream_open: Too many substreams. Dropping audio 0x%x.", audio->id );
+            else
+            {
+                hb_error( "hb_bd_stream_open: Too many substreams. Dropping audio 0x%x.", audio->id );
+            }
         }
     }