diff --git a/client/player/oboe_player.cpp b/client/player/oboe_player.cpp index 0a6be00f..036df346 100644 --- a/client/player/oboe_player.cpp +++ b/client/player/oboe_player.cpp @@ -29,9 +29,11 @@ using namespace std; static constexpr auto LOG_TAG = "OboePlayer"; static constexpr double kDefaultLatency = 50; + OboePlayer::OboePlayer(const PcmDevice& pcmDevice, std::shared_ptr stream) : Player(pcmDevice, stream) { LOG(DEBUG, LOG_TAG) << "Contructor\n"; + LOG(INFO, LOG_TAG) << "Init start\n"; char* env = getenv("SAMPLE_RATE"); if (env) oboe::DefaultStreamValues::SampleRate = cpt::stoi(env, oboe::DefaultStreamValues::SampleRate); @@ -46,8 +48,8 @@ OboePlayer::OboePlayer(const PcmDevice& pcmDevice, std::shared_ptr strea oboe::AudioStreamBuilder builder; auto result = builder.setSharingMode(oboe::SharingMode::Exclusive) ->setPerformanceMode(oboe::PerformanceMode::LowLatency) - ->setChannelCount(stream->getFormat().channels) - ->setSampleRate(stream->getFormat().rate) + ->setChannelCount(stream->getFormat().channels()) + ->setSampleRate(stream->getFormat().rate()) ->setFormat(oboe::AudioFormat::I16) ->setCallback(this) ->setDirection(oboe::Direction::Output) @@ -67,6 +69,7 @@ OboePlayer::OboePlayer(const PcmDevice& pcmDevice, std::shared_ptr strea { out_stream_->setBufferSizeInFrames(4 * out_stream_->getFramesPerBurst()); } + LOG(INFO, LOG_TAG) << "Init done\n"; } @@ -85,8 +88,6 @@ OboePlayer::~OboePlayer() double OboePlayer::getCurrentOutputLatencyMillis() const { - // if (!mIsLatencyDetectionSupported) - // return -1; // Get the time that a known audio frame was presented for playing auto result = out_stream_->getTimestamp(CLOCK_MONOTONIC); double outputLatencyMillis = kDefaultLatency; diff --git a/client/player/opensl_player.cpp b/client/player/opensl_player.cpp index a221fb4c..dacb2a9a 100644 --- a/client/player/opensl_player.cpp +++ b/client/player/opensl_player.cpp @@ -158,6 +158,8 @@ void OpenslPlayer::initOpensl() if (active_) return; + LOG(INFO, LOG_TAG) << "Init start\n"; + const SampleFormat& format = stream_->getFormat(); @@ -225,7 +227,7 @@ void OpenslPlayer::initOpensl() SLuint32 bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16; SLuint32 containerSize = SL_PCMSAMPLEFORMAT_FIXED_16; - switch (format.bits) + switch (format.bits()) { case 8: bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_8; @@ -244,7 +246,7 @@ void OpenslPlayer::initOpensl() containerSize = SL_PCMSAMPLEFORMAT_FIXED_32; break; default: - throw SnapException("Unsupported sample format: " + cpt::to_string(format.bits)); + throw SnapException("Unsupported sample format: " + cpt::to_string(format.bits())); } @@ -297,6 +299,7 @@ void OpenslPlayer::initOpensl() result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[curBuffer])); throwUnsuccess(kPhaseInit, "PlayerBufferQueue::Enqueue", result); curBuffer ^= 1; + LOG(INFO, LOG_TAG) << "Init done\n"; }