Skip to content

Commit ce500f3

Browse files
committed
Bug 1894137 - Add MimeType method to codec configs;r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D250587
1 parent d02bdfc commit ce500f3

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

dom/media/webrtc/libwebrtcglue/CodecConfig.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <string>
1010
#include <vector>
11+
#include <sstream>
1112

1213
#include "common/EncodingConstraints.h"
1314
#include "jsep/JsepCodecDescription.h"
@@ -42,7 +43,7 @@ struct AudioCodecConfig {
4243
AudioCodecConfig(int type, std::string name, int freq, int channels,
4344
bool FECEnabled)
4445
: mType(type),
45-
mName(name),
46+
mName(std::move(name)),
4647
mFreq(freq),
4748
mChannels(channels),
4849
mFECEnabled(FECEnabled),
@@ -68,6 +69,12 @@ struct AudioCodecConfig {
6869
mMaxPlaybackRate == aOther.mMaxPlaybackRate &&
6970
mCbrEnabled == aOther.mCbrEnabled;
7071
}
72+
73+
std::string MimeType() {
74+
std::stringstream ss;
75+
ss << "audio/" << mName;
76+
return ss.str();
77+
}
7178
};
7279

7380
/*
@@ -238,6 +245,12 @@ class VideoCodecConfig {
238245
bool RtcpFbTransportCCIsSet() const { return mTransportCCFbSet; }
239246

240247
bool RtxPayloadTypeIsSet() const { return mRTXPayloadType != -1; }
248+
249+
std::string MimeType() {
250+
std::stringstream ss;
251+
ss << "video/" << mName;
252+
return ss.str();
253+
}
241254
};
242255
} // namespace mozilla
243256
#endif

0 commit comments

Comments
 (0)