Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / modules / rtp_rtcp / source / rtp_format.cc
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 "webrtc/modules/rtp_rtcp/source/rtp_format_h264.h"
14 #include "webrtc/modules/rtp_rtcp/source/rtp_format_video_generic.h"
15 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp8.h"
16
17 namespace webrtc {
18 RtpPacketizer* RtpPacketizer::Create(RtpVideoCodecTypes type,
19                                      size_t max_payload_len,
20                                      const RTPVideoTypeHeader* rtp_type_header,
21                                      FrameType frame_type) {
22   switch (type) {
23     case kRtpVideoH264:
24       return new RtpPacketizerH264(frame_type, max_payload_len);
25     case kRtpVideoVp8:
26       assert(rtp_type_header != NULL);
27       return new RtpPacketizerVp8(rtp_type_header->VP8, max_payload_len);
28     case kRtpVideoGeneric:
29       return new RtpPacketizerGeneric(frame_type, max_payload_len);
30     case kRtpVideoNone:
31       assert(false);
32   }
33   return NULL;
34 }
35
36 RtpDepacketizer* RtpDepacketizer::Create(RtpVideoCodecTypes type) {
37   switch (type) {
38     case kRtpVideoH264:
39       return new RtpDepacketizerH264();
40     case kRtpVideoVp8:
41       return new RtpDepacketizerVp8();
42     case kRtpVideoGeneric:
43       return new RtpDepacketizerGeneric();
44     case kRtpVideoNone:
45       assert(false);
46   }
47   return NULL;
48 }
49 }  // namespace webrtc