From b4ba84af52b8afab5c831d26c5c10c2a4fb8c947 Mon Sep 17 00:00:00 2001
From: philippegorley <philippe.gorley@savoirfairelinux.com>
Date: Wed, 22 Aug 2018 11:22:44 -0400
Subject: [PATCH] media_stream: add copy ctor and validity check

Change-Id: I39a8d91c2c66a029942cdfc6d2c2307a41d0d1ee
---
 src/media/media_stream.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/media/media_stream.h b/src/media/media_stream.h
index d531869228..f64176134b 100644
--- a/src/media/media_stream.h
+++ b/src/media/media_stream.h
@@ -104,6 +104,18 @@ struct MediaStream {
             break;
         }
     }
+
+    MediaStream(const MediaStream& other) = default;
+
+    bool isValid() const
+    {
+        if (format < 0)
+            return false;
+        if (isVideo)
+            return width > 0 && height > 0;
+        else
+            return sampleRate > 0 && nbChannels > 0;
+    }
 };
 
 inline std::ostream& operator<<(std::ostream& os, const MediaStream& ms)
-- 
GitLab