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

Unified Diff: media/cast/rtp_receiver/rtp_receiver.cc

Issue 250363002: [Cast] Clean-up RtpCastHeader and RtpParser, removing the last WebRTC dependency. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed hubbe's comment. Created 6 years, 8 months 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 | « media/cast/rtp_receiver/rtp_receiver.h ('k') | media/cast/rtp_receiver/rtp_receiver_defines.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/rtp_receiver/rtp_receiver.cc
diff --git a/media/cast/rtp_receiver/rtp_receiver.cc b/media/cast/rtp_receiver/rtp_receiver.cc
index f6402616273cabc67fefe73ebcb831e4824a95bc..2f95bf3b6679071e51d3294397159df530bbf013 100644
--- a/media/cast/rtp_receiver/rtp_receiver.cc
+++ b/media/cast/rtp_receiver/rtp_receiver.cc
@@ -13,33 +13,15 @@
namespace media {
namespace cast {
-namespace {
-
-static RtpParserConfig GetRtpParserConfig(
- const AudioReceiverConfig* audio_config,
- const VideoReceiverConfig* video_config) {
- RtpParserConfig config;
- DCHECK(audio_config || video_config) << "Invalid argument";
- if (audio_config) {
- config.ssrc = audio_config->incoming_ssrc;
- config.payload_type = audio_config->rtp_payload_type;
- config.audio_codec = audio_config->codec;
- config.audio_channels = audio_config->channels;
- } else {
- config.ssrc = video_config->incoming_ssrc;
- config.payload_type = video_config->rtp_payload_type;
- config.video_codec = video_config->codec;
- }
- return config;
-}
-
-} // namespace
-
RtpReceiver::RtpReceiver(base::TickClock* clock,
const AudioReceiverConfig* audio_config,
const VideoReceiverConfig* video_config) :
- RtpParser(GetRtpParserConfig(audio_config, video_config)),
+ packet_parser_(audio_config ? audio_config->incoming_ssrc :
+ (video_config ? video_config->incoming_ssrc : 0),
+ audio_config ? audio_config->rtp_payload_type :
+ (video_config ? video_config->rtp_payload_type : 0)),
stats_(clock) {
+ DCHECK(audio_config || video_config);
}
RtpReceiver::~RtpReceiver() {}
@@ -57,9 +39,14 @@ uint32 RtpReceiver::GetSsrcOfSender(const uint8* rtcp_buffer, size_t length) {
bool RtpReceiver::ReceivedPacket(const uint8* packet, size_t length) {
RtpCastHeader rtp_header;
- if (!ParsePacket(packet, length, &rtp_header))
+ const uint8* payload_data;
+ size_t payload_size;
+ if (!packet_parser_.ParsePacket(
+ packet, length, &rtp_header, &payload_data, &payload_size)) {
return false;
+ }
+ OnReceivedPayloadData(payload_data, payload_size, rtp_header);
stats_.UpdateStatistics(rtp_header);
return true;
}
« no previous file with comments | « media/cast/rtp_receiver/rtp_receiver.h ('k') | media/cast/rtp_receiver/rtp_receiver_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698