Updated AudioDecoderFactory to list AudioCodecSpecs instead of SdpAudioFormats.
BUG=webrtc:5805 Review-Url: https://codereview.webrtc.org/2123923004 Cr-Commit-Position: refs/heads/master@{#13810}
This commit is contained in:
@ -25,7 +25,7 @@ namespace webrtc {
|
||||
// NOTE: This class is still under development and may change without notice.
|
||||
class AudioDecoderFactory : public rtc::RefCountInterface {
|
||||
public:
|
||||
virtual std::vector<SdpAudioFormat> GetSupportedFormats() = 0;
|
||||
virtual std::vector<AudioCodecSpec> GetSupportedDecoders() = 0;
|
||||
|
||||
virtual std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
const SdpAudioFormat& format) = 0;
|
||||
|
||||
@ -39,12 +39,17 @@ struct SdpAudioFormat {
|
||||
int clockrate_hz;
|
||||
int num_channels;
|
||||
Parameters parameters;
|
||||
// Parameters feedback_parameters; ??
|
||||
};
|
||||
|
||||
void swap(SdpAudioFormat& a, SdpAudioFormat& b);
|
||||
std::ostream& operator<<(std::ostream& os, const SdpAudioFormat& saf);
|
||||
|
||||
struct AudioCodecSpec {
|
||||
SdpAudioFormat format;
|
||||
bool allow_comfort_noise; // This encoder can be used with an external
|
||||
// comfort noise generator.
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_FORMAT_H_
|
||||
|
||||
@ -129,32 +129,33 @@ NamedDecoderConstructor decoder_constructors[] = {
|
||||
|
||||
class BuiltinAudioDecoderFactory : public AudioDecoderFactory {
|
||||
public:
|
||||
std::vector<SdpAudioFormat> GetSupportedFormats() override {
|
||||
static std::vector<SdpAudioFormat> formats = {
|
||||
std::vector<AudioCodecSpec> GetSupportedDecoders() override {
|
||||
static std::vector<AudioCodecSpec> specs = {
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
{ "opus", 48000, 2, {
|
||||
{"minptime", "10" },
|
||||
{"useinbandfec", "1" }
|
||||
}
|
||||
{ { "opus", 48000, 2, {
|
||||
{"minptime", "10" },
|
||||
{"useinbandfec", "1" }
|
||||
}
|
||||
}, false
|
||||
},
|
||||
#endif
|
||||
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
|
||||
{ "isac", 16000, 1 },
|
||||
{ { "isac", 16000, 1 }, true },
|
||||
#endif
|
||||
#if (defined(WEBRTC_CODEC_ISAC))
|
||||
{ "isac", 32000, 1 },
|
||||
{ { "isac", 32000, 1 }, true },
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
{ "G722", 8000, 1 },
|
||||
{ { "G722", 8000, 1 }, true },
|
||||
#endif
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
{ "iLBC", 8000, 1 },
|
||||
{ { "iLBC", 8000, 1 }, true },
|
||||
#endif
|
||||
{ "PCMU", 8000, 1 },
|
||||
{ "PCMA", 8000, 1 }
|
||||
{ { "PCMU", 8000, 1 }, true },
|
||||
{ { "PCMA", 8000, 1 }, true }
|
||||
};
|
||||
|
||||
return formats;
|
||||
return specs;
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
|
||||
@ -21,7 +21,7 @@ namespace webrtc {
|
||||
|
||||
class MockAudioDecoderFactory : public AudioDecoderFactory {
|
||||
public:
|
||||
MOCK_METHOD0(GetSupportedFormats, std::vector<SdpAudioFormat>());
|
||||
MOCK_METHOD0(GetSupportedDecoders, std::vector<AudioCodecSpec>());
|
||||
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
const SdpAudioFormat& format) {
|
||||
std::unique_ptr<AudioDecoder> return_value;
|
||||
@ -43,9 +43,9 @@ class MockAudioDecoderFactory : public AudioDecoderFactory {
|
||||
|
||||
rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> factory =
|
||||
new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>;
|
||||
ON_CALL(*factory.get(), GetSupportedFormats())
|
||||
.WillByDefault(Return(std::vector<webrtc::SdpAudioFormat>()));
|
||||
EXPECT_CALL(*factory.get(), GetSupportedFormats()).Times(AnyNumber());
|
||||
ON_CALL(*factory.get(), GetSupportedDecoders())
|
||||
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
||||
EXPECT_CALL(*factory.get(), GetSupportedDecoders()).Times(AnyNumber());
|
||||
EXPECT_CALL(*factory.get(), MakeAudioDecoderMock(_, _)).Times(0);
|
||||
return factory;
|
||||
}
|
||||
@ -62,9 +62,9 @@ class MockAudioDecoderFactory : public AudioDecoderFactory {
|
||||
|
||||
rtc::scoped_refptr<webrtc::MockAudioDecoderFactory> factory =
|
||||
new rtc::RefCountedObject<webrtc::MockAudioDecoderFactory>;
|
||||
ON_CALL(*factory.get(), GetSupportedFormats())
|
||||
.WillByDefault(Return(std::vector<webrtc::SdpAudioFormat>()));
|
||||
EXPECT_CALL(*factory.get(), GetSupportedFormats()).Times(AnyNumber());
|
||||
ON_CALL(*factory.get(), GetSupportedDecoders())
|
||||
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
||||
EXPECT_CALL(*factory.get(), GetSupportedDecoders()).Times(AnyNumber());
|
||||
ON_CALL(*factory.get(), MakeAudioDecoderMock(_, _))
|
||||
.WillByDefault(SetArgPointee<1>(nullptr));
|
||||
EXPECT_CALL(*factory.get(), MakeAudioDecoderMock(_, _)).Times(AnyNumber());
|
||||
|
||||
Reference in New Issue
Block a user