-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to by pass audio encoder if pre-encoded set #120
base: m114_release
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,17 +210,6 @@ int32_t AudioTransportImpl::NeedMorePlayData(const size_t nSamples, | |
int64_t* elapsed_time_ms, | ||
int64_t* ntp_time_ms) { | ||
TRACE_EVENT0("webrtc", "AudioTransportImpl::SendProcessedData"); | ||
RTC_DCHECK_EQ(sizeof(int16_t) * nChannels, nBytesPerSample); | ||
RTC_DCHECK_GE(nChannels, 1); | ||
RTC_DCHECK_LE(nChannels, 2); | ||
RTC_DCHECK_GE( | ||
samplesPerSec, | ||
static_cast<uint32_t>(AudioProcessing::NativeRate::kSampleRate8kHz)); | ||
|
||
// 100 = 1 second / data duration (10 ms). | ||
RTC_DCHECK_EQ(nSamples * 100, samplesPerSec); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do these checks prevent using pre-encoded data? Since it's on the receive end, seems like this should be unaffected? In particular, dropping the 10ms rule seems like a pretty big deal since it's assumed fairly throughout the system that play data would be given in 10ms chunks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll double check the samples one (it should be fine). For sure if you link rust-sdk examples with debug version of webrtc it will crash in this place, so I commented this block for testing purpose.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also worried about OggReader where we have:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can change that to be 10. since webrtc's internal clock for audio is 10ms |
||
RTC_DCHECK_LE(nBytesPerSample * nSamples * nChannels, | ||
AudioFrame::kMaxDataSizeBytes); | ||
|
||
mixer_->Mix(nChannels, &mixed_frame_); | ||
*elapsed_time_ms = mixed_frame_.elapsed_time_ms_; | ||
|
@@ -229,12 +218,10 @@ int32_t AudioTransportImpl::NeedMorePlayData(const size_t nSamples, | |
if (audio_processing_) { | ||
const auto error = | ||
ProcessReverseAudioFrame(audio_processing_, &mixed_frame_); | ||
RTC_DCHECK_EQ(error, AudioProcessing::kNoError); | ||
} | ||
|
||
nSamplesOut = Resample(mixed_frame_, samplesPerSec, &render_resampler_, | ||
static_cast<int16_t*>(audioSamples)); | ||
RTC_DCHECK_EQ(nSamplesOut, nChannels * nSamples); | ||
return 0; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is endianess an issue here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assumed we will have decoder (and this is how I tested), so the most important was to be consistent with decoder.
Otherwise, this is good question. I think I'll convert it to Little Endian (as more popular architecture). Another alternative is to rely on real architecture (by using C like union implementation) or expose this information as part of API, but It may look too complicated, because who knows what output SDP device will decode it.