webrtc_m130/modules/rtp_rtcp/source/rtp_payload_registry_unittest.cc

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

266 lines
10 KiB
C++
Raw Normal View History

/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "common_types.h"
#include "modules/rtp_rtcp/include/rtp_header_parser.h"
#include "modules/rtp_rtcp/include/rtp_payload_registry.h"
#include "modules/rtp_rtcp/source/rtp_utility.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
using ::testing::Eq;
using ::testing::Return;
using ::testing::StrEq;
using ::testing::_;
static const char* kTypicalPayloadName = "name";
static const size_t kTypicalChannels = 1;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
static const uint32_t kTypicalFrequency = 44000;
static const CodecInst kTypicalAudioCodec = {-1 /* pltype */, "name",
kTypicalFrequency, 0 /* pacsize */,
kTypicalChannels};
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
TEST(RtpPayloadRegistryTest,
RegistersAndRemembersVideoPayloadsUntilDeregistered) {
RTPPayloadRegistry rtp_payload_registry;
const uint8_t payload_type = 97;
VideoCodec video_codec;
video_codec.codecType = kVideoCodecVP8;
strncpy(video_codec.plName, "VP8", RTP_PAYLOAD_NAME_SIZE);
video_codec.plType = payload_type;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0, rtp_payload_registry.RegisterReceivePayload(video_codec));
const RtpUtility::Payload* retrieved_payload =
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
rtp_payload_registry.PayloadTypeToPayload(payload_type);
EXPECT_TRUE(retrieved_payload);
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
// We should get back the corresponding payload that we registered.
EXPECT_STREQ("VP8", retrieved_payload->name);
EXPECT_FALSE(retrieved_payload->audio);
EXPECT_EQ(kRtpVideoVp8, retrieved_payload->typeSpecific.Video.videoCodecType);
// Now forget about it and verify it's gone.
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0, rtp_payload_registry.DeRegisterReceivePayload(payload_type));
EXPECT_FALSE(rtp_payload_registry.PayloadTypeToPayload(payload_type));
}
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
TEST(RtpPayloadRegistryTest,
RegistersAndRemembersAudioPayloadsUntilDeregistered) {
RTPPayloadRegistry rtp_payload_registry;
uint8_t payload_type = 97;
bool new_payload_created = false;
CodecInst audio_codec = kTypicalAudioCodec;
audio_codec.pltype = payload_type;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0, rtp_payload_registry.RegisterReceivePayload(
audio_codec, &new_payload_created));
EXPECT_TRUE(new_payload_created) << "A new payload WAS created.";
const RtpUtility::Payload* retrieved_payload =
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
rtp_payload_registry.PayloadTypeToPayload(payload_type);
EXPECT_TRUE(retrieved_payload);
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
// We should get back the corresponding payload that we registered.
EXPECT_STREQ(kTypicalPayloadName, retrieved_payload->name);
EXPECT_TRUE(retrieved_payload->audio);
EXPECT_EQ(kTypicalFrequency, retrieved_payload->typeSpecific.Audio.frequency);
EXPECT_EQ(kTypicalChannels, retrieved_payload->typeSpecific.Audio.channels);
// Now forget about it and verify it's gone.
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0, rtp_payload_registry.DeRegisterReceivePayload(payload_type));
EXPECT_FALSE(rtp_payload_registry.PayloadTypeToPayload(payload_type));
}
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
TEST(RtpPayloadRegistryTest, AudioRedWorkProperly) {
const uint8_t kRedPayloadType = 127;
const int kRedSampleRate = 8000;
const size_t kRedChannels = 1;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
RTPPayloadRegistry rtp_payload_registry;
bool new_payload_created = false;
CodecInst red_audio_codec;
strncpy(red_audio_codec.plname, "red", RTP_PAYLOAD_NAME_SIZE);
red_audio_codec.pltype = kRedPayloadType;
red_audio_codec.plfreq = kRedSampleRate;
red_audio_codec.channels = kRedChannels;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0, rtp_payload_registry.RegisterReceivePayload(
red_audio_codec, &new_payload_created));
EXPECT_TRUE(new_payload_created);
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(kRedPayloadType, rtp_payload_registry.red_payload_type());
const RtpUtility::Payload* retrieved_payload =
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
rtp_payload_registry.PayloadTypeToPayload(kRedPayloadType);
EXPECT_TRUE(retrieved_payload);
EXPECT_TRUE(retrieved_payload->audio);
EXPECT_STRCASEEQ("red", retrieved_payload->name);
// Sample rate is correctly registered.
EXPECT_EQ(kRedSampleRate,
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
rtp_payload_registry.GetPayloadTypeFrequency(kRedPayloadType));
}
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
TEST(RtpPayloadRegistryTest,
DoesNotAcceptSamePayloadTypeTwiceExceptIfPayloadIsCompatible) {
uint8_t payload_type = 97;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
RTPPayloadRegistry rtp_payload_registry;
bool ignored = false;
CodecInst audio_codec = kTypicalAudioCodec;
audio_codec.pltype = payload_type;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0,
rtp_payload_registry.RegisterReceivePayload(audio_codec, &ignored));
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
CodecInst audio_codec_2 = kTypicalAudioCodec;
audio_codec_2.pltype = payload_type;
// Make |audio_codec_2| incompatible with |audio_codec| by changing
// the frequency.
audio_codec_2.plfreq = kTypicalFrequency + 1;
EXPECT_EQ(
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
-1, rtp_payload_registry.RegisterReceivePayload(audio_codec_2, &ignored))
<< "Adding incompatible codec with same payload type = bad.";
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
// Change payload type.
audio_codec_2.pltype = payload_type - 1;
EXPECT_EQ(
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
0, rtp_payload_registry.RegisterReceivePayload(audio_codec_2, &ignored))
<< "With a different payload type is fine though.";
// Ensure both payloads are preserved.
const RtpUtility::Payload* retrieved_payload =
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
rtp_payload_registry.PayloadTypeToPayload(payload_type);
EXPECT_TRUE(retrieved_payload);
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_STREQ(kTypicalPayloadName, retrieved_payload->name);
EXPECT_TRUE(retrieved_payload->audio);
EXPECT_EQ(kTypicalFrequency, retrieved_payload->typeSpecific.Audio.frequency);
EXPECT_EQ(kTypicalChannels, retrieved_payload->typeSpecific.Audio.channels);
retrieved_payload =
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
rtp_payload_registry.PayloadTypeToPayload(payload_type - 1);
EXPECT_TRUE(retrieved_payload);
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_STREQ(kTypicalPayloadName, retrieved_payload->name);
EXPECT_TRUE(retrieved_payload->audio);
EXPECT_EQ(kTypicalFrequency + 1,
retrieved_payload->typeSpecific.Audio.frequency);
EXPECT_EQ(kTypicalChannels, retrieved_payload->typeSpecific.Audio.channels);
// Ok, update the rate for one of the codecs. If either the incoming rate or
// the stored rate is zero it's not really an error to register the same
// codec twice, and in that case roughly the following happens.
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0,
rtp_payload_registry.RegisterReceivePayload(audio_codec, &ignored));
}
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
TEST(RtpPayloadRegistryTest,
RemovesCompatibleCodecsOnRegistryIfCodecsMustBeUnique) {
uint8_t payload_type = 97;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
RTPPayloadRegistry rtp_payload_registry;
bool ignored = false;
CodecInst audio_codec = kTypicalAudioCodec;
audio_codec.pltype = payload_type;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0,
rtp_payload_registry.RegisterReceivePayload(audio_codec, &ignored));
CodecInst audio_codec_2 = kTypicalAudioCodec;
audio_codec_2.pltype = payload_type - 1;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(
0, rtp_payload_registry.RegisterReceivePayload(audio_codec_2, &ignored));
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_FALSE(rtp_payload_registry.PayloadTypeToPayload(payload_type))
<< "The first payload should be "
"deregistered because the only thing that differs is payload type.";
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_TRUE(rtp_payload_registry.PayloadTypeToPayload(payload_type - 1))
<< "The second payload should still be registered though.";
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
// Now ensure non-compatible codecs aren't removed. Make |audio_codec_3|
// incompatible by changing the frequency.
CodecInst audio_codec_3 = kTypicalAudioCodec;
audio_codec_3.pltype = payload_type + 1;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
audio_codec_3.plfreq = kTypicalFrequency + 1;
EXPECT_EQ(
0, rtp_payload_registry.RegisterReceivePayload(audio_codec_3, &ignored));
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_TRUE(rtp_payload_registry.PayloadTypeToPayload(payload_type - 1))
<< "Not compatible; both payloads should be kept.";
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_TRUE(rtp_payload_registry.PayloadTypeToPayload(payload_type + 1))
<< "Not compatible; both payloads should be kept.";
}
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
TEST(RtpPayloadRegistryTest,
LastReceivedCodecTypesAreResetWhenRegisteringNewPayloadTypes) {
RTPPayloadRegistry rtp_payload_registry;
rtp_payload_registry.set_last_received_payload_type(17);
EXPECT_EQ(17, rtp_payload_registry.last_received_payload_type());
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
bool media_type_unchanged = rtp_payload_registry.ReportMediaPayloadType(18);
EXPECT_FALSE(media_type_unchanged);
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
media_type_unchanged = rtp_payload_registry.ReportMediaPayloadType(18);
EXPECT_TRUE(media_type_unchanged);
bool ignored;
CodecInst audio_codec = kTypicalAudioCodec;
audio_codec.pltype = 34;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0,
rtp_payload_registry.RegisterReceivePayload(audio_codec, &ignored));
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(-1, rtp_payload_registry.last_received_payload_type());
media_type_unchanged = rtp_payload_registry.ReportMediaPayloadType(18);
EXPECT_FALSE(media_type_unchanged);
}
class ParameterizedRtpPayloadRegistryTest
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
: public ::testing::TestWithParam<int> {};
TEST_P(ParameterizedRtpPayloadRegistryTest,
FailsToRegisterKnownPayloadsWeAreNotInterestedIn) {
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
RTPPayloadRegistry rtp_payload_registry;
bool ignored;
CodecInst audio_codec;
strncpy(audio_codec.plname, "whatever", RTP_PAYLOAD_NAME_SIZE);
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
audio_codec.pltype = GetParam();
audio_codec.plfreq = 1900;
audio_codec.channels = 1;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(-1,
rtp_payload_registry.RegisterReceivePayload(audio_codec, &ignored));
}
INSTANTIATE_TEST_CASE_P(TestKnownBadPayloadTypes,
ParameterizedRtpPayloadRegistryTest,
testing::Values(64, 72, 73, 74, 75, 76, 77, 78, 79));
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
class RtpPayloadRegistryGenericTest : public ::testing::TestWithParam<int> {};
TEST_P(RtpPayloadRegistryGenericTest, RegisterGenericReceivePayloadType) {
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
RTPPayloadRegistry rtp_payload_registry;
bool ignored;
CodecInst audio_codec;
// Dummy values, except for payload_type.
strncpy(audio_codec.plname, "generic-codec", RTP_PAYLOAD_NAME_SIZE);
audio_codec.pltype = GetParam();
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
audio_codec.plfreq = 1900;
audio_codec.channels = 1;
Reland of move RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #1 id:1 of https://codereview.webrtc.org/2528993002/ ) Reason for revert: Downstream code has been updated. Original issue's description: > Revert of Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (patchset #7 id:240001 of https://codereview.webrtc.org/2524923002/ ) > > Reason for revert: > Breaks downstream projects. > > Original issue's description: > > Remove RTPPayloadStrategy and simplify RTPPayloadRegistry > > > > This CL removes RTPPayloadStrategy that is currently used to handle > > audio/video specific aspects of payload handling. Instead, the audio and > > video specific aspects will now have different functions, with linear > > code flow. > > > > This CL does not contain any functional changes, and is just a > > preparation for future CL:s. > > > > The main purpose with this CL is to add this function: > > bool PayloadIsCompatible(const RtpUtility::Payload& payload, > > const webrtc::VideoCodec& video_codec); > > that can easily be extended in a future CL to look at video codec > > specific information. > > > > BUG=webrtc:6743 > > > > Committed: https://crrev.com/b881254dc86d2cc80a52e08155433458be002166 > > Cr-Commit-Position: refs/heads/master@{#15232} > > TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=webrtc:6743 > > Committed: https://crrev.com/33c81d05613f45f65ee17224ed381c6cdd1c6c6f > Cr-Commit-Position: refs/heads/master@{#15234} TBR=danilchap@webrtc.org,solenberg@webrtc.org,mflodman@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6743 Review-Url: https://codereview.webrtc.org/2531043002 Cr-Commit-Position: refs/heads/master@{#15245}
2016-11-25 06:40:25 -08:00
EXPECT_EQ(0,
rtp_payload_registry.RegisterReceivePayload(audio_codec, &ignored));
}
INSTANTIATE_TEST_CASE_P(TestDynamicRange,
RtpPayloadRegistryGenericTest,
testing::Range(96, 127 + 1));
} // namespace webrtc