@Override
public int getStreamHeight() {
- //ToDo : Fetch stream height from discovery message and return it.
- return 0;
+ return webrtc.getFrameHeight();
}
@Override
public int getStreamWidth() {
- //ToDo : Fetch stream width from discovery message and return it.
- return 0;
+ return webrtc.getFrameWidth();
}
@Override
Log.d(TAG, "onSetFailure: Reason = " + s);
}
}
+
+ /**
+ * Method to get received Frame height
+ *
+ * @return Received frame height
+ */
+ public int getFrameHeight() {
+ return 0;
+ }
+
+ /**
+ * Method to get received Frame width
+ *
+ * @return Received frame width
+ */
+ public int getFrameWidth() {
+ return 0;
+ }
}
private final ByteArrayOutputStream baos;
private boolean recvLargeChunk = false;
+ private int frameHeight = 0;
+ private int frameWidth = 0;
public WebRTCSubscriber(Context appContext) throws InstantiationException {
super(appContext);
return true;
}
+ @Override
+ public int getFrameHeight() {
+ return frameHeight;
+ }
+
+ @Override
+ public int getFrameWidth() {
+ return frameWidth;
+ }
+
@Override
protected void initializePeerConnection() {
PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration(new ArrayList<>());
@Override
synchronized public void onFrame(VideoFrame frame) {
byte[] rawFrame = createNV21Data(frame.getBuffer().toI420());
+ frameHeight = frame.getBuffer().getHeight();
+ frameWidth = frame.getBuffer().getWidth();
dataCallback.pushData(rawFrame);
}