src/media/audio/drivers/test/admin_test.cc
// Request that the driver return a VMO handle for the ring buffer, at the currently set format.
// This method relies on the ring buffer channel.
Request that the driver return a VMO handle for the ring buffer, at the currently set format.
This method relies on the ring buffer channel.
Request that the driver return a VMO handle for the ring buffer at the currently set format . This method relies on the ring buffer channel .
void AdminTest::RequestBuffer(uint32_t min_ring_buffer_frames, uint32_t notifications_per_ring) {
  if (device_access_denied()) {
    return;
  }
  min_ring_buffer_frames_ = min_ring_buffer_frames;
  notifications_per_ring_ = notifications_per_ring;
  zx::vmo ring_buffer_vmo;
  ring_buffer_->GetVmo(
      min_ring_buffer_frames, notifications_per_ring,
      [this, &ring_buffer_vmo](fuchsia::hardware::audio::RingBuffer_GetVmo_Result result) {
        EXPECT_GE(result.response().num_frames, min_ring_buffer_frames_);
        ring_buffer_frames_ = result.response().num_frames;
        ring_buffer_vmo = std::move(result.response().ring_buffer);
        EXPECT_TRUE(ring_buffer_vmo.is_valid());
        received_get_buffer_ = true;
      });
  RunLoopUntil([this]() { return received_get_buffer_ || device_access_denied(); });
  const zx_vm_option_t option_flags = ZX_VM_PERM_READ | ZX_VM_PERM_WRITE;
  EXPECT_EQ(ring_buffer_mapper_.CreateAndMap(ring_buffer_frames_ * frame_size_, option_flags,
                                             nullptr, &ring_buffer_vmo,
                                             ZX_RIGHT_READ | ZX_RIGHT_MAP | ZX_RIGHT_TRANSFER),
            ZX_OK);
  FX_LOGS(DEBUG) << "Mapping size: " << ring_buffer_frames_ * frame_size_;
}
void AdminTest :: RequestBuffer ( uint32_t min_ring_buffer_frames , uint32_t notifications_per_ring ) { if ( device_access_denied ( ) ) { return ; } min_ring_buffer_frames_ = min_ring_buffer_frames ; notifications_per_ring_ = notifications_per_ring ; zx :: vmo ring_buffer_vmo ; ring_buffer_ -> GetVmo ( min_ring_buffer_frames , notifications_per_ring , [ this , & ring_buffer_vmo ] ( fuchsia :: hardware :: audio :: RingBuffer_GetVmo_Result result ) { EXPECT_GE ( result . response ( ) . num_frames , min_ring_buffer_frames_ ) ; ring_buffer_frames_ = result . response ( ) . num_frames ; ring_buffer_vmo = std :: move ( result . response ( ) . ring_buffer ) ; EXPECT_TRUE ( ring_buffer_vmo . is_valid ( ) ) ; received_get_buffer_ = true ; } ) ; RunLoopUntil ( [ this ] ( ) { return received_get_buffer_ || device_access_denied ( ) ; } ) ; const zx_vm_option_t option_flags = ZX_VM_PERM_READ | ZX_VM_PERM_WRITE ; EXPECT_EQ ( ring_buffer_mapper_ . CreateAndMap ( ring_buffer_frames_ * frame_size_ , option_flags , nullptr , & ring_buffer_vmo , ZX_RIGHT_READ | ZX_RIGHT_MAP | ZX_RIGHT_TRANSFER ) , ZX_OK ) ; FX_LOGS ( DEBUG ) << " " << ring_buffer_frames_ * frame_size_ ; }
Request that the driver return a VMO handle for the ring buffer, at the currently set format.
Request that the driver return a VMO handle for the ring buffer at the currently set format .