diff --git a/player/AudioSRC.cpp b/player/AudioSRC.cpp index 2af4433f..bd18dd59 100644 --- a/player/AudioSRC.cpp +++ b/player/AudioSRC.cpp @@ -122,7 +122,7 @@ int AudioPlayer::getPCMData(char *buf, int size) { return size; } -void AudioPlayer::inputFrame(const char *data, size_t size) { +void AudioPlayer::playPCM(const char *data, size_t size) { lock_guard lck(_mtx); _buffer.append(data, size); } diff --git a/player/AudioSRC.h b/player/AudioSRC.h index 1b552d09..f5d6cdb8 100644 --- a/player/AudioSRC.h +++ b/player/AudioSRC.h @@ -68,7 +68,7 @@ public: ~AudioPlayer() override; void setup(int sample_rate, int channel, SDL_AudioFormat format); - void inputFrame(const char *data, size_t size); + void playPCM(const char *data, size_t size); private: SDL_AudioFormat getPCMFormat() override; diff --git a/player/test_player.cpp b/player/test_player.cpp index 5049a6c2..4effd378 100644 --- a/player/test_player.cpp +++ b/player/test_player.cpp @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) { //FFmpeg解码时已经统一转换为16位整型pcm audio_player->setup(audioTrack->getAudioSampleRate(), audioTrack->getAudioChannel(), AUDIO_S16); decoder->setOnDecode([audio_player](const FFmpegFrame::Ptr &pcm) { - audio_player->inputFrame((const char *) (pcm->get()->data[0]), pcm->get()->linesize[0]); + audio_player->playPCM((const char *) (pcm->get()->data[0]), pcm->get()->linesize[0]); }); auto audio_delegate = std::make_shared( [decoder](const Frame::Ptr &frame) { decoder->inputFrame(frame);