Revert 8749 "We changed Encode() and EncodeInternal() return typ..."
The reason is that this cl adds a static initializer so we can't roll webrtc into Chromium. See audio_encoder.cc and 'sizes' regression here: http://build.chromium.org/p/chromium/builders/Linux%20x64/builds/186 > We changed Encode() and EncodeInternal() return type from bool to void in this issue: > https://webrtc-codereview.appspot.com/38279004/ > Now we don't have to pass EncodedInfo as output parameter, but can return it instead. This also adds the benefit of making clear that EncodeInternal() needs to fill in this info. > > R=kwiberg@webrtc.org > > Review URL: https://webrtc-codereview.appspot.com/43839004 TBR=jmarusic@webrtc.org Review URL: https://webrtc-codereview.appspot.com/49449004 Cr-Commit-Position: refs/heads/master@{#8772} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8772 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -183,18 +183,19 @@ void AudioEncoderOpus::SetProjectedPacketLossRate(double fraction) {
|
||||
}
|
||||
}
|
||||
|
||||
AudioEncoder::EncodedInfo AudioEncoderOpus::EncodeInternal(
|
||||
uint32_t rtp_timestamp,
|
||||
const int16_t* audio,
|
||||
size_t max_encoded_bytes,
|
||||
uint8_t* encoded) {
|
||||
void AudioEncoderOpus::EncodeInternal(uint32_t rtp_timestamp,
|
||||
const int16_t* audio,
|
||||
size_t max_encoded_bytes,
|
||||
uint8_t* encoded,
|
||||
EncodedInfo* info) {
|
||||
if (input_buffer_.empty())
|
||||
first_timestamp_in_buffer_ = rtp_timestamp;
|
||||
input_buffer_.insert(input_buffer_.end(), audio,
|
||||
audio + samples_per_10ms_frame_);
|
||||
if (input_buffer_.size() < (static_cast<size_t>(num_10ms_frames_per_packet_) *
|
||||
samples_per_10ms_frame_)) {
|
||||
return kZeroEncodedBytes;
|
||||
info->encoded_bytes = 0;
|
||||
return;
|
||||
}
|
||||
CHECK_EQ(input_buffer_.size(),
|
||||
static_cast<size_t>(num_10ms_frames_per_packet_) *
|
||||
@ -206,13 +207,12 @@ AudioEncoder::EncodedInfo AudioEncoderOpus::EncodeInternal(
|
||||
ClampInt16(max_encoded_bytes), encoded);
|
||||
CHECK_GE(r, 0); // Fails only if fed invalid data.
|
||||
input_buffer_.clear();
|
||||
EncodedInfo info;
|
||||
info.encoded_bytes = r;
|
||||
info.encoded_timestamp = first_timestamp_in_buffer_;
|
||||
info.payload_type = payload_type_;
|
||||
info.send_even_if_empty = true; // Allows Opus to send empty packets.
|
||||
info.speech = r > 0;
|
||||
return info;
|
||||
info->encoded_bytes = r;
|
||||
info->encoded_timestamp = first_timestamp_in_buffer_;
|
||||
info->payload_type = payload_type_;
|
||||
// Allows Opus to send empty packets.
|
||||
info->send_even_if_empty = true;
|
||||
info->speech = r > 0;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -58,10 +58,11 @@ class AudioEncoderOpus final : public AudioEncoder {
|
||||
bool dtx_enabled() const { return dtx_enabled_; }
|
||||
|
||||
protected:
|
||||
EncodedInfo EncodeInternal(uint32_t rtp_timestamp,
|
||||
const int16_t* audio,
|
||||
size_t max_encoded_bytes,
|
||||
uint8_t* encoded) override;
|
||||
void EncodeInternal(uint32_t rtp_timestamp,
|
||||
const int16_t* audio,
|
||||
size_t max_encoded_bytes,
|
||||
uint8_t* encoded,
|
||||
EncodedInfo* info) override;
|
||||
|
||||
private:
|
||||
const int num_10ms_frames_per_packet_;
|
||||
|
||||
Reference in New Issue
Block a user