| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "talk/media/webrtc/webrtcmediaengine.h" | 28 #include "talk/media/webrtc/webrtcmediaengine.h" |
| 29 #include "talk/media/webrtc/webrtcvideoengine2.h" | 29 #include "talk/media/webrtc/webrtcvideoengine2.h" |
| 30 #include "talk/media/webrtc/webrtcvoiceengine.h" | 30 #include "talk/media/webrtc/webrtcvoiceengine.h" |
| 31 #include "webrtc/base/arraysize.h" |
| 31 | 32 |
| 32 namespace cricket { | 33 namespace cricket { |
| 33 | 34 |
| 34 class WebRtcMediaEngine2 | 35 class WebRtcMediaEngine2 |
| 35 : public CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine2> { | 36 : public CompositeMediaEngine<WebRtcVoiceEngine, WebRtcVideoEngine2> { |
| 36 public: | 37 public: |
| 37 WebRtcMediaEngine2(webrtc::AudioDeviceModule* adm, | 38 WebRtcMediaEngine2(webrtc::AudioDeviceModule* adm, |
| 38 WebRtcVideoEncoderFactory* encoder_factory, | 39 WebRtcVideoEncoderFactory* encoder_factory, |
| 39 WebRtcVideoDecoderFactory* decoder_factory) { | 40 WebRtcVideoDecoderFactory* decoder_factory) { |
| 40 voice_.SetAudioDeviceModule(adm); | 41 voice_.SetAudioDeviceModule(adm); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 65 webrtc::AudioDeviceModule* adm, | 66 webrtc::AudioDeviceModule* adm, |
| 66 WebRtcVideoEncoderFactory* encoder_factory, | 67 WebRtcVideoEncoderFactory* encoder_factory, |
| 67 WebRtcVideoDecoderFactory* decoder_factory) { | 68 WebRtcVideoDecoderFactory* decoder_factory) { |
| 68 return CreateWebRtcMediaEngine(adm, encoder_factory, decoder_factory); | 69 return CreateWebRtcMediaEngine(adm, encoder_factory, decoder_factory); |
| 69 } | 70 } |
| 70 | 71 |
| 71 const char* kBweExtensionPriorities[] = { | 72 const char* kBweExtensionPriorities[] = { |
| 72 kRtpTransportSequenceNumberHeaderExtension, | 73 kRtpTransportSequenceNumberHeaderExtension, |
| 73 kRtpAbsoluteSenderTimeHeaderExtension, kRtpTimestampOffsetHeaderExtension}; | 74 kRtpAbsoluteSenderTimeHeaderExtension, kRtpTimestampOffsetHeaderExtension}; |
| 74 | 75 |
| 75 const size_t kBweExtensionPrioritiesLength = | 76 const size_t kBweExtensionPrioritiesLength = arraysize(kBweExtensionPriorities); |
| 76 ARRAY_SIZE(kBweExtensionPriorities); | |
| 77 | 77 |
| 78 int GetPriority(const RtpHeaderExtension& extension, | 78 int GetPriority(const RtpHeaderExtension& extension, |
| 79 const char* extension_prios[], | 79 const char* extension_prios[], |
| 80 size_t extension_prios_length) { | 80 size_t extension_prios_length) { |
| 81 for (size_t i = 0; i < extension_prios_length; ++i) { | 81 for (size_t i = 0; i < extension_prios_length; ++i) { |
| 82 if (extension.uri == extension_prios[i]) | 82 if (extension.uri == extension_prios[i]) |
| 83 return static_cast<int>(i); | 83 return static_cast<int>(i); |
| 84 } | 84 } |
| 85 return -1; | 85 return -1; |
| 86 } | 86 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 102 } else { | 102 } else { |
| 103 sorted[priority] = &extension; | 103 sorted[priority] = &extension; |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 if (!sorted.empty()) | 106 if (!sorted.empty()) |
| 107 filtered.push_back(*sorted.begin()->second); | 107 filtered.push_back(*sorted.begin()->second); |
| 108 return filtered; | 108 return filtered; |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace cricket | 111 } // namespace cricket |
| OLD | NEW |