summaryrefslogtreecommitdiffstats
path: root/media/cast/cast_defines.h
diff options
context:
space:
mode:
authormikhal@chromium.org <mikhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-11 20:23:48 +0000
committermikhal@chromium.org <mikhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-11 20:23:48 +0000
commit726b63668d783e1e53c6a4d6e0102075a8c28143 (patch)
tree7fca4fd9828df92c75c19c6d06b19bd08f24b77b /media/cast/cast_defines.h
parent4e8d90a3f424185cc9d4ea76510499320b9724a6 (diff)
downloadchromium_src-726b63668d783e1e53c6a4d6e0102075a8c28143.zip
chromium_src-726b63668d783e1e53c6a4d6e0102075a8c28143.tar.gz
chromium_src-726b63668d783e1e53c6a4d6e0102075a8c28143.tar.bz2
Cast:Moving netwrok sender related code to a designated folder
This cl is a first step in splitting up the cast library. At the end of this effort, the cast sender will be split into two: Generic protocol and encoding remain as is, all handling of coded frames to transmission will be in a designated folder (currently named net). This cl ONLY handles the moving of the files. Future cl's will include: - New cast_net API - Adding RTCP handling - Designated target (and namespace) BUG=327482 Review URL: https://codereview.chromium.org/112133002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240166 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/cast/cast_defines.h')
-rw-r--r--media/cast/cast_defines.h65
1 files changed, 1 insertions, 64 deletions
diff --git a/media/cast/cast_defines.h b/media/cast/cast_defines.h
index 944a49d..aad7ae2 100644
--- a/media/cast/cast_defines.h
+++ b/media/cast/cast_defines.h
@@ -18,9 +18,9 @@ namespace cast {
const int64 kDontShowTimeoutMs = 33;
const float kDefaultCongestionControlBackOff = 0.875f;
-const uint32 kStartFrameId = GG_UINT32_C(0xffffffff);
const uint32 kVideoFrequency = 90000;
const int64 kSkippedFramesCheckPeriodkMs = 10000;
+const uint32 kStartFrameId = GG_UINT32_C(0xffffffff);
// Number of skipped frames threshold in fps (as configured) per period above.
const int kSkippedFramesThreshold = 3;
@@ -140,69 +140,6 @@ inline base::TimeTicks ConvertNtpToTimeTicks(uint32 ntp_seconds,
return base::TimeTicks::UnixEpoch() + elapsed_since_unix_epoch;
}
-class FrameIdWrapHelper {
- public:
- FrameIdWrapHelper()
- : first_(true),
- frame_id_wrap_count_(0),
- range_(kLowRange) {}
-
- uint32 MapTo32bitsFrameId(const uint8 over_the_wire_frame_id) {
- if (first_) {
- first_ = false;
- if (over_the_wire_frame_id == 0xff) {
- // Special case for startup.
- return kStartFrameId;
- }
- }
-
- uint32 wrap_count = frame_id_wrap_count_;
- switch (range_) {
- case kLowRange:
- if (over_the_wire_frame_id > kLowRangeThreshold &&
- over_the_wire_frame_id < kHighRangeThreshold) {
- range_ = kMiddleRange;
- }
- if (over_the_wire_frame_id > kHighRangeThreshold) {
- // Wrap count was incremented in High->Low transition, but this frame
- // is 'old', actually from before the wrap count got incremented.
- --wrap_count;
- }
- break;
- case kMiddleRange:
- if (over_the_wire_frame_id > kHighRangeThreshold) {
- range_ = kHighRange;
- }
- break;
- case kHighRange:
- if (over_the_wire_frame_id < kLowRangeThreshold) {
- // Wrap-around detected.
- range_ = kLowRange;
- ++frame_id_wrap_count_;
- // Frame triggering wrap-around so wrap count should be incremented as
- // as well to match |frame_id_wrap_count_|.
- ++wrap_count;
- }
- break;
- }
- return (wrap_count << 8) + over_the_wire_frame_id;
- }
-
- private:
- enum Range {
- kLowRange,
- kMiddleRange,
- kHighRange,
- };
-
- static const uint8 kLowRangeThreshold = 0x0f;
- static const uint8 kHighRangeThreshold = 0xf0;
-
- bool first_;
- uint32 frame_id_wrap_count_;
- Range range_;
-};
-
inline std::string GetAesNonce(uint32 frame_id, const std::string& iv_mask) {
std::string aes_nonce(kAesBlockSize, 0);