Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.7 KiB
C
Raw Normal View History

/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef MODULES_RTP_RTCP_INCLUDE_RTP_CVO_H_
#define MODULES_RTP_RTCP_INCLUDE_RTP_CVO_H_
#include "api/video/video_rotation.h"
#include "rtc_base/checks.h"
namespace webrtc {
// Please refer to http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/
// 12.07.00_60/ts_126114v120700p.pdf Section 7.4.5. The rotation of a frame is
// the clockwise angle the frames must be rotated in order to display the frames
// correctly if the display is rotated in its natural orientation.
inline uint8_t ConvertVideoRotationToCVOByte(VideoRotation rotation) {
switch (rotation) {
case kVideoRotation_0:
return 0;
case kVideoRotation_90:
return 1;
case kVideoRotation_180:
return 2;
case kVideoRotation_270:
return 3;
}
RTC_DCHECK_NOTREACHED();
return 0;
}
Reland of Ignore Camera and Flip bits in CVO when parsing video rotation (patchset #1 id:1 of https://codereview.webrtc.org/2300323002/ ) Reason for revert: Downstream build is fixed. Original issue's description: > Revert of Ignore Camera and Flip bits in CVO when parsing video rotation (patchset #3 id:80001 of https://codereview.webrtc.org/2280703002/ ) > > Reason for revert: > Breaks downstream build. > > Original issue's description: > > Ignore Camera and Flip bits in CVO when parsing video rotation > > > > Currently, if WebRTC receives a CVO byte where the Camera or Flip bit is > > set, then rotation is incorrectly parsed as 0. This CL fixes that issue. > > The Camera and Flip bit is still unimplemented and will just be ignored > > though. > > > > BUG=webrtc:6120 > > R=danilchap@webrtc.org, pthatcher@webrtc.org, tommi@webrtc.org > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/f9e1b922ef3e0cbe70953dfb7a1d4cb2c44a49e3 > > TBR=pthatcher@webrtc.org,danilchap@webrtc.org,tommi@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6120 > > Committed: https://crrev.com/97667c7746282704acccd896e26175decee349c0 > Cr-Commit-Position: refs/heads/master@{#14035} TBR=pthatcher@webrtc.org,danilchap@webrtc.org,tommi@webrtc.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=webrtc:6120 Review-Url: https://codereview.webrtc.org/2320913003 Cr-Commit-Position: refs/heads/master@{#14124}
2016-09-08 03:24:58 -07:00
inline VideoRotation ConvertCVOByteToVideoRotation(uint8_t cvo_byte) {
// CVO byte: |0 0 0 0 C F R R|.
const uint8_t rotation_bits = cvo_byte & 0x3;
switch (rotation_bits) {
case 0:
return kVideoRotation_0;
case 1:
return kVideoRotation_90;
case 2:
return kVideoRotation_180;
case 3:
return kVideoRotation_270;
default:
RTC_DCHECK_NOTREACHED();
return kVideoRotation_0;
}
}
} // namespace webrtc
#endif // MODULES_RTP_RTCP_INCLUDE_RTP_CVO_H_