fix: 修正资源ID typo 及单元类型声明
修正布局文件中 `@+rid` 为 `@+id` 的 typo,将 UNIT_TYPE 常量类型从 int 改为 byte 以保持协议一致性,新增 StreamModeReportListener 接口,并将日志级别从 error 调整为 debug。
This commit is contained in:
@@ -29,8 +29,8 @@ public class SelfCodecEncoder {
|
|||||||
// ---- 自定义二进制协议(与控制端 SelfCodecDecoder 保持一致)----
|
// ---- 自定义二进制协议(与控制端 SelfCodecDecoder 保持一致)----
|
||||||
private static final byte MAGIC = (byte) 0xAB;
|
private static final byte MAGIC = (byte) 0xAB;
|
||||||
private static final int CHUNK_SIZE = 16384; // 每个 DataChannel 分片大小
|
private static final int CHUNK_SIZE = 16384; // 每个 DataChannel 分片大小
|
||||||
private static final int UNIT_TYPE_CONFIG = 1; // SPS/PPS 等参数集
|
private static final byte UNIT_TYPE_CONFIG = 1; // SPS/PPS 等参数集
|
||||||
private static final int UNIT_TYPE_FRAME = 2; // 编码帧
|
private static final byte UNIT_TYPE_FRAME = 2; // 编码帧
|
||||||
|
|
||||||
private static final String TAG = "SelfCodecEncoder";
|
private static final String TAG = "SelfCodecEncoder";
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ public class WebRtcClient {
|
|||||||
void onDisconnected();
|
void onDisconnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface StreamModeReportListener {
|
||||||
|
void onStreamModeReported(int mode);
|
||||||
|
}
|
||||||
|
|
||||||
private ConnectionListener connectionListener;
|
private ConnectionListener connectionListener;
|
||||||
|
|
||||||
public WebRtcClient(Context context, WebSocketClient wsClient, String deviceId) {
|
public WebRtcClient(Context context, WebSocketClient wsClient, String deviceId) {
|
||||||
@@ -395,7 +399,7 @@ public class WebRtcClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendIceCandidate(IceCandidate candidate, String controlledId) {
|
private void sendIceCandidate(IceCandidate candidate, String controlledId) {
|
||||||
Log.e(TAG, "sendIceCandidate: " );
|
Log.d(TAG, "sendIceCandidate: " );
|
||||||
SignalMessage msg = new SignalMessage();
|
SignalMessage msg = new SignalMessage();
|
||||||
msg.setType("ICE_CANDIDATE");
|
msg.setType("ICE_CANDIDATE");
|
||||||
msg.setFromDeviceId(deviceId);
|
msg.setFromDeviceId(deviceId);
|
||||||
|
|||||||
@@ -160,8 +160,9 @@
|
|||||||
android:backgroundTint="#E53935"
|
android:backgroundTint="#E53935"
|
||||||
android:text="断开连接"
|
android:text="断开连接"
|
||||||
android:textColor="@android:color/white" />
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
android:id="@+rid/switch_stream_mode"
|
android:id="@+id/switch_stream_mode"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
@@ -170,7 +171,7 @@
|
|||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+rid/tv_stream_mode"
|
android:id="@+id/tv_stream_mode"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
|
|||||||
Reference in New Issue
Block a user