Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 774f6b4

Browse files
ilnikCommit bot
authored andcommitted
Reland of Add content type information to encoded images and corresponding rtp extension header (patchset #1 id:1 of https://codereview.webrtc.org/2816463002/ )
Reason for revert: Reland with appropriate changes to API to not break depending projects. Original issue's description: > Revert of Add content type information to encoded images and corresponding rtp extension header (patchset #31 id:600001 of https://codereview.webrtc.org/2772033002/ ) > > Reason for revert: > Breaks dependent projects. > > Original issue's description: > > Add content type information to Encoded Images and add corresponding RTP extension header. > > Use it to separate UMA e2e delay metric between screenshare from video. > > Content type extension is set based on encoder settings and processed and decoders. > > > > Also, > > Fix full-stack-tests to calculate RTT correctly, so new metric could be tested. > > > > BUG=webrtc:7420 > > > > Review-Url: https://codereview.webrtc.org/2772033002 > > Cr-Commit-Position: refs/heads/master@{#17640} > > Committed: https://chromium.googlesource.com/external/webrtc/+/64e739aeae5629cbbebf2a19e1d3e6b452bb6d0b > > [email protected],[email protected],[email protected],[email protected],[email protected] > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:7420 > > Review-Url: https://codereview.webrtc.org/2816463002 > Cr-Commit-Position: refs/heads/master@{#17644} > Committed: https://chromium.googlesource.com/external/webrtc/+/57218668083fce36a55efb8c8f1d31785253b8c0 [email protected],[email protected],[email protected],[email protected],[email protected] # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:7420 Review-Url: https://codereview.webrtc.org/2812913002 Cr-Commit-Position: refs/heads/master@{#17651}
1 parent 268862c commit 774f6b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+473
-91
lines changed

webrtc/api/video/video_content_type.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3+
*
4+
* Use of this source code is governed by a BSD-style license
5+
* that can be found in the LICENSE file in the root of the source
6+
* tree. An additional intellectual property rights grant can be found
7+
* in the file PATENTS. All contributing project authors may
8+
* be found in the AUTHORS file in the root of the source tree.
9+
*/
10+
11+
#ifndef WEBRTC_API_VIDEO_VIDEO_CONTENT_TYPE_H_
12+
#define WEBRTC_API_VIDEO_VIDEO_CONTENT_TYPE_H_
13+
14+
#include <stdint.h>
15+
16+
namespace webrtc {
17+
18+
enum class VideoContentType : uint8_t {
19+
UNSPECIFIED = 0,
20+
SCREENSHARE = 1,
21+
TOTAL_CONTENT_TYPES // Must be the last value in the enum.
22+
};
23+
24+
} // namespace webrtc
25+
26+
#endif // WEBRTC_API_VIDEO_VIDEO_CONTENT_TYPE_H_

webrtc/common_types.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ RTPHeaderExtension::RTPHeaderExtension()
3131
voiceActivity(false),
3232
audioLevel(0),
3333
hasVideoRotation(false),
34-
videoRotation(kVideoRotation_0) {}
34+
videoRotation(kVideoRotation_0),
35+
hasVideoContentType(false),
36+
videoContentType(VideoContentType::UNSPECIFIED) {}
3537

3638
RTPHeader::RTPHeader()
3739
: markerBit(false),

webrtc/common_types.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <string>
1919
#include <vector>
2020

21+
#include "webrtc/api/video/video_content_type.h"
2122
#include "webrtc/api/video/video_rotation.h"
2223
#include "webrtc/base/checks.h"
2324
#include "webrtc/base/optional.h"
@@ -716,6 +717,11 @@ struct RTPHeaderExtension {
716717
bool hasVideoRotation;
717718
VideoRotation videoRotation;
718719

720+
// TODO(ilnik): Refactor this and one above to be rtc::Optional() and remove
721+
// a corresponding bool flag.
722+
bool hasVideoContentType;
723+
VideoContentType videoContentType;
724+
719725
PlayoutDelay playout_delay = {-1, -1};
720726
};
721727

webrtc/config.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ const char* RtpExtension::kTransportSequenceNumberUri =
6464
"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01";
6565
const int RtpExtension::kTransportSequenceNumberDefaultId = 5;
6666

67+
const char* RtpExtension::kVideoContentTypeUri =
68+
"http://www.webrtc.org/experiments/rtp-hdrext/video-content-type";
69+
const int RtpExtension::kVideoContentTypeDefaultId = 6;
70+
6771
// This extension allows applications to adaptively limit the playout delay
6872
// on frames as per the current needs. For example, a gaming application
6973
// has very different needs on end-to-end delay compared to a video-conference
@@ -85,7 +89,8 @@ bool RtpExtension::IsSupportedForVideo(const std::string& uri) {
8589
uri == webrtc::RtpExtension::kAbsSendTimeUri ||
8690
uri == webrtc::RtpExtension::kVideoRotationUri ||
8791
uri == webrtc::RtpExtension::kTransportSequenceNumberUri ||
88-
uri == webrtc::RtpExtension::kPlayoutDelayUri;
92+
uri == webrtc::RtpExtension::kPlayoutDelayUri ||
93+
uri == webrtc::RtpExtension::kVideoContentTypeUri;
8994
}
9095

9196
VideoStream::VideoStream()

webrtc/config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ struct RtpExtension {
8888
static const char* kVideoRotationUri;
8989
static const int kVideoRotationDefaultId;
9090

91+
// Header extension for video content type. E.g. default or screenshare.
92+
static const char* kVideoContentTypeUri;
93+
static const int kVideoContentTypeDefaultId;
94+
9195
// Header extension for transport sequence number, see url for details:
9296
// http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions
9397
static const char* kTransportSequenceNumberUri;

webrtc/media/engine/webrtcvideoengine2_unittest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3852,7 +3852,7 @@ TEST_F(WebRtcVideoChannel2Test, ReceiveDifferentUnsignaledSsrc) {
38523852
EXPECT_EQ(rtpHeader.ssrc, recv_stream->GetConfig().rtp.remote_ssrc);
38533853
// Verify that the receive stream sinks to a renderer.
38543854
webrtc::VideoFrame video_frame2(CreateBlackFrameBuffer(4, 4), 200, 0,
3855-
webrtc::kVideoRotation_0);
3855+
webrtc::kVideoRotation_0);
38563856
recv_stream->InjectFrame(video_frame2);
38573857
EXPECT_EQ(2, renderer.num_rendered_frames());
38583858

@@ -3869,7 +3869,7 @@ TEST_F(WebRtcVideoChannel2Test, ReceiveDifferentUnsignaledSsrc) {
38693869
EXPECT_EQ(rtpHeader.ssrc, recv_stream->GetConfig().rtp.remote_ssrc);
38703870
// Verify that the receive stream sinks to a renderer.
38713871
webrtc::VideoFrame video_frame3(CreateBlackFrameBuffer(4, 4), 300, 0,
3872-
webrtc::kVideoRotation_0);
3872+
webrtc::kVideoRotation_0);
38733873
recv_stream->InjectFrame(video_frame3);
38743874
EXPECT_EQ(3, renderer.num_rendered_frames());
38753875
#endif

webrtc/modules/include/module_common_types.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ struct RTPVideoHeader {
5858

5959
PlayoutDelay playout_delay;
6060

61+
VideoContentType content_type;
62+
6163
union {
6264
bool is_first_packet_in_frame;
6365
RTC_DEPRECATED bool isFirstPacket; // first packet in frame
@@ -87,7 +89,7 @@ class RTPFragmentationHeader {
8789
fragmentationOffset(NULL),
8890
fragmentationLength(NULL),
8991
fragmentationTimeDiff(NULL),
90-
fragmentationPlType(NULL) {};
92+
fragmentationPlType(NULL) {}
9193

9294
~RTPFragmentationHeader() {
9395
delete[] fragmentationOffset;

webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ enum RTPExtensionType {
7676
kRtpExtensionVideoRotation,
7777
kRtpExtensionTransportSequenceNumber,
7878
kRtpExtensionPlayoutDelay,
79-
kRtpExtensionNumberOfExtensions,
79+
kRtpExtensionVideoContentType,
80+
kRtpExtensionNumberOfExtensions // Must be the last entity in the enum.
8081
};
8182

8283
enum RTCPAppSubTypes { kAppSubtypeBwe = 0x00 };

webrtc/modules/rtp_rtcp/source/rtp_header_extension.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ constexpr ExtensionInfo kExtensions[] = {
3939
CreateExtensionInfo<VideoOrientation>(),
4040
CreateExtensionInfo<TransportSequenceNumber>(),
4141
CreateExtensionInfo<PlayoutDelayLimits>(),
42+
CreateExtensionInfo<VideoContentTypeExtension>(),
4243
};
4344

4445
// Because of kRtpExtensionNone, NumberOfExtension is 1 bigger than the actual

webrtc/modules/rtp_rtcp/source/rtp_header_extensions.cc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,33 @@ bool PlayoutDelayLimits::Write(uint8_t* data,
215215
return true;
216216
}
217217

218+
// Video Content Type.
219+
//
220+
// E.g. default video or screenshare.
221+
//
222+
// 0 1
223+
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
224+
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
225+
// | ID | len=0 | Content type |
226+
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
227+
constexpr RTPExtensionType VideoContentTypeExtension::kId;
228+
constexpr uint8_t VideoContentTypeExtension::kValueSizeBytes;
229+
constexpr const char* VideoContentTypeExtension::kUri;
230+
231+
bool VideoContentTypeExtension::Parse(rtc::ArrayView<const uint8_t> data,
232+
VideoContentType* content_type) {
233+
if (data.size() == 1 &&
234+
data[0] < static_cast<uint8_t>(VideoContentType::TOTAL_CONTENT_TYPES)) {
235+
*content_type = static_cast<VideoContentType>(data[0]);
236+
return true;
237+
}
238+
return false;
239+
}
240+
241+
bool VideoContentTypeExtension::Write(uint8_t* data,
242+
VideoContentType content_type) {
243+
data[0] = static_cast<uint8_t>(content_type);
244+
return true;
245+
}
246+
218247
} // namespace webrtc

0 commit comments

Comments
 (0)