Line data Source code
1 : /*
2 : * Copyright (c) 2014 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 : #include "webrtc/modules/rtp_rtcp/source/rtp_format.h"
12 :
13 : #include <utility>
14 :
15 : #include "webrtc/modules/rtp_rtcp/source/rtp_format_h264.h"
16 : #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
17 : #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
18 : #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h"
19 :
20 : namespace webrtc {
21 0 : RtpPacketizer* RtpPacketizer::Create(RtpVideoCodecTypes type,
22 : size_t max_payload_len,
23 : const RTPVideoTypeHeader* rtp_type_header,
24 : FrameType frame_type) {
25 0 : switch (type) {
26 : case kRtpVideoH264:
27 0 : RTC_CHECK(rtp_type_header);
28 : return new RtpPacketizerH264(max_payload_len,
29 0 : rtp_type_header->H264.packetization_mode);
30 : case kRtpVideoVp8:
31 0 : RTC_CHECK(rtp_type_header);
32 0 : return new RtpPacketizerVp8(rtp_type_header->VP8, max_payload_len);
33 : case kRtpVideoVp9:
34 0 : RTC_CHECK(rtp_type_header);
35 0 : return new RtpPacketizerVp9(rtp_type_header->VP9, max_payload_len);
36 : case kRtpVideoGeneric:
37 0 : return new RtpPacketizerGeneric(frame_type, max_payload_len);
38 : case kRtpVideoNone:
39 0 : RTC_NOTREACHED();
40 : }
41 0 : return NULL;
42 : }
43 :
44 0 : RtpDepacketizer* RtpDepacketizer::Create(RtpVideoCodecTypes type) {
45 0 : switch (type) {
46 : case kRtpVideoH264:
47 0 : return new RtpDepacketizerH264();
48 : case kRtpVideoVp8:
49 0 : return new RtpDepacketizerVp8();
50 : case kRtpVideoVp9:
51 0 : return new RtpDepacketizerVp9();
52 : case kRtpVideoGeneric:
53 0 : return new RtpDepacketizerGeneric();
54 : case kRtpVideoNone:
55 0 : assert(false);
56 : }
57 0 : return NULL;
58 : }
59 : } // namespace webrtc
|