diff --git a/Live/src/main/cpp/VideoStream.cpp b/Live/src/main/cpp/VideoStream.cpp index c2ca3c3..395abb7 100644 --- a/Live/src/main/cpp/VideoStream.cpp +++ b/Live/src/main/cpp/VideoStream.cpp @@ -4,8 +4,7 @@ #include "VideoStream.h" #include "PushInterface.h" -VideoStream::VideoStream():yLen(0), - mBitrate(0), +VideoStream::VideoStream():m_frameLen(0), videoCodec(nullptr), pic_in(nullptr), videoCallback(nullptr) { @@ -26,8 +25,7 @@ VideoStream::~VideoStream() { void VideoStream::setVideoEncInfo(int width, int height, int fps, int bitrate) { pthread_mutex_lock(&mutex); - mBitrate = bitrate; - yLen = width * height; + m_frameLen = width * height; if (videoCodec) { x264_encoder_close(videoCodec); videoCodec = nullptr; @@ -86,18 +84,18 @@ void VideoStream::encodeVideo(int8_t *data, int8_t camera_type) { pthread_mutex_lock(&mutex); if (camera_type == 1) { - memcpy(pic_in->img.plane[0], data, yLen); // y - for (int i = 0; i < yLen/4; ++i) { - *(pic_in->img.plane[1] + i) = *(data + yLen + i * 2 + 1); // u - *(pic_in->img.plane[2] + i) = *(data + yLen + i * 2); // v + memcpy(pic_in->img.plane[0], data, m_frameLen); // y + for (int i = 0; i < m_frameLen/4; ++i) { + *(pic_in->img.plane[1] + i) = *(data + m_frameLen + i * 2 + 1); // u + *(pic_in->img.plane[2] + i) = *(data + m_frameLen + i * 2); // v } } else if (camera_type == 2) { int offset = 0; - memcpy(pic_in->img.plane[0], data, (size_t) yLen); // y - offset += yLen; - memcpy(pic_in->img.plane[1], data + offset, (size_t) yLen / 4); // u - offset += yLen / 4; - memcpy(pic_in->img.plane[2], data + offset, (size_t) yLen / 4); // v + memcpy(pic_in->img.plane[0], data, (size_t) m_frameLen); // y + offset += m_frameLen; + memcpy(pic_in->img.plane[1], data + offset, (size_t) m_frameLen / 4); // u + offset += m_frameLen / 4; + memcpy(pic_in->img.plane[2], data + offset, (size_t) m_frameLen / 4); // v } else { return; } diff --git a/Live/src/main/cpp/VideoStream.h b/Live/src/main/cpp/VideoStream.h index bc772fc..00f8df3 100644 --- a/Live/src/main/cpp/VideoStream.h +++ b/Live/src/main/cpp/VideoStream.h @@ -24,8 +24,7 @@ public: private: pthread_mutex_t mutex{}; - int yLen; - int mBitrate; + int m_frameLen; x264_t *videoCodec = 0; x264_picture_t *pic_in = 0; VideoCallback videoCallback; diff --git a/Live/src/main/res/mipmap-mdpi/ic_launcher.png b/Live/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c133a0c..0000000 Binary files a/Live/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/Live/src/main/res/mipmap-mdpi/ic_launcher_round.png b/Live/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index efc028a..0000000 Binary files a/Live/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/Live/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/Live/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index aee44e1..0000000 Binary files a/Live/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/Live/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/Live/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 34947cd..0000000 Binary files a/Live/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/app/src/main/java/com/frank/ffmpeg/activity/LiveActivity.kt b/app/src/main/java/com/frank/ffmpeg/activity/LiveActivity.kt index 91f4e73..3c23e8f 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/LiveActivity.kt +++ b/app/src/main/java/com/frank/ffmpeg/activity/LiveActivity.kt @@ -173,7 +173,7 @@ open class LiveActivity : BaseActivity(), CompoundButton.OnCheckedChangeListener companion object { 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 } }