[Openscreen] Add standalone cast_receiver target to Chrome builds

This adds the standalone cast_receiver target to non-Windows builds of
Chrome. A similar change in https://crrev.com/c/5369648 was reverted due
to issues when building the target for Windows or Android.

This limits enabling the cast_receiver target to only ChromeOS, Linux,
MacOS and Android builds.

The Android build issue should be fixed by the change to
platform/BUILD.gn to use Linux network adapter enumeration.

This also combines the SDL and UI-free stanadalone_receiver source sets
in cast/standalone_receiver/BUILD.gn into cast_receiver_lib. This
simplifies the build file.

Bug: b/320187114
Change-Id: I2d6476df8b486489ce17be3324b6013274174c1e
Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/5870914
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Nathan Hebert <nhebert@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 2cf3074..87a4eb2 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -63,9 +63,14 @@
     }
   }
 
+  # The cast_receiver depends on the standalone implementation which is only
+  # implemented for certain operating systems.
+  if (is_linux || is_mac || is_chromeos || is_android) {
+    deps += [ "cast/standalone_receiver:cast_receiver" ]
+  }
+
   if (!build_with_chromium) {
     deps += [
-      "cast/standalone_receiver:cast_receiver",
       "cast/standalone_sender:cast_sender",
       "third_party/protobuf:protoc($host_toolchain)",
       "third_party/zlib",
diff --git a/cast/standalone_receiver/BUILD.gn b/cast/standalone_receiver/BUILD.gn
index 6f3596c..8793dc2 100644
--- a/cast/standalone_receiver/BUILD.gn
+++ b/cast/standalone_receiver/BUILD.gn
@@ -3,8 +3,8 @@
 # found in the LICENSE file.
 
 import("//build_overrides/build.gni")
-import("//cast/streaming/external_libraries.gni")
 import("../../gni/openscreen.gni")
+import("../streaming/external_libraries.gni")
 
 visibility = [ "./*" ]
 
@@ -13,10 +13,12 @@
 # application.
 #
 # See [external_libraries.md](../../build/config/external_libraries.md) for more information.
-if (!build_with_chromium) {
-  shared_public = [ "cast_service.h" ]
 
-  shared_sources = [
+openscreen_source_set("cast_receiver_lib") {
+  testonly = true
+  public = [ "cast_service.h" ]
+
+  sources = [
     "cast_service.cc",
     "mirroring_application.cc",
     "mirroring_application.h",
@@ -26,7 +28,7 @@
     "streaming_playback_controller.h",
   ]
 
-  shared_deps = [
+  deps = [
     "../../discovery:dnssd",
     "../../discovery:public",
     "../../platform:api",
@@ -36,62 +38,43 @@
     "../streaming:receiver",
   ]
 
-  have_external_libs = have_ffmpeg && have_libsdl2
-
-  if (have_external_libs) {
-    openscreen_source_set("standalone_receiver_sdl") {
-      testonly = true
-      public = shared_public
-      sources = shared_sources
-      deps = shared_deps
-
-      defines = [ "CAST_STANDALONE_RECEIVER_HAVE_EXTERNAL_LIBS" ]
-      sources += [
-        "avcodec_glue.h",
-        "decoder.cc",
-        "decoder.h",
-        "sdl_audio_player.cc",
-        "sdl_audio_player.h",
-        "sdl_glue.cc",
-        "sdl_glue.h",
-        "sdl_player_base.cc",
-        "sdl_player_base.h",
-        "sdl_video_player.cc",
-        "sdl_video_player.h",
-      ]
-      include_dirs = ffmpeg_include_dirs + libsdl2_include_dirs
-      lib_dirs = ffmpeg_lib_dirs + libsdl2_lib_dirs
-      libs = ffmpeg_libs + libsdl2_libs
-    }
-  }
-
-  openscreen_source_set("standalone_receiver_dummy") {
-    testonly = true
-    public = shared_public
-    sources = shared_sources
-    deps = shared_deps
-
+  if (have_ffmpeg && have_libsdl2) {
+    defines = [ "CAST_STANDALONE_RECEIVER_HAVE_EXTERNAL_LIBS" ]
+    sources += [
+      "avcodec_glue.h",
+      "decoder.cc",
+      "decoder.h",
+      "sdl_audio_player.cc",
+      "sdl_audio_player.h",
+      "sdl_glue.cc",
+      "sdl_glue.h",
+      "sdl_player_base.cc",
+      "sdl_player_base.h",
+      "sdl_video_player.cc",
+      "sdl_video_player.h",
+    ]
+    include_dirs = ffmpeg_include_dirs + libsdl2_include_dirs
+    lib_dirs = ffmpeg_lib_dirs + libsdl2_lib_dirs
+    libs = ffmpeg_libs + libsdl2_libs
+  } else {
     sources += [
       "dummy_player.cc",
       "dummy_player.h",
     ]
   }
+}
 
-  openscreen_executable("cast_receiver") {
-    testonly = true
-    visibility += [ "../..:gn_all" ]
-    sources = [ "main.cc" ]
+openscreen_executable("cast_receiver") {
+  testonly = true
+  visibility += [ "../..:gn_all" ]
+  sources = [ "main.cc" ]
 
-    deps = shared_deps + [
-             "../../platform:standalone_impl",
-             "../common:certificate_boringssl",
-           ]
-    configs = [ "../common:certificate_config" ]
-
-    if (have_external_libs) {
-      deps += [ ":standalone_receiver_sdl" ]
-    } else {
-      deps += [ ":standalone_receiver_dummy" ]
-    }
-  }
+  deps = [
+    ":cast_receiver_lib",
+    "../../platform:standalone_impl",
+    "../common:certificate_boringssl",
+    "../common/certificate/proto:certificate_proto",
+    "../receiver:channel",
+  ]
+  configs = [ "../common:certificate_config" ]
 }
diff --git a/platform/BUILD.gn b/platform/BUILD.gn
index 5647c28..e22250e 100644
--- a/platform/BUILD.gn
+++ b/platform/BUILD.gn
@@ -121,7 +121,7 @@
 
     public_configs = [ "../util:trace_logging_config" ]
 
-    if (is_linux || is_chromeos ) {
+    if (is_linux || is_chromeos || is_android) {
       sources += [ "impl/network_interface_linux.cc" ]
     } else if (is_mac) {
       defines += [