Loading system/audio_bluetooth_hw/stream_apis.cc +10 −2 Original line number Original line Diff line number Diff line Loading @@ -341,8 +341,12 @@ static int out_set_parameters(struct audio_stream* stream, if (params["A2dpSuspended"] == "true") { if (params["A2dpSuspended"] == "true") { LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState() LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState() << " stream param stopped"; << " stream param stopped"; if (out->bluetooth_output_.GetState() != BluetoothStreamState::DISABLED) { out->frames_rendered_ = 0; out->frames_rendered_ = 0; if (out->bluetooth_output_.GetState() == BluetoothStreamState::STARTED) { out->bluetooth_output_.Suspend(); out->bluetooth_output_.SetState(BluetoothStreamState::DISABLED); } else if (out->bluetooth_output_.GetState() != BluetoothStreamState::DISABLED) { out->bluetooth_output_.Stop(); out->bluetooth_output_.Stop(); } } } else { } else { Loading Loading @@ -498,6 +502,10 @@ static ssize_t out_write(struct audio_stream_out* stream, const void* buffer, if (stream->resume(stream)) { if (stream->resume(stream)) { LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_.GetState() LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_.GetState() << " failed to resume"; << " failed to resume"; if (out->bluetooth_output_.GetState() == BluetoothStreamState::DISABLED) { // drop data for cases of A2dpSuspended=true / closing=true totalWritten = bytes; } usleep(kBluetoothDefaultOutputBufferMs * 1000); usleep(kBluetoothDefaultOutputBufferMs * 1000); return totalWritten; return totalWritten; } } Loading Loading
system/audio_bluetooth_hw/stream_apis.cc +10 −2 Original line number Original line Diff line number Diff line Loading @@ -341,8 +341,12 @@ static int out_set_parameters(struct audio_stream* stream, if (params["A2dpSuspended"] == "true") { if (params["A2dpSuspended"] == "true") { LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState() LOG(INFO) << __func__ << ": state=" << out->bluetooth_output_.GetState() << " stream param stopped"; << " stream param stopped"; if (out->bluetooth_output_.GetState() != BluetoothStreamState::DISABLED) { out->frames_rendered_ = 0; out->frames_rendered_ = 0; if (out->bluetooth_output_.GetState() == BluetoothStreamState::STARTED) { out->bluetooth_output_.Suspend(); out->bluetooth_output_.SetState(BluetoothStreamState::DISABLED); } else if (out->bluetooth_output_.GetState() != BluetoothStreamState::DISABLED) { out->bluetooth_output_.Stop(); out->bluetooth_output_.Stop(); } } } else { } else { Loading Loading @@ -498,6 +502,10 @@ static ssize_t out_write(struct audio_stream_out* stream, const void* buffer, if (stream->resume(stream)) { if (stream->resume(stream)) { LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_.GetState() LOG(ERROR) << __func__ << ": state=" << out->bluetooth_output_.GetState() << " failed to resume"; << " failed to resume"; if (out->bluetooth_output_.GetState() == BluetoothStreamState::DISABLED) { // drop data for cases of A2dpSuspended=true / closing=true totalWritten = bytes; } usleep(kBluetoothDefaultOutputBufferMs * 1000); usleep(kBluetoothDefaultOutputBufferMs * 1000); return totalWritten; return totalWritten; } } Loading