|
|
@ -12,7 +12,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
PacketQueue<RTMPPacket *> packets; |
|
|
|
PacketQueue<RTMPPacket *> packets; |
|
|
|
VideoStream *videoStream = nullptr; |
|
|
|
VideoStream *videoStream = nullptr; |
|
|
|
int isStart = 0; |
|
|
|
|
|
|
|
pthread_t pid; |
|
|
|
pthread_t pid; |
|
|
|
|
|
|
|
|
|
|
|
std::atomic<bool> isPushing; |
|
|
|
std::atomic<bool> isPushing; |
|
|
@ -76,7 +75,7 @@ void releasePackets(RTMPPacket *&packet) { |
|
|
|
|
|
|
|
|
|
|
|
void *start(void *args) { |
|
|
|
void *start(void *args) { |
|
|
|
char *url = static_cast<char *>(args); |
|
|
|
char *url = static_cast<char *>(args); |
|
|
|
RTMP *rtmp = nullptr; |
|
|
|
RTMP *rtmp; |
|
|
|
do { |
|
|
|
do { |
|
|
|
rtmp = RTMP_Alloc(); |
|
|
|
rtmp = RTMP_Alloc(); |
|
|
|
if (!rtmp) { |
|
|
|
if (!rtmp) { |
|
|
@ -131,7 +130,6 @@ void *start(void *args) { |
|
|
|
} |
|
|
|
} |
|
|
|
releasePackets(packet); |
|
|
|
releasePackets(packet); |
|
|
|
} while (0); |
|
|
|
} while (0); |
|
|
|
isStart = 0; |
|
|
|
|
|
|
|
isPushing = false; |
|
|
|
isPushing = false; |
|
|
|
packets.setRunning(false); |
|
|
|
packets.setRunning(false); |
|
|
|
packets.clear(); |
|
|
|
packets.clear(); |
|
|
@ -162,10 +160,9 @@ RTMP_PUSHER_FUNC(void, native_1setVideoCodecInfo, |
|
|
|
|
|
|
|
|
|
|
|
RTMP_PUSHER_FUNC(void, native_1start, jstring path_) { |
|
|
|
RTMP_PUSHER_FUNC(void, native_1start, jstring path_) { |
|
|
|
LOGI("native start..."); |
|
|
|
LOGI("native start..."); |
|
|
|
if (isStart) { |
|
|
|
if (isPushing) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
isStart = 1; |
|
|
|
|
|
|
|
const char *path = env->GetStringUTFChars(path_, nullptr); |
|
|
|
const char *path = env->GetStringUTFChars(path_, nullptr); |
|
|
|
char *url = new char[strlen(path) + 1]; |
|
|
|
char *url = new char[strlen(path) + 1]; |
|
|
|
strcpy(url, path); |
|
|
|
strcpy(url, path); |
|
|
@ -214,6 +211,8 @@ RTMP_PUSHER_FUNC(void, native_1stop) { |
|
|
|
RTMP_PUSHER_FUNC(void, native_1release) { |
|
|
|
RTMP_PUSHER_FUNC(void, native_1release) { |
|
|
|
LOGI("native release..."); |
|
|
|
LOGI("native release..."); |
|
|
|
env->DeleteGlobalRef(jobject_error); |
|
|
|
env->DeleteGlobalRef(jobject_error); |
|
|
|
DELETE(videoStream); |
|
|
|
delete videoStream; |
|
|
|
DELETE(audioStream); |
|
|
|
videoStream = nullptr; |
|
|
|
|
|
|
|
delete audioStream; |
|
|
|
|
|
|
|
audioStream = nullptr; |
|
|
|
} |
|
|
|
} |