From eab7d2b372363da248e092adc5077fcfb532ab8e Mon Sep 17 00:00:00 2001 From: Runt <qingingrunt2010@qq.com> Date: Sat, 12 Apr 2025 06:49:44 +0000 Subject: [PATCH] 去掉小窗跑马灯效果 --- app/src/main/cpp/audio_channel.cpp | 4 ++-- app/src/main/cpp/server_global.cpp | 39 ++++++++------------------------------- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/app/src/main/cpp/audio_channel.cpp b/app/src/main/cpp/audio_channel.cpp index 4b98273..0e97a65 100644 --- a/app/src/main/cpp/audio_channel.cpp +++ b/app/src/main/cpp/audio_channel.cpp @@ -53,14 +53,14 @@ } } -RTMPPacket * AudioChannel::getAudioSeqHeader() { +RTMPPacket *AudioChannel::getAudioSeqHeader() { u_char *buf; u_long len; faacEncGetDecoderSpecificInfo(audioEncoder, &buf, &len); return allocPacket(len,0x00,buf); } -RTMPPacket * AudioChannel::allocPacket(int byteLen,char m_type,u_char *buffer) { +RTMPPacket *AudioChannel::allocPacket(int byteLen,char m_type,u_char *buffer) { RTMPPacket *packet = new RTMPPacket ; int body_size = 2 + byteLen; RTMPPacket_Alloc(packet,body_size); diff --git a/app/src/main/cpp/server_global.cpp b/app/src/main/cpp/server_global.cpp index c915fd4..e15a9b4 100644 --- a/app/src/main/cpp/server_global.cpp +++ b/app/src/main/cpp/server_global.cpp @@ -136,42 +136,19 @@ int uvWidth = srcWidth / 2; int uvHeight = srcHeight / 2; - int64_t t2 = getCurrentTimestamp(); // 填充 Y 平面的黑边 // 上边 - int light = 255 * (1 - (t2%1000 / 1000.0)); - for (int x = 0; x < srcWidth; x++) { - if(light >= 255){ - light = 0 ; - } - light++; - for (int y = 0; y < borderWidth; y++) { - memset(yuvData[0] + y * srcWidth + x, light, 1); - } - } - for (int y = borderWidth; y < srcHeight - borderWidth; y++) { - if(light >= 255){ - light = 0 ; - } - light++; - memset(yuvData[0] + y * srcWidth + srcWidth - borderWidth, light, borderWidth); // 右边 + for (int y = 0; y < borderWidth; y++) { + memset(yuvData[0] + y * srcWidth, 0, srcWidth); } // 下边 - for (int x = srcWidth; x > 0; x--) { - if(light >= 255){ - light = 0 ; - } - light++; - for (int y = srcHeight - borderWidth; y < srcHeight; y++) { - memset(yuvData[0] + y * srcWidth + x - 1, light, 1); - } + for (int y = srcHeight - borderWidth; y < srcHeight; y++) { + memset(yuvData[0] + y * srcWidth, 0, srcWidth); } - for (int y = srcHeight - borderWidth; y > 0 ; y--) { - if(light >= 255){ - light = 0 ; - } - light++; - memset(yuvData[0] + y * srcWidth, light, borderWidth); // 左边 + // 左边和右边 + for (int y = borderWidth; y < srcHeight - borderWidth; y++) { + memset(yuvData[0] + y * srcWidth, 0, borderWidth); // 左边 + memset(yuvData[0] + y * srcWidth + srcWidth - borderWidth, 0, borderWidth); // 右边 } // 填充 U 和 V 平面的黑边(边框宽度在 U 和 V 平面上缩小一半) -- Gitblit v1.9.1