@@ -145,11 +145,10 @@ public class Decoder extends Activity {
145145 private final MediaCodec .BufferInfo mBufferInfo = new MediaCodec .BufferInfo ();
146146
147147 // read from the network thread, written from the UI thread
148- private static final int CAM_COUNT = 8 ;
148+ private static final int CAM_COUNT = 4 ;
149149 private static final String DEFAULT_URL = "rtsp://root:12345@192.168.1.10:554/stream=0" ;
150150 private final String [] mHosts = new String [CAM_COUNT ];
151151 private final boolean [] mTypes = new boolean [CAM_COUNT ]; // false = TCP, true = UDP
152- private final boolean [] mQuad = new boolean [CAM_COUNT ]; // per-camera quad participation
153152 private int mActive ; // only accessed on the UI thread — no volatile needed
154153 private volatile String mHost ;
155154 private volatile boolean mType ;
@@ -362,7 +361,6 @@ private void loadSettings() {
362361 for (int i = 0 ; i < CAM_COUNT ; i ++) {
363362 mHosts [i ] = pref .getString ("host_" + i , DEFAULT_URL );
364363 mTypes [i ] = pref .getBoolean ("type_" + i , false );
365- mQuad [i ] = pref .getBoolean ("quad_" + i , false );
366364 }
367365 applyActiveCamera ();
368366
@@ -552,16 +550,13 @@ private void startQuad() {
552550 // clear stale quad frames
553551 clearQuadViews ();
554552
555- // collect first 4 cameras with quad enabled
553+ // use all 4 cameras for quad mode
556554 quadCells = new QuadCell [4 ];
557- int count = 0 ;
558- for (int i = 0 ; i < CAM_COUNT && count < 4 ; i ++) {
559- if (!mQuad [i ]) continue ;
555+ for (int i = 0 ; i < 4 ; i ++) {
560556 String url = mHosts [i ];
561557 if (url == null || url .isEmpty () || url .equals (DEFAULT_URL )) continue ;
562- quadCells [count ] = new QuadCell (count , url , quadViews [count ]);
563- quadCells [count ].start ();
564- count ++;
558+ quadCells [i ] = new QuadCell (i , url , quadViews [i ]);
559+ quadCells [i ].start ();
565560 }
566561
567562 quadEnabled = true ;
@@ -602,12 +597,10 @@ private void saveSettings() {
602597 for (int i = 0 ; i < CAM_COUNT ; i ++) {
603598 edit .putString ("host_" + i , mHosts [i ]);
604599 edit .putBoolean ("type_" + i , mTypes [i ]);
605- edit .putBoolean ("quad_" + i , mQuad [i ]);
606600 }
607601 edit .apply ();
608602
609603 applyActiveCamera ();
610- // If in quad mode, just save — don't restart the single-stream listener
611604 if (quadEnabled ) return ;
612605 // Force-stop the current network thread and restart immediately
613606 activeStream = false ;
@@ -703,15 +696,6 @@ private void createMenu(View menu) {
703696 saveSettings ();
704697 });
705698
706- TextView quadCamToggle = createItem (mQuad [mActive ] ? "Quad: YES" : "Quad: NO" );
707- header .addView (quadCamToggle );
708- quadCamToggle .setOnClickListener (v -> {
709- mQuad [mActive ] = !mQuad [mActive ];
710- quadCamToggle .setText (mQuad [mActive ] ? "Quad: YES" : "Quad: NO" );
711- getSharedPreferences ("settings" , MODE_PRIVATE ).edit ()
712- .putBoolean ("quad_" + mActive , mQuad [mActive ]).apply ();
713- });
714-
715699 final TextView [] camButtons = new TextView [CAM_COUNT ];
716700 for (int i = 0 ; i < CAM_COUNT ; i ++) {
717701 final int slot = i ;
@@ -734,7 +718,6 @@ private void createMenu(View menu) {
734718 host .setText (mHosts [mActive ]);
735719 host .setSelection (host .getText ().length ());
736720 typeToggle .setText (mTypes [mActive ] ? "Transport: UDP" : "Transport: TCP" );
737- quadCamToggle .setText (mQuad [mActive ] ? "Quad: YES" : "Quad: NO" );
738721 saveSettings ();
739722 });
740723 }
@@ -2082,14 +2065,11 @@ protected void onResume() {
20822065 // clear stale quad frames
20832066 clearQuadViews ();
20842067 quadCells = new QuadCell [4 ];
2085- int count = 0 ;
2086- for (int i = 0 ; i < CAM_COUNT && count < 4 ; i ++) {
2087- if (!mQuad [i ]) continue ;
2068+ for (int i = 0 ; i < 4 ; i ++) {
20882069 String url = mHosts [i ];
20892070 if (url == null || url .isEmpty () || url .equals (DEFAULT_URL )) continue ;
2090- quadCells [count ] = new QuadCell (count , url , quadViews [count ]);
2091- quadCells [count ].start ();
2092- count ++;
2071+ quadCells [i ] = new QuadCell (i , url , quadViews [i ]);
2072+ quadCells [i ].start ();
20932073 }
20942074 } else {
20952075 mSurface .setVisibility (View .VISIBLE );
0 commit comments