Feature: remove useless param

pull/221/head
xufuji456 3 years ago
parent 037588daf5
commit c81c02d01e
  1. 24
      Live/src/main/cpp/VideoStream.cpp
  2. 3
      Live/src/main/cpp/VideoStream.h
  3. BIN
      Live/src/main/res/mipmap-mdpi/ic_launcher.png
  4. BIN
      Live/src/main/res/mipmap-mdpi/ic_launcher_round.png
  5. BIN
      Live/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  6. BIN
      Live/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
  7. 2
      app/src/main/java/com/frank/ffmpeg/activity/LiveActivity.kt

@ -4,8 +4,7 @@
#include "VideoStream.h" #include "VideoStream.h"
#include "PushInterface.h" #include "PushInterface.h"
VideoStream::VideoStream():yLen(0), VideoStream::VideoStream():m_frameLen(0),
mBitrate(0),
videoCodec(nullptr), videoCodec(nullptr),
pic_in(nullptr), pic_in(nullptr),
videoCallback(nullptr) { videoCallback(nullptr) {
@ -26,8 +25,7 @@ VideoStream::~VideoStream() {
void VideoStream::setVideoEncInfo(int width, int height, int fps, int bitrate) { void VideoStream::setVideoEncInfo(int width, int height, int fps, int bitrate) {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
mBitrate = bitrate; m_frameLen = width * height;
yLen = width * height;
if (videoCodec) { if (videoCodec) {
x264_encoder_close(videoCodec); x264_encoder_close(videoCodec);
videoCodec = nullptr; videoCodec = nullptr;
@ -86,18 +84,18 @@ void VideoStream::encodeVideo(int8_t *data, int8_t camera_type) {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
if (camera_type == 1) { if (camera_type == 1) {
memcpy(pic_in->img.plane[0], data, yLen); // y memcpy(pic_in->img.plane[0], data, m_frameLen); // y
for (int i = 0; i < yLen/4; ++i) { for (int i = 0; i < m_frameLen/4; ++i) {
*(pic_in->img.plane[1] + i) = *(data + yLen + i * 2 + 1); // u *(pic_in->img.plane[1] + i) = *(data + m_frameLen + i * 2 + 1); // u
*(pic_in->img.plane[2] + i) = *(data + yLen + i * 2); // v *(pic_in->img.plane[2] + i) = *(data + m_frameLen + i * 2); // v
} }
} else if (camera_type == 2) { } else if (camera_type == 2) {
int offset = 0; int offset = 0;
memcpy(pic_in->img.plane[0], data, (size_t) yLen); // y memcpy(pic_in->img.plane[0], data, (size_t) m_frameLen); // y
offset += yLen; offset += m_frameLen;
memcpy(pic_in->img.plane[1], data + offset, (size_t) yLen / 4); // u memcpy(pic_in->img.plane[1], data + offset, (size_t) m_frameLen / 4); // u
offset += yLen / 4; offset += m_frameLen / 4;
memcpy(pic_in->img.plane[2], data + offset, (size_t) yLen / 4); // v memcpy(pic_in->img.plane[2], data + offset, (size_t) m_frameLen / 4); // v
} else { } else {
return; return;
} }

@ -24,8 +24,7 @@ public:
private: private:
pthread_mutex_t mutex{}; pthread_mutex_t mutex{};
int yLen; int m_frameLen;
int mBitrate;
x264_t *videoCodec = 0; x264_t *videoCodec = 0;
x264_picture_t *pic_in = 0; x264_picture_t *pic_in = 0;
VideoCallback videoCallback; VideoCallback videoCallback;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

@ -173,7 +173,7 @@ open class LiveActivity : BaseActivity(), CompoundButton.OnCheckedChangeListener
companion object { companion object {
private val TAG = LiveActivity::class.java.simpleName private val TAG = LiveActivity::class.java.simpleName
private const val LIVE_URL = "rtmp://192.168.31.212/live/stream" private const val LIVE_URL = "rtmp://192.168.31.29/live/stream"
private const val MSG_ERROR = 100 private const val MSG_ERROR = 100
} }
} }

Loading…
Cancel
Save