From 11e993d870aadc40ea2901c4df568f6950202cec Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Tue, 29 Jun 2021 18:19:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- player/AudioSRC.cpp | 2 +- player/AudioSRC.h | 2 +- player/test_player.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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);