282 Commits

Author SHA1 Message Date
stefan
64636dda43 Add UMA for tracking which BWE versions are in use.
NOTRY=true
BUG=webrtc:6156

Review-Url: https://codereview.webrtc.org/2206583002
Cr-Commit-Position: refs/heads/master@{#13619}
2016-08-03 07:29:12 +00:00
stefan
c3de0333c0 Add plot of network delay change computed based on transport feedback.
NOTRY=true

Review-Url: https://codereview.webrtc.org/2205803002
Cr-Commit-Position: refs/heads/master@{#13610}
2016-08-02 14:22:23 +00:00
sprang
9eb3d5def4 Add sanity check for arrival timestamps.
BUG=chromium:632614

Review-Url: https://codereview.webrtc.org/2195663002
Cr-Commit-Position: refs/heads/master@{#13600}
2016-08-02 09:00:32 +00:00
danilchap
f734c135a4 Cleanup BWE SendTimeHistory class
Review-Url: https://codereview.webrtc.org/2011473002
Cr-Commit-Position: refs/heads/master@{#13590}
2016-08-01 16:23:24 +00:00
isheriff
1a993d12bb aimd: Remove unused variable
BUG=

Review-Url: https://codereview.webrtc.org/2187843002
Cr-Commit-Position: refs/heads/master@{#13553}
2016-07-28 13:34:45 +00:00
stefan
159a2fe9da Fix crash which happens when there's reordering in the beginning of a call.
The added unittest triggers this CHECK:
433ed06800/webrtc/modules/remote_bitrate_estimator/remote_estimator_proxy.cc (146)

It happens because the unwrap of the sequence number fails if the unwrappers last sequence number is small, but the newly added sequence number is large (greater than last seq num + 2^15), and therefore should have been interpreted as a reordering and a backwards wrap. Since that would mean the sequence number returned from the unwrapper would be negative, it simply returns the original sequence number instead. This causes problems later where the wrap is correctly handled, and everything breaks.

The real solution should be to correctly handle wraps, but to prevent the crash this is a reasonable workaround for now.

BUG=

Review-Url: https://codereview.webrtc.org/2157843002
Cr-Commit-Position: refs/heads/master@{#13496}
2016-07-18 11:14:18 +00:00
stefan
5e12d36ba7 Reset InterArrival if arrival time clock makes a jump.
Also adds a copy of the BWE test suite to the new DelayBasedBwe class.

BUG=webrtc:6079

Review-Url: https://codereview.webrtc.org/2126793002
Cr-Commit-Position: refs/heads/master@{#13428}
2016-07-11 08:44:12 +00:00
Ivo Creusen
fa1d568730 Added NiceMock for MockRtcEventLog in several unittests where we don't care about the event logging.
BUG=webrtc:4741
R=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/2121993002 .

Cr-Commit-Position: refs/heads/master@{#13388}
2016-07-06 07:12:21 +00:00
Erik Språng
956ed71a11 TransportFeedback must be able to start with dropped packets.
A bug in the transpot feedback adapter causes new feedback message to
always start with a received packet. This makes it impossible for the
receiver to distinguish from actual dropped packets and dropped feedback
messages.

BUG=webrtc:6073
R=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/2122863002 .

Cr-Commit-Position: refs/heads/master@{#13381}
2016-07-05 10:01:08 +00:00
ivoc
14d5dbe5b3 Reland of "Move RtcEventLog object from inside VoiceEngine to Call.", "Fix to make the start/stop functions for the Rtc Eventlog non-virtual." and "Fix for RtcEventLog ObjC interface"
The breaking tests in Chromium have been temporarily disabled, they will be fixed and reenabled soon.

Original CLs: https://codereview.webrtc.org/1748403002/, https://codereview.webrtc.org/2107253002/ and https://codereview.webrtc.org/2106103003/.

TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org,tkchin@webrtc.org
BUG=webrtc:4741, webrtc:5603, chromium:609749

Review-Url: https://codereview.webrtc.org/2110113003
Cr-Commit-Position: refs/heads/master@{#13379}
2016-07-04 14:07:03 +00:00
ivoc
9e03c3b372 Revert of Move RtcEventLog object from inside VoiceEngine to Call. (patchset #16 id:420001 of https://codereview.webrtc.org/1748403002/ )
Reason for revert:
Reverting all CLs related to moving the eventlog, as they break Chromium tests.

Original issue's description:
> Move RtcEventLog object from inside VoiceEngine to Call.
>
> In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
> The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.
>
> BUG=webrtc:4741,webrtc:5603,chromium:609749
> R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org
>
> Committed: https://crrev.com/1895526c6130e3d0e9b154f95079b8eda7567016
> Cr-Commit-Position: refs/heads/master@{#13321}

TBR=solenberg@webrtc.org,tommi@webrtc.org,stefan@webrtc.org,terelius@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4741,webrtc:5603,chromium:609749

Review-Url: https://codereview.webrtc.org/2111813002
Cr-Commit-Position: refs/heads/master@{#13340}
2016-06-30 07:59:49 +00:00
Ivo Creusen
1895526c61 Move RtcEventLog object from inside VoiceEngine to Call.
In addition to moving the logging object itself, this also moves the interface from PeerConnectionFactory to PeerConnection, which makes more sense for this functionality. An API parameter to set an upper limit to the size of the logfile is introduced.
The old interface on PeerConnectionFactory is not removed in this CL, because it is called from Chrome, it will be removed after Chrome is updated to use the PeerConnection interface.

BUG=webrtc:4741,webrtc:5603,chromium:609749
R=solenberg@webrtc.org, stefan@webrtc.org, terelius@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1748403002 .

Cr-Commit-Position: refs/heads/master@{#13321}
2016-06-29 11:57:01 +00:00
tommi
2e82f3821f Reland of Split IncomingVideoStream into two implementations, with smoothing and without. (patchset #1 id:1 of https://codereview.webrtc.org/2084873002/ )
Reason for revert:
Reverting the revert.  This change is not related to the failure on the Windows FYI bots.  The cause of the failure has been reverted in Chromium:
https://codereview.chromium.org/2081653004/

Original issue's description:
> Revert of Split IncomingVideoStream into two implementations, with smoothing and without. (patchset #5 id:340001 of https://codereview.webrtc.org/2078873002/ )
>
> Reason for revert:
> Breaks chromium.webrtc.fyi
>
> https://uberchromegw.corp.google.com/i/chromium.webrtc.fyi/builders/Win7%20Tester/builds/4719
> https://uberchromegw.corp.google.com/i/chromium.webrtc.fyi/builders/Win10%20Tester/builds/3120
>
> Original issue's description:
> > Reland of IncomingVideoStream refactoring.
> > This reland does not contain the non-smoothing part of the original implementation.  Instead, when smoothing is turned off, frame callbacks run on the decoder thread, as they did before.  This code path is used in Chrome.  As far as Chrome goes, the difference now is that there won't be an instance of IncomingVideoStream in between the decoder and the callback (i.e. fewer locks).  Other than that, no change for Chrome.
> >
> > Original issue's description (with non-smoothing references removed):
> >
> > Split IncomingVideoStream into two implementations, with smoothing and without.
> >
> > * Added TODOs and documentation for VideoReceiveStream::OnFrame, where we today grab 6 locks.
> >
> > * Removed the Start/Stop methods from the IncomingVideoStream implementations.  Now, when an instance is created, it should be considered to be "running" and when it is deleted, it's "not running".  This saves on resources and also reduces the amount of locking required and I could remove one critical section altogether.
> >
> > * Changed the VideoStreamDecoder class to not depend on IncomingVideoStream but rather use the generic rtc::VideoSinkInterface<VideoFrame> interface.  This means that any implementation of that interface can be used and the decoder can be made to  just use the 'renderer' from the config.  Once we do that, we can decouple the IncomingVideoStream implementations from the decoder and VideoReceiveStream implementations and leave it up to the application for how to do smoothing.  The app can choose to use the Incoming* classes or roll its own (which may be preferable since applications often have their own scheduling mechanisms).
> >
> > * The lifetime of the VideoStreamDecoder instance is now bound to Start/Stop in VideoReceiveStream and not all of the lifetime of VideoReceiveStream.
> >
> > * Fixed VideoStreamDecoder to unregister callbacks in the dtor that were registered in the ctor. (this was open to a use-after-free regression)
> >
> > * Delay and callback pointers are now passed via the ctors to the IncomingVideoStream classes.  The thread primitives in the IncomingVideoStream classes are also constructed/destructed at the same time as the owning object, which allowed me to remove one more lock.
> >
> > * Removed code in the VideoStreamDecoder that could overwrite the VideoReceiveStream render delay with a fixed value of 10ms on construction.  This wasn't a problem with the previous implementation (it would be now though) but seemed to me like the wrong place to be setting that value.
> >
> > * Made the render delay value in VideoRenderFrames, const.
> >
> > BUG=chromium:620232
> > R=mflodman@webrtc.org, nisse@webrtc.org
> >
> > Committed: https://crrev.com/884c336c345d988974c2a69cea402b0fb8b07a63
> > Cr-Commit-Position: refs/heads/master@{#13219}
>
> TBR=nisse@webrtc.org,philipel@webrtc.org,mflodman@webrtc.org,tommi@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=chromium:620232
>
> Committed: https://crrev.com/a536bfe70de38fe877245317a7f0b00bcf69cbd0
> Cr-Commit-Position: refs/heads/master@{#13229}

TBR=nisse@webrtc.org,philipel@webrtc.org,mflodman@webrtc.org,sakal@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:620232

Review-Url: https://codereview.webrtc.org/2089613002
Cr-Commit-Position: refs/heads/master@{#13230}
2016-06-21 07:26:48 +00:00
sakal
a536bfe70d Revert of Split IncomingVideoStream into two implementations, with smoothing and without. (patchset #5 id:340001 of https://codereview.webrtc.org/2078873002/ )
Reason for revert:
Breaks chromium.webrtc.fyi

https://uberchromegw.corp.google.com/i/chromium.webrtc.fyi/builders/Win7%20Tester/builds/4719
https://uberchromegw.corp.google.com/i/chromium.webrtc.fyi/builders/Win10%20Tester/builds/3120

Original issue's description:
> Reland of IncomingVideoStream refactoring.
> This reland does not contain the non-smoothing part of the original implementation.  Instead, when smoothing is turned off, frame callbacks run on the decoder thread, as they did before.  This code path is used in Chrome.  As far as Chrome goes, the difference now is that there won't be an instance of IncomingVideoStream in between the decoder and the callback (i.e. fewer locks).  Other than that, no change for Chrome.
>
> Original issue's description (with non-smoothing references removed):
>
> Split IncomingVideoStream into two implementations, with smoothing and without.
>
> * Added TODOs and documentation for VideoReceiveStream::OnFrame, where we today grab 6 locks.
>
> * Removed the Start/Stop methods from the IncomingVideoStream implementations.  Now, when an instance is created, it should be considered to be "running" and when it is deleted, it's "not running".  This saves on resources and also reduces the amount of locking required and I could remove one critical section altogether.
>
> * Changed the VideoStreamDecoder class to not depend on IncomingVideoStream but rather use the generic rtc::VideoSinkInterface<VideoFrame> interface.  This means that any implementation of that interface can be used and the decoder can be made to  just use the 'renderer' from the config.  Once we do that, we can decouple the IncomingVideoStream implementations from the decoder and VideoReceiveStream implementations and leave it up to the application for how to do smoothing.  The app can choose to use the Incoming* classes or roll its own (which may be preferable since applications often have their own scheduling mechanisms).
>
> * The lifetime of the VideoStreamDecoder instance is now bound to Start/Stop in VideoReceiveStream and not all of the lifetime of VideoReceiveStream.
>
> * Fixed VideoStreamDecoder to unregister callbacks in the dtor that were registered in the ctor. (this was open to a use-after-free regression)
>
> * Delay and callback pointers are now passed via the ctors to the IncomingVideoStream classes.  The thread primitives in the IncomingVideoStream classes are also constructed/destructed at the same time as the owning object, which allowed me to remove one more lock.
>
> * Removed code in the VideoStreamDecoder that could overwrite the VideoReceiveStream render delay with a fixed value of 10ms on construction.  This wasn't a problem with the previous implementation (it would be now though) but seemed to me like the wrong place to be setting that value.
>
> * Made the render delay value in VideoRenderFrames, const.
>
> BUG=chromium:620232
> R=mflodman@webrtc.org, nisse@webrtc.org
>
> Committed: https://crrev.com/884c336c345d988974c2a69cea402b0fb8b07a63
> Cr-Commit-Position: refs/heads/master@{#13219}

TBR=nisse@webrtc.org,philipel@webrtc.org,mflodman@webrtc.org,tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:620232

Review-Url: https://codereview.webrtc.org/2084873002
Cr-Commit-Position: refs/heads/master@{#13229}
2016-06-21 07:08:58 +00:00
pbos
2169d8bc68 Reland of move audio/video distinction for probe packets. (patchset #1 id:1 of https://codereview.webrtc.org/2086633002/ )
Reason for revert:
Fix already landed in google3, this revert actually breaks the import.

Original issue's description:
> Revert of Remove audio/video distinction for probe packets. (patchset #2 id:20001 of https://codereview.webrtc.org/2061193002/ )
>
> Reason for revert:
> Revert this because it broke the google3 import build.
> http://webrtc-buildbot-master.mtv.corp.google.com:21000/builders/WebRTC%20google3%20Importer%20%28Shem%20TOT%29/builds/67/steps/blaze_regular_tests/logs/stdio
>
> Original issue's description:
> > Remove audio/video distinction for probe packets.
> >
> > Allows detecting large-enough audio packets as part of a probe,
> > speculative fix for a rampup-time regression in M50. These packets are
> > accounted on the send side when probing.
> >
> > BUG=webrtc:5985
> > R=mflodman@webrtc.org, philipel@webrtc.org
> >
> > Committed: https://crrev.com/a7d88d38448f6a5677a017562765ab505b89d468
> > Cr-Commit-Position: refs/heads/master@{#13210}
>
> TBR=mflodman@webrtc.org,philipel@webrtc.org,pbos@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5985
>
> Committed: https://crrev.com/17bde8c96ee8b5a7e496a7dc98828b84f9756925
> Cr-Commit-Position: refs/heads/master@{#13221}

TBR=mflodman@webrtc.org,philipel@webrtc.org,honghaiz@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5985

Review-Url: https://codereview.webrtc.org/2085653002
Cr-Commit-Position: refs/heads/master@{#13223}
2016-06-20 18:53:09 +00:00
honghaiz
17bde8c96e Revert of Remove audio/video distinction for probe packets. (patchset #2 id:20001 of https://codereview.webrtc.org/2061193002/ )
Reason for revert:
Revert this because it broke the google3 import build.
http://webrtc-buildbot-master.mtv.corp.google.com:21000/builders/WebRTC%20google3%20Importer%20%28Shem%20TOT%29/builds/67/steps/blaze_regular_tests/logs/stdio

Original issue's description:
> Remove audio/video distinction for probe packets.
>
> Allows detecting large-enough audio packets as part of a probe,
> speculative fix for a rampup-time regression in M50. These packets are
> accounted on the send side when probing.
>
> BUG=webrtc:5985
> R=mflodman@webrtc.org, philipel@webrtc.org
>
> Committed: https://crrev.com/a7d88d38448f6a5677a017562765ab505b89d468
> Cr-Commit-Position: refs/heads/master@{#13210}

TBR=mflodman@webrtc.org,philipel@webrtc.org,pbos@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5985

Review-Url: https://codereview.webrtc.org/2086633002
Cr-Commit-Position: refs/heads/master@{#13221}
2016-06-20 18:47:25 +00:00
Tommi
884c336c34 Reland of IncomingVideoStream refactoring.
This reland does not contain the non-smoothing part of the original implementation.  Instead, when smoothing is turned off, frame callbacks run on the decoder thread, as they did before.  This code path is used in Chrome.  As far as Chrome goes, the difference now is that there won't be an instance of IncomingVideoStream in between the decoder and the callback (i.e. fewer locks).  Other than that, no change for Chrome.

Original issue's description (with non-smoothing references removed):

Split IncomingVideoStream into two implementations, with smoothing and without.

* Added TODOs and documentation for VideoReceiveStream::OnFrame, where we today grab 6 locks.

* Removed the Start/Stop methods from the IncomingVideoStream implementations.  Now, when an instance is created, it should be considered to be "running" and when it is deleted, it's "not running".  This saves on resources and also reduces the amount of locking required and I could remove one critical section altogether.

* Changed the VideoStreamDecoder class to not depend on IncomingVideoStream but rather use the generic rtc::VideoSinkInterface<VideoFrame> interface.  This means that any implementation of that interface can be used and the decoder can be made to  just use the 'renderer' from the config.  Once we do that, we can decouple the IncomingVideoStream implementations from the decoder and VideoReceiveStream implementations and leave it up to the application for how to do smoothing.  The app can choose to use the Incoming* classes or roll its own (which may be preferable since applications often have their own scheduling mechanisms).

* The lifetime of the VideoStreamDecoder instance is now bound to Start/Stop in VideoReceiveStream and not all of the lifetime of VideoReceiveStream.

* Fixed VideoStreamDecoder to unregister callbacks in the dtor that were registered in the ctor. (this was open to a use-after-free regression)

* Delay and callback pointers are now passed via the ctors to the IncomingVideoStream classes.  The thread primitives in the IncomingVideoStream classes are also constructed/destructed at the same time as the owning object, which allowed me to remove one more lock.

* Removed code in the VideoStreamDecoder that could overwrite the VideoReceiveStream render delay with a fixed value of 10ms on construction.  This wasn't a problem with the previous implementation (it would be now though) but seemed to me like the wrong place to be setting that value.

* Made the render delay value in VideoRenderFrames, const.

BUG=chromium:620232
R=mflodman@webrtc.org, nisse@webrtc.org

Review URL: https://codereview.webrtc.org/2078873002 .

Cr-Commit-Position: refs/heads/master@{#13219}
2016-06-20 17:43:10 +00:00
Peter Boström
a7d88d3844 Remove audio/video distinction for probe packets.
Allows detecting large-enough audio packets as part of a probe,
speculative fix for a rampup-time regression in M50. These packets are
accounted on the send side when probing.

BUG=webrtc:5985
R=mflodman@webrtc.org, philipel@webrtc.org

Review URL: https://codereview.webrtc.org/2061193002 .

Cr-Commit-Position: refs/heads/master@{#13210}
2016-06-20 08:51:20 +00:00
tommi
8e8222d0d2 Revert of Split IncomingVideoStream into two implementations, with smoothing and without. (patchset #4 id:290001 of https://codereview.webrtc.org/2071473002/ )
Reason for revert:
Reverting again.  The perf regression does not seem to be related to dropping frames.

Original issue's description:
> Reland of Split IncomingVideoStream into two implementations, with smoothing and without.
>
> Original issue's description:
>
> Split IncomingVideoStream into two implementations, with smoothing and without.
>
> This CL fixes an issue with the non-smoothing implementation where frames were delivered on the decoder thread.  No-smoothing is now done in a separate class that uses a TaskQueue.  The implementation may drop frames if the renderer doesn't keep up and it doesn't block the decoder thread.
>
> Further work done:
>
> * I added TODOs and documentation for VideoReceiveStream::OnFrame, where we today grab 5 locks.
>
> * I removed the Start/Stop methods from the IncomingVideoStream implementations.  Now, when an instance is created, it should be considered to be "running" and when it is deleted, it's "not running".  This saves on resources and also reduces the amount of locking required and I could remove one critical section altogether.
>
> * I changed the VideoStreamDecoder class to not depend on IncomingVideoStream but rather use the generic rtc::VideoSinkInterface<VideoFrame> interface.  This means that any implementation of that interface can be used and the decoder can be made to  just use the 'renderer' from the config.  Once we do that, we can decouple the IncomingVideoStream implementations from the decoder and VideoReceiveStream implementations and leave it up to the application for how to do smoothing.  The app can choose to use the Incoming* classes or roll its own (which may be preferable since applications often have their own scheduling mechanisms).
>
> * The non-smoothing IncomingVideoStream implementation currently allows only 1 outstanding pending frame.  If we exceed that, the current frame won't be delivered to the renderer and instead we deliver the next one (since when this happens, the renderer is falling behind).
>
> * The lifetime of the VideoStreamDecoder instance is now bound to Start/Stop in VideoReceiveStream and not all of the lifetime of VideoReceiveStream.
>
> * Fixed VideoStreamDecoder to unregister callbacks in the dtor that were registered in the ctor. (this was open to a use-after-free regression)
>
> * Delay and callback pointers are now passed via the ctors to the IncomingVideoStream classes.  The thread primitives in the IncomingVideoStream classes are also constructed/destructed at the same time as the owning object, which allowed me to remove one more lock.
>
> * Removed code in the VideoStreamDecoder that could overwrite the VideoReceiveStream render delay with a fixed value of 10ms on construction.  This wasn't a problem with the previous implementation (it would be now though) but seemed to me like the wrong place to be setting that value.
>
> * Made the render delay value in VideoRenderFrames, const.
>
> BUG=chromium:620232
> TBR=mflodman
>
> Committed: https://crrev.com/e03f8787377bbc03a4e00184bb14b7561b108cbb
> Cr-Commit-Position: refs/heads/master@{#13175}

TBR=mflodman@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:620232

Review-Url: https://codereview.webrtc.org/2071093002
Cr-Commit-Position: refs/heads/master@{#13176}
2016-06-16 22:44:11 +00:00
tommi
e03f878737 Reland of Split IncomingVideoStream into two implementations, with smoothing and without.
Original issue's description:

Split IncomingVideoStream into two implementations, with smoothing and without.

This CL fixes an issue with the non-smoothing implementation where frames were delivered on the decoder thread.  No-smoothing is now done in a separate class that uses a TaskQueue.  The implementation may drop frames if the renderer doesn't keep up and it doesn't block the decoder thread.

Further work done:

* I added TODOs and documentation for VideoReceiveStream::OnFrame, where we today grab 5 locks.

* I removed the Start/Stop methods from the IncomingVideoStream implementations.  Now, when an instance is created, it should be considered to be "running" and when it is deleted, it's "not running".  This saves on resources and also reduces the amount of locking required and I could remove one critical section altogether.

* I changed the VideoStreamDecoder class to not depend on IncomingVideoStream but rather use the generic rtc::VideoSinkInterface<VideoFrame> interface.  This means that any implementation of that interface can be used and the decoder can be made to  just use the 'renderer' from the config.  Once we do that, we can decouple the IncomingVideoStream implementations from the decoder and VideoReceiveStream implementations and leave it up to the application for how to do smoothing.  The app can choose to use the Incoming* classes or roll its own (which may be preferable since applications often have their own scheduling mechanisms).

* The non-smoothing IncomingVideoStream implementation currently allows only 1 outstanding pending frame.  If we exceed that, the current frame won't be delivered to the renderer and instead we deliver the next one (since when this happens, the renderer is falling behind).

* The lifetime of the VideoStreamDecoder instance is now bound to Start/Stop in VideoReceiveStream and not all of the lifetime of VideoReceiveStream.

* Fixed VideoStreamDecoder to unregister callbacks in the dtor that were registered in the ctor. (this was open to a use-after-free regression)

* Delay and callback pointers are now passed via the ctors to the IncomingVideoStream classes.  The thread primitives in the IncomingVideoStream classes are also constructed/destructed at the same time as the owning object, which allowed me to remove one more lock.

* Removed code in the VideoStreamDecoder that could overwrite the VideoReceiveStream render delay with a fixed value of 10ms on construction.  This wasn't a problem with the previous implementation (it would be now though) but seemed to me like the wrong place to be setting that value.

* Made the render delay value in VideoRenderFrames, const.

BUG=chromium:620232
TBR=mflodman

Review-Url: https://codereview.webrtc.org/2071473002
Cr-Commit-Position: refs/heads/master@{#13175}
2016-06-16 20:29:12 +00:00
tommi
17c3cddf9d Revert of Split IncomingVideoStream into two implementations, with smoothing and without. (patchset #23 id:430001 of https://codereview.webrtc.org/2035173002/ )
Reason for revert:
Reverting while we track down the issue on the Win10 bot.

Original issue's description:
> Split IncomingVideoStream into two implementations, with smoothing and without.
>
> This CL fixes an issue with the non-smoothing implementation where frames were delivered on the decoder thread.  No-smoothing is now done in a separate class that uses a TaskQueue.  The implementation may drop frames if the renderer doesn't keep up and it doesn't block the decoder thread.
>
> Further work done:
>
> * I added TODOs and documentation for VideoReceiveStream::OnFrame, where we today grab 5 locks.
>
> * I removed the Start/Stop methods from the IncomingVideoStream implementations.  Now, when an instance is created, it should be considered to be "running" and when it is deleted, it's "not running".  This saves on resources and also reduces the amount of locking required and I could remove one critical section altogether.
>
> * I changed the VideoStreamDecoder class to not depend on IncomingVideoStream but rather use the generic rtc::VideoSinkInterface<VideoFrame> interface.  This means that any implementation of that interface can be used and the decoder can be made to  just use the 'renderer' from the config.  Once we do that, we can decouple the IncomingVideoStream implementations from the decoder and VideoReceiveStream implementations and leave it up to the application for how to do smoothing.  The app can choose to use the Incoming* classes or roll its own (which may be preferable since applications often have their own scheduling mechanisms).
>
> * The non-smoothing IncomingVideoStream implementation currently allows only 1 outstanding pending frame.  If we exceed that, the current frame won't be delivered to the renderer and instead we deliver the next one (since when this happens, the renderer is falling behind).
>
> * The lifetime of the VideoStreamDecoder instance is now bound to Start/Stop in VideoReceiveStream and not all of the lifetime of VideoReceiveStream.
>
> * Fixed VideoStreamDecoder to unregister callbacks in the dtor that were registered in the ctor. (this was open to a use-after-free regression)
>
> * Delay and callback pointers are now passed via the ctors to the IncomingVideoStream classes.  The thread primitives in the IncomingVideoStream classes are also constructed/destructed at the same time as the owning object, which allowed me to remove one more lock.
>
> * Removed code in the VideoStreamDecoder that could overwrite the VideoReceiveStream render delay with a fixed value of 10ms on construction.  This wasn't a problem with the previous implementation (it would be now though) but seemed to me like the wrong place to be setting that value.
>
> * Made the render delay value in VideoRenderFrames, const.
>
> BUG=
>
> Committed: https://crrev.com/1c7eef652b0aa22d8ebb0bfe2b547094a794be22
> Cr-Commit-Position: refs/heads/master@{#13129}

TBR=mflodman@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review-Url: https://codereview.webrtc.org/2061363002
Cr-Commit-Position: refs/heads/master@{#13146}
2016-06-14 23:04:48 +00:00
tommi
1c7eef652b Split IncomingVideoStream into two implementations, with smoothing and without.
This CL fixes an issue with the non-smoothing implementation where frames were delivered on the decoder thread.  No-smoothing is now done in a separate class that uses a TaskQueue.  The implementation may drop frames if the renderer doesn't keep up and it doesn't block the decoder thread.

Further work done:

* I added TODOs and documentation for VideoReceiveStream::OnFrame, where we today grab 5 locks.

* I removed the Start/Stop methods from the IncomingVideoStream implementations.  Now, when an instance is created, it should be considered to be "running" and when it is deleted, it's "not running".  This saves on resources and also reduces the amount of locking required and I could remove one critical section altogether.

* I changed the VideoStreamDecoder class to not depend on IncomingVideoStream but rather use the generic rtc::VideoSinkInterface<VideoFrame> interface.  This means that any implementation of that interface can be used and the decoder can be made to  just use the 'renderer' from the config.  Once we do that, we can decouple the IncomingVideoStream implementations from the decoder and VideoReceiveStream implementations and leave it up to the application for how to do smoothing.  The app can choose to use the Incoming* classes or roll its own (which may be preferable since applications often have their own scheduling mechanisms).

* The non-smoothing IncomingVideoStream implementation currently allows only 1 outstanding pending frame.  If we exceed that, the current frame won't be delivered to the renderer and instead we deliver the next one (since when this happens, the renderer is falling behind).

* The lifetime of the VideoStreamDecoder instance is now bound to Start/Stop in VideoReceiveStream and not all of the lifetime of VideoReceiveStream.

* Fixed VideoStreamDecoder to unregister callbacks in the dtor that were registered in the ctor. (this was open to a use-after-free regression)

* Delay and callback pointers are now passed via the ctors to the IncomingVideoStream classes.  The thread primitives in the IncomingVideoStream classes are also constructed/destructed at the same time as the owning object, which allowed me to remove one more lock.

* Removed code in the VideoStreamDecoder that could overwrite the VideoReceiveStream render delay with a fixed value of 10ms on construction.  This wasn't a problem with the previous implementation (it would be now though) but seemed to me like the wrong place to be setting that value.

* Made the render delay value in VideoRenderFrames, const.

BUG=

Review-Url: https://codereview.webrtc.org/2035173002
Cr-Commit-Position: refs/heads/master@{#13129}
2016-06-14 11:38:43 +00:00
kjellander
fb11424551 GN: Add modules_unittests
Changes:
* Enabled protobuf for iOS globally.
* Set WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE on a global
scope similar to GYP since tests depend on it.
* Added missing rtc_libvpx_build_vp9 variable.
* Moved out audio_coding defines into .gni file to avoid code duplication
* Renamed files to avoid object naming conflicts that GN disallows:
  * webrtc/modules/audio_processing/{echo_cancellation_unittest.cc->echo_cancellation_bit_exact_unittest.cc}
  * webrtc/modules/video_coding/codecs/vp9/{screenshare_layers_unittest.cc->vp9_screenshare_layers_unittest.cc}

BUG=webrtc:5949
TESTED=Built and ran the tests on Mac. Also ran:
gn gen out/Default --args="rtc_enable_bwe_test_logging=true"
and verified that more objects are being built (1885 vs 1883)
when compiling modules_unittests.

NOTRY=True
NOPRESUBMIT=True

Review-Url: https://codereview.webrtc.org/2041233006
Cr-Commit-Position: refs/heads/master@{#13108}
2016-06-13 07:19:53 +00:00
Erik Språng
51e60305e6 Update RateStatistics to handle too-little-data case.
To avoid the case where a single data point or too short window is used,
causing bad behavior due to bad stats, update RateStatistics to return
an Optional rather than a plain rate.

There was also a strange off by one bug where the rate was slightly
overestimated (N + 1 buckets, N ms time window).

These changes requires updates to a number of places, and may very well
cause seeming perf regressions (but the stats were probablty more wrong
previously).

BUG=
R=mflodman@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/2029593002 .

Cr-Commit-Position: refs/heads/master@{#13103}
2016-06-10 20:13:33 +00:00
Henrik Kjellander
d4070c63d9 GN: Fix Chromium breakage for remote_bitrate_estimator
In https://codereview.webrtc.org/2040313004 a config was changed
incorrectly and a dependency on rtc_base_approved is also missing.

BUG=webrtc:5949
TBR=stefan@webrtc.org

Review URL: https://codereview.webrtc.org/2044333004 .

Cr-Commit-Position: refs/heads/master@{#13088}
2016-06-09 09:55:40 +00:00
kjellander
5c1d043726 Fix GYP/GN for webrtc/modules/remote_bitrate_estimator
Sync the GYP and GN targets and update the name of the GN one
to 'remote_bitrate_estimator'.
Move the GYP variable 'enable_bwe_test_logging' into the local scope.
Remove redundant entries in modules.gyp.

These are preparations related to the GN migration.

BUG=webrtc:5949
TESTED=Ran GYP with the default variables and with
-Denable_bwe_test_logging=1. Compiled remote_bitrate_estimator
and verified that bwe_test_logging.cc is compiled only when
set.
NOTRY=True

Review-Url: https://codereview.webrtc.org/2040313004
Cr-Commit-Position: refs/heads/master@{#13087}
2016-06-09 09:41:02 +00:00
stefan
846b2d9c5c Reduce logging frequency in bwe simulations.
BUG=webrtc:5962
NOTRY=true

Review-Url: https://codereview.webrtc.org/2030903002
Cr-Commit-Position: refs/heads/master@{#13025}
2016-06-03 07:20:40 +00:00
philipel
a1ed0b3241 Revert "Revert of Propagate probing cluster id to SendTimeHistory. (patchset #5 id:80001 of https://codereview.webrtc.org/2005313003/ )"
This reverts commit 46948c17fd09e4957bebc8ea61f0a8e77ff84b48.
TBR=mflodman@webrtc.org
BUG=webrtc:5859

Review-Url: https://codereview.webrtc.org/2032473002
Cr-Commit-Position: refs/heads/master@{#12992}
2016-06-01 13:31:22 +00:00
philipel
46948c17fd Revert of Propagate probing cluster id to SendTimeHistory. (patchset #5 id:80001 of https://codereview.webrtc.org/2005313003/ )
Reason for revert:
Breaks google3 buildbot:  http://webrtc-buildbot-master.mtv.corp.google.com:21000/builders/WebRTC%20google3%20Importer/builds/8640

Original issue's description:
> Propagate probing cluster id to SendTimeHistory, both for packets and padding.
>
> BUG=webrtc:5859
>
> Committed: https://crrev.com/5be28c848b91bc6e4800eac07a3f5ac09a32ad70
> Cr-Commit-Position: refs/heads/master@{#12985}

TBR=danilchap@webrtc.org,stefan@webrtc.org,mflodman@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5859

Review-Url: https://codereview.webrtc.org/2032463003
Cr-Commit-Position: refs/heads/master@{#12987}
2016-06-01 11:04:49 +00:00
philipel
5be28c848b Propagate probing cluster id to SendTimeHistory, both for packets and padding.
BUG=webrtc:5859

Review-Url: https://codereview.webrtc.org/2005313003
Cr-Commit-Position: refs/heads/master@{#12985}
2016-06-01 09:49:29 +00:00
brucedawson
07df20b51a Fix building of bwe_test_logging.cc in gyp and gn builds
bwe_test_logging.cc is supposed to be conditionally built in gyp builds
but, due to a path error in the sources! expressions it was always
compiled.

Meanwhile, compilation of bwe_test_logging.cc was never set up for gn
builds.

This fixes both of these problems.

BUG=604060

Review-Url: https://codereview.webrtc.org/1990373002
Cr-Commit-Position: refs/heads/master@{#12842}
2016-05-23 00:15:11 +00:00
philipel
29dca2ce95 Added cluster id to PacedSender::Callback::TimeToSendPacket.
Also added cluster id to paced_sender::Packet and set the cluster id of
the probing packet that is about to be sent.

BUG=webrtc:5859
R=danilchap@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1962303002 .

Cr-Commit-Position: refs/heads/master@{#12718}
2016-05-13 09:13:16 +00:00
perkj
ec81bcd519 Remove SendPacer from ViEEncoder and make sure SendPacer starts at a valid bitrate
This reverts commit e30c27205148b34ba421184efe65f6a0780b436d (https://codereview.webrtc.org/1958053002/)

Original reverted cl is in patch set #1.
Changes in following patch sets.

The cl now also make sure SendPacer starts with the configured bitrate provided in a call to CongestionController::SetBweBitrates)()

It turns out that the failing tests in 609816 is due to a bug in the current code that runs the proper at 300kbit regardless of configured start bitrate.

Original cl description:
Remove SendPacer from ViEEncoder
This CL moves the logic where the ViEEncoder pause if the pacer is full to the BitrateController. If the queue is full, the controller reports a bitrate of zero to  Call (and BitrateAllocator)

BUG=chromium:609816, webrtc:5687
TBR=mflodman@webrtc.org
NOTRY=True  // Due to bug  in android_x86 cq builder....

Review-Url: https://codereview.webrtc.org/1958113003
Cr-Commit-Position: refs/heads/master@{#12688}
2016-05-11 13:01:19 +00:00
perkj
e30c272051 Revert "Reland of Remove SendPacer from ViEEncoder
Revert due to crbug/609816. Investigation is ongoing.

This reverts commit 28a44564c93b12839618dc0da2e2541ec6a0db23. (https://codereview.webrtc.org/1947873002/)

TBR=stefan@webrtc.org,  ivoc@webrtc.org,

BUG=609816, webrtc:5687

Review-Url: https://codereview.webrtc.org/1958053002
Cr-Commit-Position: refs/heads/master@{#12663}
2016-05-09 11:57:18 +00:00
Per
28a44564c9 Revert "Revert of Remove SendPacer from ViEEncoder (patchset #13 id:240001 of https://codereview.webrtc.org/1917793002/ )"
This reverts commit 825eb58d59940a4c3c9837595c4b3b07059c93ca.

This Relands the cl reviewed in https://codereview.webrtc.org/1917793002/

patchset #1 is a pure reland.
patchset #2 fix an overflow in BitrateProber that caused WebRtcVideoChannel2BaseTest.TwoStreamsSendAndReceive to fail.

Original cl description:
Remove SendPacer from ViEEncoder
This CL moves the logic where the ViEEncoder pause if the pacer is full to the BitrateController. If the queue is full, the controller reports a bitrate of zero to  Call (and BitrateAllocator)

R=stefan@webrtc.org
TBR=mflodman@webrtc.org

BUG=webrtc:5687

Review URL: https://codereview.webrtc.org/1947873002 .

Cr-Commit-Position: refs/heads/master@{#12630}
2016-05-04 15:13:06 +00:00
perkj
825eb58d59 Revert of Remove SendPacer from ViEEncoder (patchset #13 id:240001 of https://codereview.webrtc.org/1917793002/ )
Reason for revert:
Fails in the waterfall here:

https://build.chromium.org/p/client.webrtc/builders/Win32%20Debug/builds/7832/steps/rtc_media_unittests/logs/stdio

Original issue's description:
> Remove SendPacer from ViEEncoder
>
> This CL moves the logic where the ViEEncoder pause if the pacer is full to the BitrateController. If the queue is full, the controller reports a bitrate of zero to  Call (and BitrateAllocator)
>
> BUG=webrtc:5687
>
> Committed: https://crrev.com/857c5ccdb56e4c94196f7c6227abd5993c95abe2
> Cr-Commit-Position: refs/heads/master@{#12620}

TBR=stefan@webrtc.org,mflodman@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5687

Review-Url: https://codereview.webrtc.org/1947853002
Cr-Commit-Position: refs/heads/master@{#12621}
2016-05-04 08:08:15 +00:00
perkj
857c5ccdb5 Remove SendPacer from ViEEncoder
This CL moves the logic where the ViEEncoder pause if the pacer is full to the BitrateController. If the queue is full, the controller reports a bitrate of zero to  Call (and BitrateAllocator)

BUG=webrtc:5687

Review-Url: https://codereview.webrtc.org/1917793002
Cr-Commit-Position: refs/heads/master@{#12620}
2016-05-04 07:09:56 +00:00
stefan
daeb892a64 Reland: Deliver reordered packets in arrival time order after parsing feedback message.
This is what the remote bitrate estimator expects.

BUG=5823
R=sprang@webrtc.org

Review-Url: https://codereview.webrtc.org/1925643002
Cr-Commit-Position: refs/heads/master@{#12535}
2016-04-27 16:49:36 +00:00
stefan
0415a56020 Revert of Deliver reordered packets in arrival time order after parsing feedback message. (patchset #2 id:20001 of https://codereview.webrtc.org/1915993002/ )
Reason for revert:
Breaks bots

Original issue's description:
> Deliver reordered packets in arrival time order after parsing feedback message.
>
> This is what the remote bitrate estimator expects.
>
> BUG=5823
> R=sprang@webrtc.org
>
> Committed: https://crrev.com/ed9535e2cac6be7a45fb03dc8426ef3b0ec43294
> Cr-Commit-Position: refs/heads/master@{#12527}

TBR=sprang@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=5823

Review URL: https://codereview.webrtc.org/1928443004

Cr-Commit-Position: refs/heads/master@{#12528}
2016-04-27 12:30:29 +00:00
Stefan Holmer
ed9535e2ca Deliver reordered packets in arrival time order after parsing feedback message.
This is what the remote bitrate estimator expects.

BUG=5823
R=sprang@webrtc.org

Review URL: https://codereview.webrtc.org/1915993002 .

Cr-Commit-Position: refs/heads/master@{#12527}
2016-04-27 12:21:27 +00:00
kwiberg
1c7fdd86eb Remove calls to ScopedToUnique and UniqueToScoped
They're just no-ops now, and will soon go away.

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1914153002

Cr-Commit-Position: refs/heads/master@{#12510}
2016-04-26 15:18:13 +00:00
kwiberg
4485ffb58d #include "webrtc/base/constructormagic.h" where appropriate
Any file that uses the RTC_DISALLOW_* macros should #include
"webrtc/base/constructormagic.h", but a shocking number of them don't.
This causes trouble when we try to wean files off of #including
scoped_ptr.h, since a bunch of files get their constructormagic macros
only from there.

Rather than fixing these errors one by one as they turn up, this CL
simply ensures that every file in the WebRTC tree that uses the
RTC_DISALLOW_* macros #includes "webrtc/base/constructormagic.h".

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1917043005

Cr-Commit-Position: refs/heads/master@{#12509}
2016-04-26 15:14:48 +00:00
Stefan Holmer
fb8fc5391e Improve the behavior when the BWE times out and when we have too little data to determine the incoming bitrate.
This is done by changing the RateStatistics so that it resets its window when the accumulator is empty. It also keeps a dynamic window, so that the rates computed before a full window worth of data has been received will be computed over a smaller window. This means that the rate will be closer to the true rate, but with a higher variance.

BUG=webrtc:5773
R=perkj@webrtc.org, sprang@webrtc.org

Review URL: https://codereview.webrtc.org/1908893003 .

Cr-Commit-Position: refs/heads/master@{#12470}
2016-04-22 13:48:36 +00:00
Stefan Holmer
54728bab25 Remove process thread checker from BWE.
R=pbos@webrtc.org

Review URL: https://codereview.webrtc.org/1898723002 .

Cr-Commit-Position: refs/heads/master@{#12408}
2016-04-18 13:06:16 +00:00
stefan
1112b2bc68 Fix bug when the BWE times out due to no incoming packets.
Both InterArrival and OveruseEstimator should be timed out at the same time since otherwise the overuse filter may take a long time to converge.

BUG=webrtc:5773

Review URL: https://codereview.webrtc.org/1886783002

Cr-Commit-Position: refs/heads/master@{#12364}
2016-04-14 15:08:20 +00:00
kjellander@webrtc.org
94a23f04af Reland "Add check_deps rules in DEPS files."
Relanding https://codereview.webrtc.org/1796413002/
without the change to the openmax_dl include path
(which broke downstream code).

TBR=tommi@webrtc.org
BUG=webrtc:5623
TESTED=Passing runs using:
buildtools/checkdeps/checkdeps.py --root=. talk
buildtools/checkdeps/checkdeps.py --root=. webrtc

Review URL: https://codereview.webrtc.org/1804333002 .

Cr-Commit-Position: refs/heads/master@{#12031}
2016-03-17 11:05:50 +00:00
kjellander
56cf60e717 Revert of Add check_deps rules in DEPS files. (patchset #2 id:60001 of https://codereview.webrtc.org/1796413002/ )
Reason for revert:
The openmax_dl include change breaks downstream projects.

Original issue's description:
> Add check_deps rules in DEPS files.
>
> Add fine-grained check_deps rules for all of WebRTC.
> This will help both maintaining sane dependencies and provides a way
> to visualize dependency graphs using the buildtools/checkdeps/graphdeps.py script.
>
> Example:
> buildtools/checkdeps/graphdeps.py --root=. --format=png \
> --out=./webrtc.png --incl='^webrtc/modules/bitrate_controller->' \
> --excl='chromium|base|external|testing|webrtc/test|\.h$|\.cc$'
>
> will produce a neat webrtc.png image showcasing the dependencies
> (according to the DEPS file) for the bitrate_controller module.
> Some dependencies are filtered out for readability.
>
> BUG=webrtc:5623
> TESTED=Passing runs using:
> buildtools/checkdeps/checkdeps.py --root=. talk
> buildtools/checkdeps/checkdeps.py --root=. webrtc
>
> R=tommi@webrtc.org
>
> Committed: https://crrev.com/086f851b7b9b4bcbd4fe507c3bf83b760bd7f4d9
> Cr-Commit-Position: refs/heads/master@{#12008}

TBR=tommi@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:5623

Review URL: https://codereview.webrtc.org/1808573002

Cr-Commit-Position: refs/heads/master@{#12009}
2016-03-16 00:41:04 +00:00
kjellander@webrtc.org
086f851b7b Add check_deps rules in DEPS files.
Add fine-grained check_deps rules for all of WebRTC.
This will help both maintaining sane dependencies and provides a way
to visualize dependency graphs using the buildtools/checkdeps/graphdeps.py script.

Example:
buildtools/checkdeps/graphdeps.py --root=. --format=png \
--out=./webrtc.png --incl='^webrtc/modules/bitrate_controller->' \
--excl='chromium|base|external|testing|webrtc/test|\.h$|\.cc$'

will produce a neat webrtc.png image showcasing the dependencies
(according to the DEPS file) for the bitrate_controller module.
Some dependencies are filtered out for readability.

BUG=webrtc:5623
TESTED=Passing runs using:
buildtools/checkdeps/checkdeps.py --root=. talk
buildtools/checkdeps/checkdeps.py --root=. webrtc

R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1796413002 .

Cr-Commit-Position: refs/heads/master@{#12008}
2016-03-16 00:22:53 +00:00
stefan
1069cac518 Tune BWE to be a bit less sensitive to spurious delay events.
Also fixes a bug where the over-use detector threshold can increase to
its max if there has been a long time between two packets.

BUG=webrtc:5646

Review URL: https://codereview.webrtc.org/1782003003

Cr-Commit-Position: refs/heads/master@{#11942}
2016-03-10 13:13:26 +00:00
kwiberg
92931b15d8 Replace scoped_ptr with unique_ptr in webrtc/modules/remote_bitrate_estimator/
BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1750533002

Cr-Commit-Position: refs/heads/master@{#11829}
2016-03-01 13:32:39 +00:00