Add conversion from webrtc::SdpVideoFormat to cricket::VideoCodec
We will have to convert from webrtc::SdpVideoFormat to cricket::VideoCodec in a couple of places until cricket::WebRtcVideoEncoderFactory is gone. It will be convenient to have the conversion logic in a common place. Bug: webrtc:7925 Change-Id: Ie5e88599f28aeea647e936300c04f9071daffd53 Reviewed-on: https://webrtc-review.googlesource.com/4840 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20048}
This commit is contained in:
parent
d4a790fbea
commit
024d8970a7
@ -231,6 +231,11 @@ VideoCodec::VideoCodec() : Codec() {
|
||||
clockrate = kVideoCodecClockrate;
|
||||
}
|
||||
|
||||
VideoCodec::VideoCodec(const webrtc::SdpVideoFormat& c)
|
||||
: Codec(0 /* id */, c.name, kVideoCodecClockrate) {
|
||||
params = c.parameters;
|
||||
}
|
||||
|
||||
VideoCodec::VideoCodec(const VideoCodec& c) = default;
|
||||
VideoCodec::VideoCodec(VideoCodec&& c) = default;
|
||||
VideoCodec& VideoCodec::operator=(const VideoCodec& c) = default;
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "api/rtpparameters.h"
|
||||
#include "api/video_codecs/sdp_video_format.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
#include "media/base/mediaconstants.h"
|
||||
|
||||
@ -176,6 +177,7 @@ struct VideoCodec : public Codec {
|
||||
// Creates an empty codec.
|
||||
VideoCodec();
|
||||
VideoCodec(const VideoCodec& c);
|
||||
explicit VideoCodec(const webrtc::SdpVideoFormat& c);
|
||||
VideoCodec(VideoCodec&& c);
|
||||
~VideoCodec() override = default;
|
||||
|
||||
|
||||
@ -153,10 +153,7 @@ class WebRtcEncoderFactoryAdapter : public EncoderFactoryAdapter {
|
||||
std::vector<VideoCodec> codecs;
|
||||
for (const webrtc::SdpVideoFormat& format :
|
||||
encoder_factory_->GetSupportedFormats()) {
|
||||
VideoCodec codec;
|
||||
codec.name = format.name;
|
||||
codec.params = format.parameters;
|
||||
codecs.push_back(codec);
|
||||
codecs.push_back(VideoCodec(format));
|
||||
}
|
||||
return AssignPayloadTypesAndAddAssociatedRtxCodecs(codecs);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user