Commit ff366f5d authored by anujk.sharma's avatar anujk.sharma Committed by Commit bot

Adding "rtp_timebase" variable in lieu of "frequency" for FrameReceiverConfig structure.

BUG=448025

Review URL: https://codereview.chromium.org/845993002

Cr-Commit-Position: refs/heads/master@{#311541}
parent c3d19a5c
...@@ -176,7 +176,7 @@ class TestPatternReceiver : public media::cast::InProcessReceiver { ...@@ -176,7 +176,7 @@ class TestPatternReceiver : public media::cast::InProcessReceiver {
} }
crossings /= audio_frame->channels(); // Take the average. crossings /= audio_frame->channels(); // Take the average.
const float seconds_per_frame = const float seconds_per_frame =
audio_frame->frames() / static_cast<float>(audio_config().frequency); audio_frame->frames() / static_cast<float>(audio_config().rtp_timebase);
const float frequency = crossings / seconds_per_frame / 2.0f; const float frequency = crossings / seconds_per_frame / 2.0f;
VLOG(1) << "Current audio tone frequency: " << frequency; VLOG(1) << "Current audio tone frequency: " << frequency;
......
...@@ -65,7 +65,7 @@ FrameReceiverConfig::FrameReceiverConfig() ...@@ -65,7 +65,7 @@ FrameReceiverConfig::FrameReceiverConfig()
rtcp_interval(kDefaultRtcpIntervalMs), rtcp_interval(kDefaultRtcpIntervalMs),
rtp_max_delay_ms(kDefaultRtpMaxDelayMs), rtp_max_delay_ms(kDefaultRtpMaxDelayMs),
rtp_payload_type(0), rtp_payload_type(0),
frequency(0), rtp_timebase(0),
channels(0), channels(0),
target_frame_rate(0), target_frame_rate(0),
codec(CODEC_UNKNOWN) {} codec(CODEC_UNKNOWN) {}
......
...@@ -136,7 +136,7 @@ struct FrameReceiverConfig { ...@@ -136,7 +136,7 @@ struct FrameReceiverConfig {
// RTP timebase: The number of RTP units advanced per one second. For audio, // RTP timebase: The number of RTP units advanced per one second. For audio,
// this is the sampling rate. For video, by convention, this is 90 kHz. // this is the sampling rate. For video, by convention, this is 90 kHz.
int frequency; // TODO(miu): Rename to rtp_timebase for clarity. int rtp_timebase;
// Number of channels. For audio, this is normally 2. For video, this must // Number of channels. For audio, this is normally 2. For video, this must
// be 1 as Cast does not have support for stereoscopic video. // be 1 as Cast does not have support for stereoscopic video.
......
...@@ -36,7 +36,7 @@ CastReceiverImpl::CastReceiverImpl( ...@@ -36,7 +36,7 @@ CastReceiverImpl::CastReceiverImpl(
ssrc_of_audio_sender_(audio_config.incoming_ssrc), ssrc_of_audio_sender_(audio_config.incoming_ssrc),
ssrc_of_video_sender_(video_config.incoming_ssrc), ssrc_of_video_sender_(video_config.incoming_ssrc),
num_audio_channels_(audio_config.channels), num_audio_channels_(audio_config.channels),
audio_sampling_rate_(audio_config.frequency), audio_sampling_rate_(audio_config.rtp_timebase),
audio_codec_(audio_config.codec), audio_codec_(audio_config.codec),
video_codec_(video_config.codec) {} video_codec_(video_config.codec) {}
......
...@@ -30,7 +30,7 @@ FrameReceiver::FrameReceiver( ...@@ -30,7 +30,7 @@ FrameReceiver::FrameReceiver(
stats_(cast_environment->Clock()), stats_(cast_environment->Clock()),
event_media_type_(event_media_type), event_media_type_(event_media_type),
event_subscriber_(kReceiverRtcpEventHistorySize, event_media_type), event_subscriber_(kReceiverRtcpEventHistorySize, event_media_type),
rtp_timebase_(config.frequency), rtp_timebase_(config.rtp_timebase),
target_playout_delay_( target_playout_delay_(
base::TimeDelta::FromMilliseconds(config.rtp_max_delay_ms)), base::TimeDelta::FromMilliseconds(config.rtp_max_delay_ms)),
expected_frame_duration_( expected_frame_duration_(
......
...@@ -120,7 +120,7 @@ class FrameReceiverTest : public ::testing::Test { ...@@ -120,7 +120,7 @@ class FrameReceiverTest : public ::testing::Test {
void FeedLipSyncInfoIntoReceiver() { void FeedLipSyncInfoIntoReceiver() {
const base::TimeTicks now = testing_clock_->NowTicks(); const base::TimeTicks now = testing_clock_->NowTicks();
const int64 rtp_timestamp = (now - start_time_) * const int64 rtp_timestamp = (now - start_time_) *
config_.frequency / base::TimeDelta::FromSeconds(1); config_.rtp_timebase / base::TimeDelta::FromSeconds(1);
CHECK_LE(0, rtp_timestamp); CHECK_LE(0, rtp_timestamp);
uint32 ntp_seconds; uint32 ntp_seconds;
uint32 ntp_fraction; uint32 ntp_fraction;
...@@ -217,7 +217,7 @@ TEST_F(FrameReceiverTest, ReceivesFramesSkippingWhenAppropriate) { ...@@ -217,7 +217,7 @@ TEST_F(FrameReceiverTest, ReceivesFramesSkippingWhenAppropriate) {
.WillRepeatedly(testing::Return()); .WillRepeatedly(testing::Return());
const uint32 rtp_advance_per_frame = const uint32 rtp_advance_per_frame =
config_.frequency / config_.target_frame_rate; config_.rtp_timebase / config_.target_frame_rate;
const base::TimeDelta time_advance_per_frame = const base::TimeDelta time_advance_per_frame =
base::TimeDelta::FromSeconds(1) / config_.target_frame_rate; base::TimeDelta::FromSeconds(1) / config_.target_frame_rate;
...@@ -320,7 +320,7 @@ TEST_F(FrameReceiverTest, ReceivesFramesRefusingToSkipAny) { ...@@ -320,7 +320,7 @@ TEST_F(FrameReceiverTest, ReceivesFramesRefusingToSkipAny) {
.WillRepeatedly(testing::Return()); .WillRepeatedly(testing::Return());
const uint32 rtp_advance_per_frame = const uint32 rtp_advance_per_frame =
config_.frequency / config_.target_frame_rate; config_.rtp_timebase / config_.target_frame_rate;
const base::TimeDelta time_advance_per_frame = const base::TimeDelta time_advance_per_frame =
base::TimeDelta::FromSeconds(1) / config_.target_frame_rate; base::TimeDelta::FromSeconds(1) / config_.target_frame_rate;
......
...@@ -254,7 +254,7 @@ class RunOneBenchmark { ...@@ -254,7 +254,7 @@ class RunOneBenchmark {
audio_receiver_config_.incoming_ssrc = audio_sender_config_.ssrc; audio_receiver_config_.incoming_ssrc = audio_sender_config_.ssrc;
audio_receiver_config_.rtp_payload_type = audio_receiver_config_.rtp_payload_type =
audio_sender_config_.rtp_payload_type; audio_sender_config_.rtp_payload_type;
audio_receiver_config_.frequency = audio_sender_config_.frequency; audio_receiver_config_.rtp_timebase = audio_sender_config_.frequency;
audio_receiver_config_.channels = kAudioChannels; audio_receiver_config_.channels = kAudioChannels;
audio_receiver_config_.target_frame_rate = 100; audio_receiver_config_.target_frame_rate = 100;
audio_receiver_config_.codec = audio_sender_config_.codec; audio_receiver_config_.codec = audio_sender_config_.codec;
...@@ -290,7 +290,7 @@ class RunOneBenchmark { ...@@ -290,7 +290,7 @@ class RunOneBenchmark {
video_receiver_config_.rtp_payload_type = video_receiver_config_.rtp_payload_type =
video_sender_config_.rtp_payload_type; video_sender_config_.rtp_payload_type;
video_receiver_config_.codec = video_sender_config_.codec; video_receiver_config_.codec = video_sender_config_.codec;
video_receiver_config_.frequency = kVideoFrequency; video_receiver_config_.rtp_timebase = kVideoFrequency;
video_receiver_config_.channels = 1; video_receiver_config_.channels = 1;
video_receiver_config_.target_frame_rate = 100; video_receiver_config_.target_frame_rate = 100;
video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs;
......
...@@ -486,13 +486,13 @@ class End2EndTest : public ::testing::Test { ...@@ -486,13 +486,13 @@ class End2EndTest : public ::testing::Test {
audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs;
audio_receiver_config_.rtp_payload_type = audio_receiver_config_.rtp_payload_type =
audio_sender_config_.rtp_payload_type; audio_sender_config_.rtp_payload_type;
audio_receiver_config_.frequency = audio_sender_config_.frequency; audio_receiver_config_.rtp_timebase = audio_sender_config_.frequency;
audio_receiver_config_.channels = kAudioChannels; audio_receiver_config_.channels = kAudioChannels;
audio_receiver_config_.target_frame_rate = 100; audio_receiver_config_.target_frame_rate = 100;
audio_receiver_config_.codec = audio_sender_config_.codec; audio_receiver_config_.codec = audio_sender_config_.codec;
test_receiver_audio_callback_->SetExpectedSamplingFrequency( test_receiver_audio_callback_->SetExpectedSamplingFrequency(
audio_receiver_config_.frequency); audio_receiver_config_.rtp_timebase);
video_sender_config_.ssrc = 3; video_sender_config_.ssrc = 3;
video_sender_config_.receiver_ssrc = 4; video_sender_config_.receiver_ssrc = 4;
...@@ -518,7 +518,7 @@ class End2EndTest : public ::testing::Test { ...@@ -518,7 +518,7 @@ class End2EndTest : public ::testing::Test {
video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs;
video_receiver_config_.rtp_payload_type = video_receiver_config_.rtp_payload_type =
video_sender_config_.rtp_payload_type; video_sender_config_.rtp_payload_type;
video_receiver_config_.frequency = kVideoFrequency; video_receiver_config_.rtp_timebase = kVideoFrequency;
video_receiver_config_.channels = 1; video_receiver_config_.channels = 1;
video_receiver_config_.target_frame_rate = video_receiver_config_.target_frame_rate =
video_sender_config_.max_frame_rate; video_sender_config_.max_frame_rate;
......
...@@ -152,10 +152,10 @@ FrameReceiverConfig GetVideoReceiverConfig() { ...@@ -152,10 +152,10 @@ FrameReceiverConfig GetVideoReceiverConfig() {
} }
AudioParameters ToAudioParameters(const FrameReceiverConfig& config) { AudioParameters ToAudioParameters(const FrameReceiverConfig& config) {
const int samples_in_10ms = config.frequency / 100; const int samples_in_10ms = config.rtp_timebase / 100;
return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
GuessChannelLayout(config.channels), GuessChannelLayout(config.channels),
config.frequency, 32, samples_in_10ms); config.rtp_timebase, 32, samples_in_10ms);
} }
// An InProcessReceiver that renders video frames to a LinuxOutputWindow and // An InProcessReceiver that renders video frames to a LinuxOutputWindow and
......
...@@ -31,7 +31,7 @@ FrameReceiverConfig GetDefaultAudioReceiverConfig() { ...@@ -31,7 +31,7 @@ FrameReceiverConfig GetDefaultAudioReceiverConfig() {
config.incoming_ssrc = 1; config.incoming_ssrc = 1;
config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs; config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs;
config.rtp_payload_type = 127; config.rtp_payload_type = 127;
config.frequency = 48000; config.rtp_timebase = 48000;
config.channels = 2; config.channels = 2;
config.target_frame_rate = 100; // 10ms of signal per frame config.target_frame_rate = 100; // 10ms of signal per frame
config.codec = media::cast::CODEC_AUDIO_OPUS; config.codec = media::cast::CODEC_AUDIO_OPUS;
...@@ -44,7 +44,7 @@ FrameReceiverConfig GetDefaultVideoReceiverConfig() { ...@@ -44,7 +44,7 @@ FrameReceiverConfig GetDefaultVideoReceiverConfig() {
config.incoming_ssrc = 11; config.incoming_ssrc = 11;
config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs; config.rtp_max_delay_ms = kDefaultRtpMaxDelayMs;
config.rtp_payload_type = 96; config.rtp_payload_type = 96;
config.frequency = kVideoFrequency; config.rtp_timebase = kVideoFrequency;
config.channels = 1; config.channels = 1;
config.target_frame_rate = kDefaultMaxFrameRate; config.target_frame_rate = kDefaultMaxFrameRate;
config.codec = media::cast::CODEC_VIDEO_VP8; config.codec = media::cast::CODEC_VIDEO_VP8;
...@@ -58,7 +58,7 @@ AudioSenderConfig GetDefaultAudioSenderConfig() { ...@@ -58,7 +58,7 @@ AudioSenderConfig GetDefaultAudioSenderConfig() {
config.receiver_ssrc = recv_config.feedback_ssrc; config.receiver_ssrc = recv_config.feedback_ssrc;
config.rtp_payload_type = recv_config.rtp_payload_type; config.rtp_payload_type = recv_config.rtp_payload_type;
config.use_external_encoder = false; config.use_external_encoder = false;
config.frequency = recv_config.frequency; config.frequency = recv_config.rtp_timebase;
config.channels = recv_config.channels; config.channels = recv_config.channels;
config.bitrate = kDefaultAudioEncoderBitrate; config.bitrate = kDefaultAudioEncoderBitrate;
config.codec = recv_config.codec; config.codec = recv_config.codec;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment