blob: 55f29b71bdbaa02ef50dfb67c5a1356a106b8c61 [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
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MEDIA_ENGINE_WEBRTCMEDIAENGINE_H_
12#define MEDIA_ENGINE_WEBRTCMEDIAENGINE_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"
19#include "media/base/mediaengine.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;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000028}
29namespace cricket {
30class WebRtcVideoDecoderFactory;
31class WebRtcVideoEncoderFactory;
32}
33
buildbot@webrtc.org58e7c862014-06-20 00:26:50 +000034namespace cricket {
35
henrike@webrtc.org0481f152014-08-19 14:56:59 +000036class WebRtcMediaEngineFactory {
buildbot@webrtc.org58e7c862014-06-20 00:26:50 +000037 public:
deadbeefeb02c032017-06-15 08:29:25 -070038 // These Create methods may be called on any thread, though the engine is
39 // only expected to be used on one thread, internally called the "worker
40 // thread". This is the thread Init must be called on.
Karl Wiberg5478b472017-11-03 11:28:17 +010041 //
deadbeef112b2e92017-02-10 20:13:37 -080042 // TODO(deadbeef): Change these to return an std::unique_ptr<>, to indicate
43 // that the caller owns the returned object.
henrike@webrtc.org0481f152014-08-19 14:56:59 +000044 static MediaEngineInterface* Create(
buildbot@webrtc.org58e7c862014-06-20 00:26:50 +000045 webrtc::AudioDeviceModule* adm,
ossueb1fde42017-05-02 06:46:30 -070046 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>&
47 audio_encoder_factory,
48 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
49 audio_decoder_factory,
50 WebRtcVideoEncoderFactory* video_encoder_factory,
51 WebRtcVideoDecoderFactory* video_decoder_factory);
ossueb1fde42017-05-02 06:46:30 -070052 static MediaEngineInterface* Create(
53 webrtc::AudioDeviceModule* adm,
54 const rtc::scoped_refptr<webrtc::AudioEncoderFactory>&
55 audio_encoder_factory,
56 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>&
57 audio_decoder_factory,
58 WebRtcVideoEncoderFactory* video_encoder_factory,
59 WebRtcVideoDecoderFactory* video_decoder_factory,
peaha9cc40b2017-06-29 08:32:09 -070060 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
61 rtc::scoped_refptr<webrtc::AudioProcessing> apm);
Magnus Jedvert58b03162017-09-15 19:02:47 +020062
63 // Create a MediaEngineInterface with optional video codec factories. These
64 // video factories represents all video codecs, i.e. no extra internal video
65 // codecs will be added.
66 static std::unique_ptr<MediaEngineInterface> Create(
67 rtc::scoped_refptr<webrtc::AudioDeviceModule> adm,
68 rtc::scoped_refptr<webrtc::AudioEncoderFactory> audio_encoder_factory,
69 rtc::scoped_refptr<webrtc::AudioDecoderFactory> audio_decoder_factory,
70 std::unique_ptr<webrtc::VideoEncoderFactory> video_encoder_factory,
71 std::unique_ptr<webrtc::VideoDecoderFactory> video_decoder_factory,
72 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
73 rtc::scoped_refptr<webrtc::AudioProcessing> audio_processing);
buildbot@webrtc.orgbb2d6582014-06-20 14:58:56 +000074};
75
solenberg7e4e01a2015-12-02 08:05:01 -080076// Verify that extension IDs are within 1-byte extension range and are not
77// overlapping.
isheriff6f8d6862016-05-26 11:24:55 -070078bool ValidateRtpExtensions(const std::vector<webrtc::RtpExtension>& extensions);
Stefan Holmerbbaf3632015-10-29 18:53:23 +010079
isheriff6f8d6862016-05-26 11:24:55 -070080// Discard any extensions not validated by the 'supported' predicate. Duplicate
solenberg7e4e01a2015-12-02 08:05:01 -080081// extensions are removed if 'filter_redundant_extensions' is set, and also any
isheriff6f8d6862016-05-26 11:24:55 -070082// mutually exclusive extensions (see implementation for details) are removed.
solenberg7e4e01a2015-12-02 08:05:01 -080083std::vector<webrtc::RtpExtension> FilterRtpExtensions(
isheriff6f8d6862016-05-26 11:24:55 -070084 const std::vector<webrtc::RtpExtension>& extensions,
solenberg7e4e01a2015-12-02 08:05:01 -080085 bool (*supported)(const std::string&),
86 bool filter_redundant_extensions);
Stefan Holmerbbaf3632015-10-29 18:53:23 +010087
Sebastian Janssonfc8d26b2018-02-21 09:52:06 +010088webrtc::BitrateConstraints GetBitrateConfigForCodec(const Codec& codec);
stefan13f1a0a2016-11-30 07:22:58 -080089
buildbot@webrtc.orgbb2d6582014-06-20 14:58:56 +000090} // namespace cricket
91
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020092#endif // MEDIA_ENGINE_WEBRTCMEDIAENGINE_H_