blob: 9a906fe999e7e8f0859c5d4c3f4dfa57f2308608 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellander1afca732016-02-07 20:46:45 -08002 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellander1afca732016-02-07 20:46:45 -08004 * 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.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00009 */
10
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef MEDIA_ENGINE_WEBRTC_MEDIA_ENGINE_H_
12#define MEDIA_ENGINE_WEBRTC_MEDIA_ENGINE_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000013
Steve Antone78bcb92017-10-31 09:53:08 -070014#include <memory>
solenberg7e4e01a2015-12-02 08:05:01 -080015#include <string>
16#include <vector>
17
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020018#include "call/call.h"
Steve Anton10542f22019-01-11 09:11:00 -080019#include "media/base/media_engine.h"
Fredrik Solenberg8f5787a2018-01-11 13:52:30 +010020#include "modules/audio_device/include/audio_device.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000021
22namespace webrtc {
ossuc54071d2016-08-17 02:45:41 -070023class AudioDecoderFactory;
gyzhou95aa9642016-12-13 14:06:26 -080024class AudioMixer;
peaha9cc40b2017-06-29 08:32:09 -070025class AudioProcessing;
Magnus Jedvert58b03162017-09-15 19:02:47 +020026class VideoDecoderFactory;
27class VideoEncoderFactory;
Jiawei Ouc2ebe212018-11-08 10:02:56 -080028class VideoBitrateAllocatorFactory;
Yves Gerey665174f2018-06-19 15:03:05 +020029} // namespace webrtc
henrike@webrtc.org28e20752013-07-10 00:45:36 +000030
buildbot@webrtc.org58e7c862014-06-20 00:26:50 +000031namespace cricket {
32
henrike@webrtc.org0481f152014-08-19 14:56:59 +000033class WebRtcMediaEngineFactory {
buildbot@webrtc.org58e7c862014-06-20 00:26:50 +000034 public:
deadbeefeb02c032017-06-15 08:29:25 -070035 // These Create methods may be called on any thread, though the engine is
36 // only expected to be used on one thread, internally called the "worker
37 // thread". This is the thread Init must be called on.
Magnus Jedvert58b03162017-09-15 19:02:47 +020038
39 // Create a MediaEngineInterface with optional video codec factories. These
40 // video factories represents all video codecs, i.e. no extra internal video
41 // codecs will be added.
42 static std::unique_ptr<MediaEngineInterface> Create(
43 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm,
44 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
45 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory,
46 std::unique_ptr<webrtc::VideoEncoderFactory> video_encoder_factory,
47 std::unique_ptr<webrtc::VideoDecoderFactory> video_decoder_factory,
48 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
49 rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing);
Jiawei Ouc2ebe212018-11-08 10:02:56 -080050
51 static std::unique_ptr<MediaEngineInterface> Create(
52 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm,
53 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
54 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory,
55 std::unique_ptr<webrtc::VideoEncoderFactory> video_encoder_factory,
56 std::unique_ptr<webrtc::VideoDecoderFactory> video_decoder_factory,
57 std::unique_ptr<webrtc::VideoBitrateAllocatorFactory>
58 video_bitrate_allocator_factory,
59 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
60 rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing);
buildbot@webrtc.orgbb2d6582014-06-20 14:58:56 +000061};
62
solenberg7e4e01a2015-12-02 08:05:01 -080063// Verify that extension IDs are within 1-byte extension range and are not
64// overlapping.
isheriff6f8d6862016-05-26 11:24:55 -070065bool ValidateRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions);
Stefan Holmerbbaf3632015-10-29 18:53:23 +010066
isheriff6f8d6862016-05-26 11:24:55 -070067// Discard any extensions not validated by the 'supported' predicate. Duplicate
solenberg7e4e01a2015-12-02 08:05:01 -080068// extensions are removed if 'filter_redundant_extensions' is set, and also any
isheriff6f8d6862016-05-26 11:24:55 -070069// mutually exclusive extensions (see implementation for details) are removed.
solenberg7e4e01a2015-12-02 08:05:01 -080070std::vector<webrtc::RtpExtension> FilterRtpExtensions(
isheriff6f8d6862016-05-26 11:24:55 -070071 const std::vector<webrtc::RtpExtension>& extensions,
solenberg7e4e01a2015-12-02 08:05:01 -080072 bool (*supported)(const std::string&),
73 bool filter_redundant_extensions);
Stefan Holmerbbaf3632015-10-29 18:53:23 +010074
Sebastian Janssonfc8d26b2018-02-21 09:52:06 +010075webrtc::BitrateConstraints GetBitrateConfigForCodec(const Codec& codec);
stefan13f1a0a2016-11-30 07:22:58 -080076
buildbot@webrtc.orgbb2d6582014-06-20 14:58:56 +000077} // namespace cricket
78
Steve Anton10542f22019-01-11 09:11:00 -080079#endif // MEDIA_ENGINE_WEBRTC_MEDIA_ENGINE_H_