change NULL to null_ptr

dev
xufulong 3 years ago
parent 522b3e367f
commit 16899ae079
  1. 6
      app/src/main/cpp/audio_player.cpp

@ -231,7 +231,7 @@ AUDIO_PLAYER_FUNC(void, play, jstring input_jstr, jstring filter_jstr) {
} }
AVCodecContext *codecCtx = pFormatCtx->streams[audio_stream_idx]->codec; AVCodecContext *codecCtx = pFormatCtx->streams[audio_stream_idx]->codec;
AVCodec *codec = avcodec_find_decoder(codecCtx->codec_id); AVCodec *codec = avcodec_find_decoder(codecCtx->codec_id);
if (codec == NULL) { if (codec == nullptr) {
LOGE(TAG, "Couldn't find audio decoder!"); LOGE(TAG, "Couldn't find audio decoder!");
return; return;
} }
@ -239,7 +239,7 @@ AUDIO_PLAYER_FUNC(void, play, jstring input_jstr, jstring filter_jstr) {
LOGE(TAG, "Couldn't open audio decoder"); LOGE(TAG, "Couldn't open audio decoder");
return; return;
} }
AVPacket *packet = (AVPacket *) av_malloc(sizeof(AVPacket)); auto *packet = (AVPacket *) av_malloc(sizeof(AVPacket));
AVFrame *frame = av_frame_alloc(); AVFrame *frame = av_frame_alloc();
SwrContext *swrCtx = swr_alloc(); SwrContext *swrCtx = swr_alloc();
enum AVSampleFormat in_sample_fmt = codecCtx->sample_fmt; enum AVSampleFormat in_sample_fmt = codecCtx->sample_fmt;
@ -271,7 +271,7 @@ AUDIO_PLAYER_FUNC(void, play, jstring input_jstr, jstring filter_jstr) {
env->CallVoidMethod(audio_track, audio_track_play_mid); env->CallVoidMethod(audio_track, audio_track_play_mid);
//get write method //get write method
jmethodID audio_track_write_mid = env->GetMethodID(audio_track_class, "write", "([BII)I"); jmethodID audio_track_write_mid = env->GetMethodID(audio_track_class, "write", "([BII)I");
uint8_t *out_buffer = (uint8_t *) av_malloc(MAX_AUDIO_FRAME_SIZE); auto *out_buffer = (uint8_t *) av_malloc(MAX_AUDIO_FRAME_SIZE);
/* Set up the filter graph. */ /* Set up the filter graph. */
AVFrame *filter_frame = av_frame_alloc(); AVFrame *filter_frame = av_frame_alloc();

Loading…
Cancel
Save