[sysmem2] move vaapi codecs pt 2

BUG: b/306258175
Change-Id: Ie0a15bd381d488e4f13b9379cbb16759f3d313fd
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1042616
Reviewed-by: John Bauman <jbauman@google.com>
Commit-Queue: Dustin Green <dustingreen@google.com>
diff --git a/src/media/codec/codecs/vaapi/codec_runner_app.h b/src/media/codec/codecs/vaapi/codec_runner_app.h
index d531790..017bd70 100644
--- a/src/media/codec/codecs/vaapi/codec_runner_app.h
+++ b/src/media/codec/codecs/vaapi/codec_runner_app.h
@@ -8,6 +8,7 @@
 #include <fuchsia/mediacodec/cpp/fidl.h>
 #include <lib/async-loop/cpp/loop.h>
 #include <lib/async-loop/default.h>
+#include <lib/component/incoming/cpp/protocol.h>
 #include <lib/fidl/cpp/interface_request.h>
 #include <lib/inspect/cpp/inspector.h>
 #include <lib/sys/cpp/component_context.h>
@@ -55,8 +56,9 @@
               // should be impossible to receive a second CodecFactory request.
               FX_DCHECK(!codec_factory_);
 
-              fidl::InterfaceHandle<fuchsia::sysmem::Allocator> sysmem;
-              component_context_->svc()->Connect(sysmem.NewRequest());
+              auto sysmem_result = component::Connect<fuchsia_sysmem2::Allocator>();
+              ZX_ASSERT(sysmem_result.is_ok());
+              auto sysmem = std::move(sysmem_result.value());
               codec_factory_ = std::make_unique<LocalSingleCodecFactory<Decoder, Encoder>>(
                   loop_.dispatcher(), std::move(sysmem), std::move(request),
                   [this](std::unique_ptr<CodecImpl> created_codec_instance) {
diff --git a/src/media/codec/codecs/vaapi/local_single_codec_factory.h b/src/media/codec/codecs/vaapi/local_single_codec_factory.h
index c8582f0..0b69685 100644
--- a/src/media/codec/codecs/vaapi/local_single_codec_factory.h
+++ b/src/media/codec/codecs/vaapi/local_single_codec_factory.h
@@ -27,7 +27,7 @@
 class LocalSingleCodecFactory : public fuchsia::mediacodec::CodecFactory {
  public:
   LocalSingleCodecFactory(async_dispatcher_t* fidl_dispatcher,
-                          fidl::InterfaceHandle<fuchsia::sysmem::Allocator> sysmem,
+                          fidl::ClientEnd<fuchsia_sysmem2::Allocator> sysmem,
                           fidl::InterfaceRequest<CodecFactory> request,
                           fit::function<void(std::unique_ptr<CodecImpl>)> factory_done_callback,
                           CodecAdmissionControl* codec_admission_control,
@@ -148,7 +148,7 @@
   }
 
   async_dispatcher_t* fidl_dispatcher_;
-  fidl::InterfaceHandle<fuchsia::sysmem::Allocator> sysmem_;
+  fidl::ClientEnd<fuchsia_sysmem2::Allocator> sysmem_;
   fidl::Binding<CodecFactory, LocalSingleCodecFactory*> binding_;
   // Returns the codec implementation and requests drop of self.
   fit::function<void(std::unique_ptr<CodecImpl>)> factory_done_callback_;