Skip to content
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

Patches #2

Open
wants to merge 2 commits into
base: patches
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions talk/media/webrtc/webrtcvideoengine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1178,8 +1178,13 @@ bool WebRtcVideoEngine::CanSendCodec(const VideoCodec& requested,
out->preference = requested.preference;
out->params = requested.params;
out->framerate = rtc::_min(requested.framerate, local_max->framerate);
#ifdef ECOVATE_NO_SCALING
out->width = requested.width;
out->height = requested.height;
#else
out->width = 0;
out->height = 0;
out->height = 0;
#endif
out->params = requested.params;
out->feedback_params = requested.feedback_params;

Expand Down Expand Up @@ -1570,7 +1575,11 @@ WebRtcVideoMediaChannel::WebRtcVideoMediaChannel(
send_fec_type_(-1),
sending_(false),
ratio_w_(0),
ratio_h_(0) {
ratio_h_(0),
listener_(ecovate::listener) {
if (listener_) {
listener_->incrementReferenceCount();
}
engine->RegisterChannel(this);
}

Expand Down Expand Up @@ -1604,6 +1613,10 @@ WebRtcVideoMediaChannel::~WebRtcVideoMediaChannel() {
if (worker_thread()) {
worker_thread()->Clear(this);
}

if (listener_) {
listener_->decrementReferenceCount();
}
}

bool WebRtcVideoMediaChannel::SetRecvCodecs(
Expand Down Expand Up @@ -2148,6 +2161,9 @@ bool WebRtcVideoMediaChannel::StartSend() {
success = false;
}
}
if (success && listener_) {
listener_->onSendMedia();
}
return success;
}

Expand Down
20 changes: 20 additions & 0 deletions talk/media/webrtc/webrtcvideoengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@
#error "Bogus include."
#endif

namespace ecovate {

struct Listener {
virtual ~Listener() { }

virtual void incrementReferenceCount() = 0;

virtual void decrementReferenceCount() = 0;

virtual void onSendQueueEmpty() = 0;

virtual void onSendMedia() = 0;
};

extern Listener* listener;

} // namespace ecovate

namespace webrtc {
class VideoCaptureModule;
class VideoDecoder;
Expand Down Expand Up @@ -460,6 +478,8 @@ class WebRtcVideoMediaChannel : public rtc::MessageHandler,
// aspect ratio
int ratio_w_;
int ratio_h_;

ecovate::Listener* listener_;
};

} // namespace cricket
Expand Down
6 changes: 5 additions & 1 deletion talk/session/media/srtpfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,16 @@ class SrtpSession {
sigslot::repeater3<uint32, SrtpFilter::Mode, SrtpFilter::Error>
SignalSrtpError;

// This was previously private, but because it's not thread-safe, we
// need to make it public and call it from application code prior to
// opening several WebRTC peer connections in parallel:
static bool Init();

private:
bool SetKey(int type, const std::string& cs, const uint8* key, int len);
// Returns send stream current packet index from srtp db.
bool GetSendStreamPacketIndex(void* data, int in_len, int64* index);

static bool Init();
void HandleEvent(const srtp_event_data_t* ev);
static void HandleEventThunk(srtp_event_data_t* ev);

Expand Down
20 changes: 20 additions & 0 deletions webrtc/modules/pacing/include/paced_sender.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@
#include "webrtc/system_wrappers/interface/thread_annotations.h"
#include "webrtc/typedefs.h"

namespace ecovate {

struct Listener {
virtual ~Listener() { }

virtual void incrementReferenceCount() = 0;

virtual void decrementReferenceCount() = 0;

virtual void onSendQueueEmpty() = 0;

virtual void onSendMedia() = 0;
};

extern Listener* listener;

} // namespace ecovate

namespace webrtc {
class Clock;
class CriticalSectionWrapper;
Expand Down Expand Up @@ -157,6 +175,8 @@ class PacedSender : public Module {
GUARDED_BY(critsect_);
scoped_ptr<paced_sender::PacketList> low_priority_packets_
GUARDED_BY(critsect_);

ecovate::Listener* listener_;
};
} // namespace webrtc
#endif // WEBRTC_MODULES_PACED_SENDER_H_
23 changes: 21 additions & 2 deletions webrtc/modules/pacing/paced_sender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/trace_event.h"

namespace ecovate {

Listener* listener = 0;

} // namespace ecovate

namespace {
// Time limit in milliseconds between packet bursts.
const int kMinPacketLimitMs = 5;
Expand Down Expand Up @@ -146,11 +152,21 @@ PacedSender::PacedSender(Clock* clock,
capture_time_ms_last_sent_(0),
high_priority_packets_(new paced_sender::PacketList),
normal_priority_packets_(new paced_sender::PacketList),
low_priority_packets_(new paced_sender::PacketList) {
low_priority_packets_(new paced_sender::PacketList),
listener_(ecovate::listener)
{
if (listener_) {
listener_->incrementReferenceCount();
}

UpdateBytesPerInterval(kMinPacketLimitMs);
}

PacedSender::~PacedSender() {}
PacedSender::~PacedSender() {
if (listener_) {
listener_->decrementReferenceCount();
}
}

void PacedSender::Pause() {
CriticalSectionScoped cs(critsect_.get());
Expand Down Expand Up @@ -372,6 +388,9 @@ bool PacedSender::ShouldSendNextPacket(paced_sender::PacketList** packet_list) {
*packet_list = low_priority_packets_.get();
return true;
}
if (listener_) {
listener_->onSendQueueEmpty();
}
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
config_->rc_target_bitrate = inst->startBitrate; // in kbit/s
temporal_layers_->ConfigureBitrates(inst->startBitrate, inst->maxBitrate,
inst->maxFramerate, config_);
#ifndef ECOVATE_USE_VP8_DEFAULTS
// setting the time base of the codec
config_->g_timebase.num = 1;
config_->g_timebase.den = 90000;
Expand Down Expand Up @@ -252,6 +253,7 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
} else {
config_->kf_mode = VPX_KF_DISABLED;
}
#endif // not ECOVATE_USE_VP8_DEFAULTS
switch (inst->codecSpecific.VP8.complexity) {
case kComplexityHigh:
cpu_speed_ = -5;
Expand Down
1 change: 1 addition & 0 deletions webrtc/modules/video_coding/main/source/receiver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ VCMEncodedFrame* VCMReceiver::FrameForDecoding(
timing_->IncomingTimestamp(frame_timestamp, last_packet_time_ms);
}
}

return frame;
}

Expand Down
3 changes: 3 additions & 0 deletions webrtc/modules/video_coding/main/source/video_sender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,12 @@ int32_t VideoSender::AddVideoFrame(const I420VideoFrame& videoFrame,
if (_nextFrameTypes[0] == kFrameEmpty) {
return VCM_OK;
}
#ifndef ECOVATE_NO_FRAME_DROP
if (_mediaOpt.DropFrame()) {
return VCM_OK;
}
#endif

_mediaOpt.UpdateContentData(contentMetrics);
int32_t ret =
_encoder->Encode(videoFrame, codecSpecificInfo, _nextFrameTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
namespace webrtc {

VPMSimpleSpatialResampler::VPMSimpleSpatialResampler()
#ifdef ECOVATE_NO_SCALING
: resampling_mode_(kNoRescaling),
#else
: resampling_mode_(kFastRescaling),
#endif
target_width_(0),
target_height_(0),
scaler_() {}
Expand Down
7 changes: 6 additions & 1 deletion webrtc/modules/video_render/video_render_frames.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ I420VideoFrame* VideoRenderFrames::FrameToRender() {
FrameList::iterator iter = incoming_frames_.begin();
while(iter != incoming_frames_.end()) {
I420VideoFrame* oldest_frame_in_list = *iter;
if (oldest_frame_in_list->render_time_ms() <=
#ifdef ECOVATE_NO_VIDEO_DELAY
bool delay = false;
#else
bool delay = true;
#endif
if ((! delay) || oldest_frame_in_list->render_time_ms() <=
TickTime::MillisecondTimestamp() + render_delay_ms_) {
// This is the oldest one so far and it's OK to render.
if (render_frame) {
Expand Down
4 changes: 4 additions & 0 deletions webrtc/video_engine/vie_capturer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ void ViECapturer::OnIncomingCapturedFrame(const int32_t capture_id,
TRACE_EVENT_ASYNC_BEGIN1("webrtc", "Video", video_frame.render_time_ms(),
"render_time", video_frame.render_time_ms());

#ifdef ECOVATE_NO_FRAME_DROP
DeliverI420Frame(&video_frame);
#else
if (video_frame.native_handle() != NULL) {
captured_frame_.reset(video_frame.CloneFrame());
} else {
Expand All @@ -356,6 +359,7 @@ void ViECapturer::OnIncomingCapturedFrame(const int32_t capture_id,
capture_event_.Set();
overuse_detector_->FrameCaptured(captured_frame_->width(),
captured_frame_->height());
#endif
}

void ViECapturer::OnCaptureDelayChanged(const int32_t id,
Expand Down