Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: extensions/renderer/api/display_source/wifi_display/wifi_display_stream_packet_part.h

Issue 1796123002: Implement WiFi Display elementary stream packetizer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: clang-format Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/api/display_source/wifi_display/wifi_display_stream_packet_part.h
diff --git a/extensions/renderer/api/display_source/wifi_display/wifi_display_stream_packet_part.h b/extensions/renderer/api/display_source/wifi_display/wifi_display_stream_packet_part.h
new file mode 100644
index 0000000000000000000000000000000000000000..097c0b8c32be99a22c8927ace2761bb75b5c5ae4
--- /dev/null
+++ b/extensions/renderer/api/display_source/wifi_display/wifi_display_stream_packet_part.h
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_STREAM_PACKET_PART_H_
+#define EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_STREAM_PACKET_PART_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "base/macros.h"
+
+namespace extensions {
+
+// WiFi Display elementary stream unit packetization consists of multiple
+// packetization phases. During those phases, unit buffer bytes are not
+// modified but only wrapped in packets.
+// This class allows different kind of WiFi Display stream packets to refer to
+// unit buffer bytes without copying them.
+class WiFiDisplayStreamPacketPart {
+ public:
+ WiFiDisplayStreamPacketPart(const uint8_t* data, size_t size)
+ : data_(data), size_(size) {}
asargent_no_longer_on_chrome 2016/03/16 22:47:58 nit: inlining constructors is discouraged http://
e_hakkinen 2016/03/17 15:29:26 But since there is no inheritance, no explicit des
asargent_no_longer_on_chrome 2016/03/17 18:22:59 Ok, since it has only POD members it should be alr
+ template <size_t N>
+ explicit WiFiDisplayStreamPacketPart(const uint8_t (&data)[N])
+ : WiFiDisplayStreamPacketPart(data, N) {}
+ // Allow copy elision. Should never be really called.
+ WiFiDisplayStreamPacketPart(WiFiDisplayStreamPacketPart&& other)
+ : WiFiDisplayStreamPacketPart(other.data(), other.size()) {}
asargent_no_longer_on_chrome 2016/03/16 22:47:58 I may be misunderstanding what you're trying to ac
e_hakkinen 2016/03/17 15:29:26 It should never be called but it should still be a
asargent_no_longer_on_chrome 2016/03/17 18:22:59 ok
+
+ const uint8_t* begin() const { return data(); }
+ const uint8_t* data() const { return data_; }
+ bool empty() const { return size() == 0u; }
+ const uint8_t* end() const { return data() + size(); }
asargent_no_longer_on_chrome 2016/03/16 22:47:58 consider not inlining this function http://dev.ch
+ size_t size() const { return size_; }
+
+ private:
+ const uint8_t* const data_;
+ const size_t size_;
+
+ DISALLOW_COPY_AND_ASSIGN(WiFiDisplayStreamPacketPart);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_RENDERER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_STREAM_PACKET_BASE_H_

Powered by Google App Engine
This is Rietveld 408576698