Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Unified Diff: webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h

Issue 2524923002: Remove RTPPayloadStrategy and simplify RTPPayloadRegistry (Closed)
Patch Set: Keep old interface public to allow external code to migrate. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/BUILD.gn ('k') | webrtc/modules/rtp_rtcp/source/mock/mock_rtp_payload_strategy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h
diff --git a/webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h b/webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h
index 8f9d5829f9cc066c0416d991994205af4d38fe24..668fe876f2e326b90b2ea118d7e99918ef68180f 100644
--- a/webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h
+++ b/webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h
@@ -25,46 +25,24 @@ namespace webrtc {
struct CodecInst;
class VideoCodec;
-// This strategy deals with the audio/video-specific aspects
-// of payload handling.
+// TODO(magjed): Remove once external code is updated.
class RTPPayloadStrategy {
public:
- virtual ~RTPPayloadStrategy() {}
-
- virtual bool CodecsMustBeUnique() const = 0;
-
- virtual bool PayloadIsCompatible(const RtpUtility::Payload& payload,
- uint32_t frequency,
- size_t channels,
- uint32_t rate) const = 0;
-
- virtual void UpdatePayloadRate(RtpUtility::Payload* payload,
- uint32_t rate) const = 0;
-
- virtual RtpUtility::Payload* CreatePayloadType(const char* payload_name,
- int8_t payload_type,
- uint32_t frequency,
- size_t channels,
- uint32_t rate) const = 0;
-
- virtual int GetPayloadTypeFrequency(
- const RtpUtility::Payload& payload) const = 0;
-
- static RTPPayloadStrategy* CreateStrategy(bool handling_audio);
-
- protected:
- RTPPayloadStrategy() {}
+ static RTPPayloadStrategy* CreateStrategy(bool handling_audio) {
+ return nullptr;
+ }
};
class RTPPayloadRegistry {
public:
- // The registry takes ownership of the strategy.
- explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy);
+ RTPPayloadRegistry();
~RTPPayloadRegistry();
+ // TODO(magjed): Remove once external code is updated.
+ explicit RTPPayloadRegistry(RTPPayloadStrategy* rtp_payload_strategy)
+ : RTPPayloadRegistry() {}
// TODO(magjed): Split RTPPayloadRegistry into separate Audio and Video class
- // and remove RTPPayloadStrategy, RTPPayloadVideoStrategy,
- // RTPPayloadAudioStrategy, and simplify the code. http://crbug/webrtc/6743.
+ // and simplify the code. http://crbug/webrtc/6743.
int32_t RegisterReceivePayload(const CodecInst& audio_codec,
bool* created_new_payload_type);
int32_t RegisterReceivePayload(const VideoCodec& video_codec);
@@ -118,13 +96,9 @@ class RTPPayloadRegistry {
// Returns true if the new media payload type has not changed.
bool ReportMediaPayloadType(uint8_t media_payload_type);
- int8_t red_payload_type() const {
- rtc::CritScope cs(&crit_sect_);
- return red_payload_type_;
- }
+ int8_t red_payload_type() const { return GetPayloadTypeWithName("red"); }
int8_t ulpfec_payload_type() const {
- rtc::CritScope cs(&crit_sect_);
- return ulpfec_payload_type_;
+ return GetPayloadTypeWithName("ulpfec");
}
int8_t last_received_payload_type() const {
rtc::CritScope cs(&crit_sect_);
@@ -143,34 +117,17 @@ class RTPPayloadRegistry {
RTC_DEPRECATED void set_use_rtx_payload_mapping_on_restore(bool val) {}
private:
- int32_t RegisterReceivePayload(const char* payload_name,
- int8_t payload_type,
- uint32_t frequency,
- size_t channels,
- uint32_t rate,
- bool* created_new_payload_type);
-
- int32_t ReceivePayloadType(const char* payload_name,
- uint32_t frequency,
- size_t channels,
- uint32_t rate,
- int8_t* payload_type) const;
-
// Prunes the payload type map of the specific payload type, if it exists.
void DeregisterAudioCodecOrRedTypeRegardlessOfPayloadType(
- const char* payload_name,
- size_t payload_name_length,
- uint32_t frequency,
- size_t channels,
- uint32_t rate);
+ const CodecInst& audio_codec);
bool IsRtxInternal(const RTPHeader& header) const;
+ // Returns the payload type for the payload with name |payload_name|, or -1 if
+ // no such payload is registered.
+ int8_t GetPayloadTypeWithName(const char* payload_name) const;
rtc::CriticalSection crit_sect_;
- RtpUtility::PayloadTypeMap payload_type_map_;
- std::unique_ptr<RTPPayloadStrategy> rtp_payload_strategy_;
- int8_t red_payload_type_;
- int8_t ulpfec_payload_type_;
+ std::map<int, RtpUtility::Payload> payload_type_map_;
int8_t incoming_payload_type_;
int8_t last_received_payload_type_;
int8_t last_received_media_payload_type_;
« no previous file with comments | « webrtc/modules/rtp_rtcp/BUILD.gn ('k') | webrtc/modules/rtp_rtcp/source/mock/mock_rtp_payload_strategy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698