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

Unified Diff: media/cast/net/frame_id_wrap_helper_test.cc

Issue 458313003: Smarter algorithm for extending 8-bit frame IDs to 32-bit frame IDs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/0LL/0/g Created 6 years, 4 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: media/cast/net/frame_id_wrap_helper_test.cc
diff --git a/media/cast/net/frame_id_wrap_helper_test.cc b/media/cast/net/frame_id_wrap_helper_test.cc
index 92a84435334913406ecc9baba45114e816779715..e48b4fa6dd9736534e738e89b48eccd4cd0c92e4 100644
--- a/media/cast/net/frame_id_wrap_helper_test.cc
+++ b/media/cast/net/frame_id_wrap_helper_test.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <gtest/gtest.h>
+#include "media/cast/cast_defines.h"
#include "media/cast/net/cast_transport_defines.h"
namespace media {
@@ -46,5 +47,22 @@ TEST_F(FrameIdWrapHelperTest, OutOfOrder) {
EXPECT_EQ(257u, new_frame_id);
}
+TEST_F(FrameIdWrapHelperTest, Windowed) {
+ srand(0);
miu 2014/08/13 18:38:57 For the normal, consecutive case, consider adding:
+ const int window_size = 64;
+ uint32 window_base = 0;
+ for (int i = 0; i < 100000; i++) {
+ int offset = rand() % window_size;
+ uint32 frame_id = window_base + offset;
+ uint32 mapped_frame_id =
+ frame_id_wrap_helper_.MapTo32bitsFrameId(frame_id & 0xff);
+ EXPECT_EQ(frame_id, mapped_frame_id);
+ if (frame_id != mapped_frame_id) {
+ break;
+ }
+ window_base += rand() % window_size;
+ }
+}
+
} // namespace cast
} // namespace media
« media/cast/net/cast_transport_defines.h ('K') | « media/cast/net/cast_transport_defines.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698