diff --git a/Live/src/main/java/com/frank/live/LivePusherNew.java b/Live/src/main/java/com/frank/live/LivePusherNew.java index 9c86a68..e3fa5d1 100644 --- a/Live/src/main/java/com/frank/live/LivePusherNew.java +++ b/Live/src/main/java/com/frank/live/LivePusherNew.java @@ -16,20 +16,13 @@ import com.frank.live.stream.VideoStreamNew; public class LivePusherNew implements OnFrameDataCallback { - //error of opening video encoder - private final static int ERROR_VIDEO_ENCODER_OPEN = 0x01; - //error of video encoding - private final static int ERROR_VIDEO_ENCODE = 0x02; - //error of opening audio encoder - private final static int ERROR_AUDIO_ENCODER_OPEN = 0x03; - //error of audio encoding - private final static int ERROR_AUDIO_ENCODE = 0x04; - //error of RTMP connecting server - private final static int ERROR_RTMP_CONNECT = 0x05; - //error of RTMP connecting stream - private final static int ERROR_RTMP_CONNECT_STREAM = 0x06; - //error of RTMP sending packet - private final static int ERROR_RTMP_SEND_PACKET = 0x07; + private final static int ERROR_VIDEO_ENCODER_OPEN = 0x01; + private final static int ERROR_VIDEO_ENCODER_ENCODE = 0x02; + private final static int ERROR_AUDIO_ENCODER_OPEN = 0x03; + private final static int ERROR_AUDIO_ENCODER_ENCODE = 0x04; + private final static int ERROR_RTMP_CONNECT_SERVER = 0x05; + private final static int ERROR_RTMP_CONNECT_STREAM = 0x06; + private final static int ERROR_RTMP_SEND_PACKET = 0x07; static { System.loadLibrary("live"); @@ -111,16 +104,16 @@ public class LivePusherNew implements OnFrameDataCallback { case ERROR_VIDEO_ENCODER_OPEN: msg = activity.getString(R.string.error_video_encoder); break; - case ERROR_VIDEO_ENCODE: + case ERROR_VIDEO_ENCODER_ENCODE: msg = activity.getString(R.string.error_video_encode); break; case ERROR_AUDIO_ENCODER_OPEN: msg = activity.getString(R.string.error_audio_encoder); break; - case ERROR_AUDIO_ENCODE: + case ERROR_AUDIO_ENCODER_ENCODE: msg = activity.getString(R.string.error_audio_encode); break; - case ERROR_RTMP_CONNECT: + case ERROR_RTMP_CONNECT_SERVER: msg = activity.getString(R.string.error_rtmp_connect); break; case ERROR_RTMP_CONNECT_STREAM: diff --git a/Live/src/main/java/com/frank/live/param/AudioParam.java b/Live/src/main/java/com/frank/live/param/AudioParam.java index 23f8778..811a5cb 100644 --- a/Live/src/main/java/com/frank/live/param/AudioParam.java +++ b/Live/src/main/java/com/frank/live/param/AudioParam.java @@ -13,10 +13,10 @@ public class AudioParam { private int numChannels; public AudioParam(int sampleRate, int channelConfig, int audioFormat, int numChannels) { - this.sampleRate = sampleRate; + this.sampleRate = sampleRate; this.channelConfig = channelConfig; - this.audioFormat = audioFormat; - this.numChannels = numChannels; + this.audioFormat = audioFormat; + this.numChannels = numChannels; } public int getChannelConfig() { diff --git a/Live/src/main/java/com/frank/live/param/VideoParam.java b/Live/src/main/java/com/frank/live/param/VideoParam.java index 97fa790..a66e44b 100644 --- a/Live/src/main/java/com/frank/live/param/VideoParam.java +++ b/Live/src/main/java/com/frank/live/param/VideoParam.java @@ -13,10 +13,10 @@ public class VideoParam { private int frameRate; public VideoParam(int width, int height, int cameraId, int bitRate, int frameRate) { - this.width = width; - this.height = height; - this.cameraId = cameraId; - this.bitRate = bitRate; + this.width = width; + this.height = height; + this.cameraId = cameraId; + this.bitRate = bitRate; this.frameRate = frameRate; } diff --git a/app/src/main/cpp/ff_audio_resample.cpp b/app/src/main/cpp/ff_audio_resample.cpp index 2a93685..04b571c 100644 --- a/app/src/main/cpp/ff_audio_resample.cpp +++ b/app/src/main/cpp/ff_audio_resample.cpp @@ -229,8 +229,7 @@ int FFAudioResample::decodeAndConvert(int *finished) { goto cleanup; } - if (av_audio_fifo_write(resample->fifo, (void **)converted_dst_samples, dst_nb_samples) < dst_nb_samples) - goto cleanup; + av_audio_fifo_write(resample->fifo, (void **)converted_dst_samples, ret); } ret = 0;