2014-05-13 11:07:01 +00:00
|
|
|
/*
|
2016-02-07 20:46:45 -08:00
|
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
2014-05-13 11:07:01 +00:00
|
|
|
*
|
2016-02-07 20:46:45 -08:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2014-05-13 11:07:01 +00:00
|
|
|
*/
|
|
|
|
|
|
2016-02-12 06:39:40 +01:00
|
|
|
#ifndef WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_
|
|
|
|
|
#define WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_
|
2014-05-13 11:07:01 +00:00
|
|
|
|
|
|
|
|
#include <map>
|
2016-02-26 03:00:35 -08:00
|
|
|
#include <memory>
|
2016-02-12 13:30:57 +01:00
|
|
|
#include <set>
|
2014-05-13 11:07:01 +00:00
|
|
|
#include <string>
|
2014-08-13 17:26:08 +00:00
|
|
|
#include <vector>
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2016-11-28 07:02:13 -08:00
|
|
|
#include "webrtc/api/call/transport.h"
|
2017-01-10 07:44:26 -08:00
|
|
|
#include "webrtc/api/video/video_frame.h"
|
2016-02-29 00:04:41 -08:00
|
|
|
#include "webrtc/base/asyncinvoker.h"
|
2014-10-08 14:48:08 +00:00
|
|
|
#include "webrtc/base/criticalsection.h"
|
2016-03-29 17:27:21 -07:00
|
|
|
#include "webrtc/base/networkroute.h"
|
2014-09-24 06:05:00 +00:00
|
|
|
#include "webrtc/base/thread_annotations.h"
|
2015-05-07 14:07:48 +02:00
|
|
|
#include "webrtc/base/thread_checker.h"
|
2016-01-28 04:47:08 -08:00
|
|
|
#include "webrtc/media/base/videosinkinterface.h"
|
2016-02-12 13:30:57 +01:00
|
|
|
#include "webrtc/media/base/videosourceinterface.h"
|
2016-12-07 04:52:58 -08:00
|
|
|
#include "webrtc/call/call.h"
|
2017-01-13 07:41:19 -08:00
|
|
|
#include "webrtc/call/flexfec_receive_stream.h"
|
Move talk/media to webrtc/media
I removed the 'libjingle' target in talk/libjingle.gyp and replaced
all users of it with base/base.gyp:rtc_base. It seems the jsoncpp
and expat dependencies were not used by it's previous references.
The files in talk/media/testdata were uploaded to Google Storage and
added .sha1 files in resources/media instead of simply moving them.
The previously disabled warnings that were inherited from
talk/build/common.gypi are now replaced by target-specific disabling
of only the failing warnings. Additional disabling was needed since the stricter
compilation warnings that applies to code in webrtc/.
License headers will be updated in a follow-up CL in order to not
break Git history.
Other modifications:
* Updated the header guards.
* Sorted the includes using chromium/src/tools/sort-headers.py
except for these files:
talk/app/webrtc/peerconnectionendtoend_unittest.cc
talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
talk/app/webrtc/java/jni/androidmediaencoder_jni.cc
webrtc/media/devices/win32devicemanager.cc.
* Unused GYP reference to libjingle_tests_additional_deps was removed.
* Removed duplicated GYP entries of
webrtc/base/testutils.cc
webrtc/base/testutils.h
The HAVE_WEBRTC_VIDEO and HAVE_WEBRTC_VOICE defines were used by only talk/media,
so they were moved to the media.gyp.
I also checked that none of
EXPAT_RELATIVE_PATH,
FEATURE_ENABLE_VOICEMAIL,
GTEST_RELATIVE_PATH,
JSONCPP_RELATIVE_PATH,
LOGGING=1,
SRTP_RELATIVE_PATH,
FEATURE_ENABLE_SSL,
FEATURE_ENABLE_VOICEMAIL,
FEATURE_ENABLE_PSTN,
HAVE_SCTP,
HAVE_SRTP,
are used by the talk/media code.
For Chromium, the following changes will need to be applied to the roll CL that updates the
DEPS for WebRTC and libjingle: https://codereview.chromium.org/1604303002/
BUG=webrtc:5420
NOPRESUBMIT=True
TBR=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1587193006
Cr-Commit-Position: refs/heads/master@{#11495}
2016-02-04 23:52:28 -08:00
|
|
|
#include "webrtc/media/base/mediaengine.h"
|
2016-02-12 06:39:40 +01:00
|
|
|
#include "webrtc/media/engine/webrtcvideodecoderfactory.h"
|
|
|
|
|
#include "webrtc/media/engine/webrtcvideoencoderfactory.h"
|
2014-08-13 17:26:08 +00:00
|
|
|
#include "webrtc/video_receive_stream.h"
|
2014-05-13 11:07:01 +00:00
|
|
|
#include "webrtc/video_send_stream.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
class VideoDecoder;
|
|
|
|
|
class VideoEncoder;
|
2016-02-12 02:27:06 -08:00
|
|
|
struct MediaConfig;
|
2014-05-13 11:07:01 +00:00
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
namespace rtc {
|
2014-05-13 11:07:01 +00:00
|
|
|
class Thread;
|
2014-07-29 17:36:52 +00:00
|
|
|
} // namespace rtc
|
2014-05-13 11:07:01 +00:00
|
|
|
|
|
|
|
|
namespace cricket {
|
|
|
|
|
|
|
|
|
|
class VideoCapturer;
|
|
|
|
|
class VideoProcessor;
|
|
|
|
|
class VideoRenderer;
|
|
|
|
|
class VoiceMediaChannel;
|
|
|
|
|
class WebRtcDecoderObserver;
|
|
|
|
|
class WebRtcEncoderObserver;
|
|
|
|
|
class WebRtcLocalStreamInfo;
|
|
|
|
|
class WebRtcRenderAdapter;
|
2016-10-15 11:29:55 -07:00
|
|
|
class WebRtcVideoChannel2;
|
2014-05-13 11:07:01 +00:00
|
|
|
class WebRtcVideoChannelRecvInfo;
|
|
|
|
|
class WebRtcVideoChannelSendInfo;
|
|
|
|
|
class WebRtcVoiceEngine;
|
2015-05-07 14:07:48 +02:00
|
|
|
class WebRtcVoiceMediaChannel;
|
2014-05-13 11:07:01 +00:00
|
|
|
|
|
|
|
|
struct Device;
|
|
|
|
|
|
2014-08-12 23:17:13 +00:00
|
|
|
class UnsignalledSsrcHandler {
|
|
|
|
|
public:
|
|
|
|
|
enum Action {
|
|
|
|
|
kDropPacket,
|
|
|
|
|
kDeliverPacket,
|
|
|
|
|
};
|
2015-03-06 15:35:19 +00:00
|
|
|
virtual Action OnUnsignalledSsrc(WebRtcVideoChannel2* channel,
|
2014-08-12 23:17:13 +00:00
|
|
|
uint32_t ssrc) = 0;
|
2016-05-12 08:10:52 +02:00
|
|
|
virtual ~UnsignalledSsrcHandler() = default;
|
2014-08-12 23:17:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// TODO(pbos): Remove, use external handlers only.
|
|
|
|
|
class DefaultUnsignalledSsrcHandler : public UnsignalledSsrcHandler {
|
|
|
|
|
public:
|
|
|
|
|
DefaultUnsignalledSsrcHandler();
|
2015-03-06 15:35:19 +00:00
|
|
|
Action OnUnsignalledSsrc(WebRtcVideoChannel2* channel,
|
|
|
|
|
uint32_t ssrc) override;
|
2014-08-12 23:17:13 +00:00
|
|
|
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
rtc::VideoSinkInterface<webrtc::VideoFrame>* GetDefaultSink() const;
|
2016-02-04 01:24:52 -08:00
|
|
|
void SetDefaultSink(VideoMediaChannel* channel,
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink);
|
2016-05-12 08:10:52 +02:00
|
|
|
virtual ~DefaultUnsignalledSsrcHandler() = default;
|
2014-08-12 23:17:13 +00:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
uint32_t default_recv_ssrc_;
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
rtc::VideoSinkInterface<webrtc::VideoFrame>* default_sink_;
|
2014-08-12 23:17:13 +00:00
|
|
|
};
|
|
|
|
|
|
2014-05-13 11:07:01 +00:00
|
|
|
// WebRtcVideoEngine2 is used for the new native WebRTC Video API (webrtc:1667).
|
2015-09-15 12:26:33 +02:00
|
|
|
class WebRtcVideoEngine2 {
|
2014-05-13 11:07:01 +00:00
|
|
|
public:
|
2015-09-15 12:26:33 +02:00
|
|
|
WebRtcVideoEngine2();
|
2016-05-12 08:10:52 +02:00
|
|
|
virtual ~WebRtcVideoEngine2();
|
2014-05-13 11:07:01 +00:00
|
|
|
|
|
|
|
|
// Basic video engine implementation.
|
2015-05-22 09:04:09 +02:00
|
|
|
void Init();
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2015-09-15 12:26:33 +02:00
|
|
|
WebRtcVideoChannel2* CreateChannel(webrtc::Call* call,
|
2016-02-12 02:27:06 -08:00
|
|
|
const MediaConfig& config,
|
2015-09-15 12:26:33 +02:00
|
|
|
const VideoOptions& options);
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2016-11-28 06:02:22 -08:00
|
|
|
std::vector<VideoCodec> codecs() const;
|
2015-12-07 10:45:43 +01:00
|
|
|
RtpCapabilities GetCapabilities() const;
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2014-09-23 09:40:22 +00:00
|
|
|
// Set a WebRtcVideoDecoderFactory for external decoding. Video engine does
|
|
|
|
|
// not take the ownership of |decoder_factory|. The caller needs to make sure
|
|
|
|
|
// that |decoder_factory| outlives the video engine.
|
|
|
|
|
void SetExternalDecoderFactory(WebRtcVideoDecoderFactory* decoder_factory);
|
|
|
|
|
// Set a WebRtcVideoEncoderFactory for external encoding. Video engine does
|
|
|
|
|
// not take the ownership of |encoder_factory|. The caller needs to make sure
|
|
|
|
|
// that |encoder_factory| outlives the video engine.
|
|
|
|
|
virtual void SetExternalEncoderFactory(
|
|
|
|
|
WebRtcVideoEncoderFactory* encoder_factory);
|
|
|
|
|
|
2014-05-13 11:07:01 +00:00
|
|
|
private:
|
|
|
|
|
bool initialized_;
|
|
|
|
|
|
2014-09-23 09:40:22 +00:00
|
|
|
WebRtcVideoDecoderFactory* external_decoder_factory_;
|
|
|
|
|
WebRtcVideoEncoderFactory* external_encoder_factory_;
|
2016-02-26 03:00:35 -08:00
|
|
|
std::unique_ptr<WebRtcVideoEncoderFactory> simulcast_encoder_factory_;
|
2014-05-13 11:07:01 +00:00
|
|
|
};
|
|
|
|
|
|
2016-02-29 00:04:41 -08:00
|
|
|
class WebRtcVideoChannel2 : public VideoMediaChannel, public webrtc::Transport {
|
2014-05-13 11:07:01 +00:00
|
|
|
public:
|
2015-09-15 12:26:33 +02:00
|
|
|
WebRtcVideoChannel2(webrtc::Call* call,
|
2016-02-12 02:27:06 -08:00
|
|
|
const MediaConfig& config,
|
2014-10-20 11:07:07 +00:00
|
|
|
const VideoOptions& options,
|
2014-10-14 04:25:33 +00:00
|
|
|
WebRtcVideoEncoderFactory* external_encoder_factory,
|
2015-01-14 17:29:27 +00:00
|
|
|
WebRtcVideoDecoderFactory* external_decoder_factory);
|
2015-09-15 12:26:33 +02:00
|
|
|
~WebRtcVideoChannel2() override;
|
2014-05-13 11:07:01 +00:00
|
|
|
|
|
|
|
|
// VideoMediaChannel implementation
|
2016-02-12 02:27:06 -08:00
|
|
|
rtc::DiffServCodePoint PreferredDscp() const override;
|
|
|
|
|
|
2015-08-07 16:05:34 -07:00
|
|
|
bool SetSendParameters(const VideoSendParameters& params) override;
|
|
|
|
|
bool SetRecvParameters(const VideoRecvParameters& params) override;
|
2016-05-16 11:40:30 -07:00
|
|
|
webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const override;
|
|
|
|
|
bool SetRtpSendParameters(uint32_t ssrc,
|
|
|
|
|
const webrtc::RtpParameters& parameters) override;
|
|
|
|
|
webrtc::RtpParameters GetRtpReceiveParameters(uint32_t ssrc) const override;
|
|
|
|
|
bool SetRtpReceiveParameters(
|
|
|
|
|
uint32_t ssrc,
|
|
|
|
|
const webrtc::RtpParameters& parameters) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
bool GetSendCodec(VideoCodec* send_codec) override;
|
|
|
|
|
bool SetSend(bool send) override;
|
2016-06-02 16:23:38 -07:00
|
|
|
bool SetVideoSend(
|
|
|
|
|
uint32_t ssrc,
|
|
|
|
|
bool enable,
|
|
|
|
|
const VideoOptions* options,
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
rtc::VideoSourceInterface<webrtc::VideoFrame>* source) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
bool AddSendStream(const StreamParams& sp) override;
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
bool RemoveSendStream(uint32_t ssrc) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
bool AddRecvStream(const StreamParams& sp) override;
|
2015-03-06 15:35:19 +00:00
|
|
|
bool AddRecvStream(const StreamParams& sp, bool default_stream);
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
bool RemoveRecvStream(uint32_t ssrc) override;
|
2016-02-04 01:24:52 -08:00
|
|
|
bool SetSink(uint32_t ssrc,
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
bool GetStats(VideoMediaInfo* info) override;
|
|
|
|
|
|
2016-03-20 06:15:43 -07:00
|
|
|
void OnPacketReceived(rtc::CopyOnWriteBuffer* packet,
|
2015-03-04 12:58:35 +00:00
|
|
|
const rtc::PacketTime& packet_time) override;
|
2016-03-20 06:15:43 -07:00
|
|
|
void OnRtcpReceived(rtc::CopyOnWriteBuffer* packet,
|
2015-03-04 12:58:35 +00:00
|
|
|
const rtc::PacketTime& packet_time) override;
|
|
|
|
|
void OnReadyToSend(bool ready) override;
|
2016-03-29 17:27:21 -07:00
|
|
|
void OnNetworkRouteChanged(const std::string& transport_name,
|
2016-04-19 15:41:36 -07:00
|
|
|
const rtc::NetworkRoute& network_route) override;
|
2016-11-08 02:50:09 -08:00
|
|
|
void OnTransportOverheadChanged(int transport_overhead_per_packet) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
void SetInterface(NetworkInterface* iface) override;
|
2014-05-13 11:07:01 +00:00
|
|
|
|
|
|
|
|
// Implemented for VideoMediaChannelTest.
|
|
|
|
|
bool sending() const { return sending_; }
|
|
|
|
|
|
2016-04-05 15:23:49 +02:00
|
|
|
// AdaptReason is used for expressing why a WebRtcVideoSendStream request
|
|
|
|
|
// a lower input frame size than the currently configured camera input frame
|
|
|
|
|
// size. There can be more than one reason OR:ed together.
|
|
|
|
|
enum AdaptReason {
|
|
|
|
|
ADAPTREASON_NONE = 0,
|
|
|
|
|
ADAPTREASON_CPU = 1,
|
|
|
|
|
ADAPTREASON_BANDWIDTH = 2,
|
|
|
|
|
};
|
|
|
|
|
|
2014-05-13 11:07:01 +00:00
|
|
|
private:
|
2016-01-28 15:58:41 -08:00
|
|
|
class WebRtcVideoReceiveStream;
|
2016-01-27 16:45:21 +01:00
|
|
|
struct VideoCodecSettings {
|
|
|
|
|
VideoCodecSettings();
|
|
|
|
|
|
|
|
|
|
bool operator==(const VideoCodecSettings& other) const;
|
|
|
|
|
bool operator!=(const VideoCodecSettings& other) const;
|
|
|
|
|
|
|
|
|
|
VideoCodec codec;
|
2016-10-04 23:28:39 -07:00
|
|
|
webrtc::UlpfecConfig ulpfec;
|
2016-12-19 09:41:04 -08:00
|
|
|
int flexfec_payload_type;
|
2016-01-27 16:45:21 +01:00
|
|
|
int rtx_payload_type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ChangedSendParameters {
|
|
|
|
|
// These optionals are unset if not changed.
|
|
|
|
|
rtc::Optional<VideoCodecSettings> codec;
|
|
|
|
|
rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
|
|
|
|
|
rtc::Optional<int> max_bandwidth_bps;
|
2016-02-17 05:25:36 -08:00
|
|
|
rtc::Optional<bool> conference_mode;
|
2016-01-27 16:45:21 +01:00
|
|
|
rtc::Optional<webrtc::RtcpMode> rtcp_mode;
|
|
|
|
|
};
|
2016-01-28 15:58:41 -08:00
|
|
|
|
|
|
|
|
struct ChangedRecvParameters {
|
|
|
|
|
// These optionals are unset if not changed.
|
|
|
|
|
rtc::Optional<std::vector<VideoCodecSettings>> codec_settings;
|
|
|
|
|
rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
|
|
|
|
|
};
|
|
|
|
|
|
2016-01-27 16:45:21 +01:00
|
|
|
bool GetChangedSendParameters(const VideoSendParameters& params,
|
|
|
|
|
ChangedSendParameters* changed_params) const;
|
2016-01-28 15:58:41 -08:00
|
|
|
bool GetChangedRecvParameters(const VideoRecvParameters& params,
|
|
|
|
|
ChangedRecvParameters* changed_params) const;
|
|
|
|
|
|
2016-01-27 16:45:21 +01:00
|
|
|
void SetMaxSendBandwidth(int bps);
|
2015-09-17 16:42:56 +02:00
|
|
|
|
2017-01-13 07:41:19 -08:00
|
|
|
void ConfigureReceiverRtp(
|
|
|
|
|
webrtc::VideoReceiveStream::Config* config,
|
|
|
|
|
webrtc::FlexfecReceiveStream::Config* flexfec_config,
|
|
|
|
|
const StreamParams& sp) const;
|
2015-03-26 16:23:04 +01:00
|
|
|
bool ValidateSendSsrcAvailability(const StreamParams& sp) const
|
|
|
|
|
EXCLUSIVE_LOCKS_REQUIRED(stream_crit_);
|
|
|
|
|
bool ValidateReceiveSsrcAvailability(const StreamParams& sp) const
|
|
|
|
|
EXCLUSIVE_LOCKS_REQUIRED(stream_crit_);
|
|
|
|
|
void DeleteReceiveStream(WebRtcVideoReceiveStream* stream)
|
|
|
|
|
EXCLUSIVE_LOCKS_REQUIRED(stream_crit_);
|
2014-07-18 09:35:58 +00:00
|
|
|
|
2015-08-20 17:19:20 -07:00
|
|
|
static std::string CodecSettingsVectorToString(
|
|
|
|
|
const std::vector<VideoCodecSettings>& codecs);
|
|
|
|
|
|
2017-01-13 05:57:25 -08:00
|
|
|
// Wrapper for the sender part.
|
2016-02-12 13:30:57 +01:00
|
|
|
class WebRtcVideoSendStream
|
2017-01-13 05:57:25 -08:00
|
|
|
: public rtc::VideoSourceInterface<webrtc::VideoFrame> {
|
2014-05-13 11:07:01 +00:00
|
|
|
public:
|
2014-07-17 08:51:46 +00:00
|
|
|
WebRtcVideoSendStream(
|
|
|
|
|
webrtc::Call* call,
|
2015-08-28 04:07:10 -07:00
|
|
|
const StreamParams& sp,
|
2016-09-01 01:17:40 -07:00
|
|
|
webrtc::VideoSendStream::Config config,
|
2016-03-16 02:22:50 -07:00
|
|
|
const VideoOptions& options,
|
2014-10-14 04:25:33 +00:00
|
|
|
WebRtcVideoEncoderFactory* external_encoder_factory,
|
2016-02-29 00:04:41 -08:00
|
|
|
bool enable_cpu_overuse_detection,
|
2015-03-27 15:58:11 +01:00
|
|
|
int max_bitrate_bps,
|
2015-11-10 22:34:18 +01:00
|
|
|
const rtc::Optional<VideoCodecSettings>& codec_settings,
|
Avoid unnecessary HW video encoder reconfiguration
This change reduces the number of times the Android hardware video
encoder is reconfigured when making an outgoing call. With this change,
the encoder should only be initialized once as opposed to the ~3 times
it happens currently.
Before the fix, the following sequence of events caused the extra
reconfigurations:
1. After the SetLocalDescription call, the WebRtcVideoSendStream is created.
All frames from the camera are dropped until the corresponding
VideoSendStream is created.
2. SetRemoteDescription() triggers the VideoSendStream creation. At
this point, the encoder is configured for the first time, with the
frame dimensions set to a low resolution default (176x144).
3. When the first video frame is received from the camera after the
VideoSendStreamIsCreated, the encoder is reconfigured to the correct
dimensions. If we are using the Android hardware encoder, the default
configuration is set to encode from a memory buffer (use_surface=false).
4. When the frame is passed down to the encoder in
androidmediaencoder_jni.cc EncodeOnCodecThread(), it may be stored in
a texture instead of a memory buffer. In this case, yet another
reconfiguration takes place to enable encoding from a texture.
5. Even if the resolution and texture flag were known at the start of
the call, there would be a reconfiguration involved if the camera is
rotated (such as when making a call from a phone in portrait orientation).
The reason for that is that at construction time, WebRtcVideoEngine2
sets the VideoSinkWants structure parameter to request frames rotated
by the source; the early frames will then arrive in portrait resolution.
When the remote description is finally set, if the rotation RTP extension
is supported by the remote receiver, the source is asked to provide
non-rotated frames. The very next frame will then arrive in landscape
resolution with a non-zero rotation value to be applied by the receiver.
Since the encoder was configured with the last (portrait) frame size,
it's going to need to be reconfigured again.
The fix makes the following changes:
1. WebRtcVideoSendStream::OnFrame() now caches the last seen frame
dimensions, and whether the frame was stored in a texture.
2. When the encoder is configured the first time
(WebRtcVideoSendStream::SetCodec()) - the last seen frame dimensions
are used instead of the default dimensions.
3. A flag that indicates if encoding is to be done from a texture has
been added to the webrtc::VideoStream and webrtc::VideoCodec structs,
and it's been wired up to be passed down all the way to the JNI code in
androidmediaencoder_jni.cc.
4. MediaCodecVideoEncoder::InitEncode is now reading the is_surface
flag from the VideoCodec structure instead of guessing the default as
false. This way we end up with the correct encoder configuration the
first time around.
5. WebRtcVideoSendStream now takes an optimistic guess and requests non-
rotated frames when the supported RtpExtensions list is not available.
This makes the "early" frames arrive non-rotated, and the cached dimensions
will be correct for the common case when the rotation extension is supported.
If the other side is an older endpoint which does not support rotation,
the encoder will have to be reconfigured - but it's better to penalize the
uncommon case rather than the common one.
Review-Url: https://codereview.webrtc.org/2067103002
Cr-Commit-Position: refs/heads/master@{#13173}
2016-06-16 12:08:03 -07:00
|
|
|
const rtc::Optional<std::vector<webrtc::RtpExtension>>& rtp_extensions,
|
2015-12-09 12:37:51 -08:00
|
|
|
const VideoSendParameters& send_params);
|
2016-02-12 13:30:57 +01:00
|
|
|
virtual ~WebRtcVideoSendStream();
|
2015-03-26 16:23:04 +01:00
|
|
|
|
2016-01-27 16:45:21 +01:00
|
|
|
void SetSendParameters(const ChangedSendParameters& send_params);
|
2016-03-16 19:07:43 -07:00
|
|
|
bool SetRtpParameters(const webrtc::RtpParameters& parameters);
|
2016-03-22 15:42:00 -07:00
|
|
|
webrtc::RtpParameters GetRtpParameters() const;
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2016-09-16 07:53:41 -07:00
|
|
|
// Implements rtc::VideoSourceInterface<webrtc::VideoFrame>.
|
|
|
|
|
// WebRtcVideoSendStream acts as a source to the webrtc::VideoSendStream
|
2017-01-13 05:57:25 -08:00
|
|
|
// in |stream_|. This is done to proxy VideoSinkWants from the encoder to
|
|
|
|
|
// the worker thread.
|
|
|
|
|
void AddOrUpdateSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink,
|
2016-09-16 07:53:41 -07:00
|
|
|
const rtc::VideoSinkWants& wants) override;
|
2017-01-13 05:57:25 -08:00
|
|
|
void RemoveSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) override;
|
2016-09-16 07:53:41 -07:00
|
|
|
|
2016-06-02 16:23:38 -07:00
|
|
|
bool SetVideoSend(bool mute,
|
|
|
|
|
const VideoOptions* options,
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
rtc::VideoSourceInterface<webrtc::VideoFrame>* source);
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2016-03-22 15:42:00 -07:00
|
|
|
void SetSend(bool send);
|
2016-03-16 19:07:43 -07:00
|
|
|
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
const std::vector<uint32_t>& GetSsrcs() const;
|
2016-08-11 08:41:18 -07:00
|
|
|
VideoSenderInfo GetVideoSenderInfo(bool log_stats);
|
2014-11-05 14:05:29 +00:00
|
|
|
void FillBandwidthEstimationInfo(BandwidthEstimationInfo* bwe_info);
|
2014-07-18 11:11:55 +00:00
|
|
|
|
2014-05-13 11:07:01 +00:00
|
|
|
private:
|
2014-06-06 10:49:19 +00:00
|
|
|
// Parameters needed to reconstruct the underlying stream.
|
|
|
|
|
// webrtc::VideoSendStream doesn't support setting a lot of options on the
|
|
|
|
|
// fly, so when those need to be changed we tear down and reconstruct with
|
|
|
|
|
// similar parameters depending on which options changed etc.
|
|
|
|
|
struct VideoSendStreamParameters {
|
|
|
|
|
VideoSendStreamParameters(
|
2016-09-01 01:17:40 -07:00
|
|
|
webrtc::VideoSendStream::Config config,
|
2014-06-06 10:49:19 +00:00
|
|
|
const VideoOptions& options,
|
2015-03-27 15:58:11 +01:00
|
|
|
int max_bitrate_bps,
|
2015-11-10 22:34:18 +01:00
|
|
|
const rtc::Optional<VideoCodecSettings>& codec_settings);
|
2014-06-06 10:49:19 +00:00
|
|
|
webrtc::VideoSendStream::Config config;
|
|
|
|
|
VideoOptions options;
|
2015-03-27 15:58:11 +01:00
|
|
|
int max_bitrate_bps;
|
2016-02-17 05:25:36 -08:00
|
|
|
bool conference_mode;
|
2015-11-10 22:34:18 +01:00
|
|
|
rtc::Optional<VideoCodecSettings> codec_settings;
|
2014-06-06 10:49:19 +00:00
|
|
|
// Sent resolutions + bitrates etc. by the underlying VideoSendStream,
|
|
|
|
|
// typically changes when setting a new resolution or reconfiguring
|
|
|
|
|
// bitrates.
|
2014-09-19 12:30:25 +00:00
|
|
|
webrtc::VideoEncoderConfig encoder_config;
|
2014-06-06 10:49:19 +00:00
|
|
|
};
|
|
|
|
|
|
2014-10-14 04:25:33 +00:00
|
|
|
struct AllocatedEncoder {
|
|
|
|
|
AllocatedEncoder(webrtc::VideoEncoder* encoder,
|
Reland of Stop using hardcoded payload types for video codecs (patchset #1 id:1 of https://codereview.webrtc.org/2513633002/ )
Reason for revert:
The WebRtcBrowserTest.NegotiateUnsupportedVideoCodec test has been fixed in Chromium with the following change:
function removeVideoCodec(offerSdp) {
- offerSdp = offerSdp.replace('a=rtpmap:100 VP8/90000\r\n',
- 'a=rtpmap:100 XVP8/90000\r\n');
+ offerSdp = offerSdp.replace(/a=rtpmap:(\d+)\ VP8\/90000\r\n/,
+ 'a=rtpmap:$1 XVP8/90000\r\n');
return offerSdp;
}
Original issue's description:
> Revert of Stop using hardcoded payload types for video codecs (patchset #6 id:210001 of https://codereview.webrtc.org/2493133002/ )
>
> Reason for revert:
> Breaks chromium.fyi test:
> WebRtcBrowserTest.NegotiateUnsupportedVideoCodec
>
> Original issue's description:
> > Stop using hardcoded payload types for video codecs
> >
> > This CL stops using hardcoded payload types for different video codecs
> > and will dynamically assign them payload types incrementally from 96 to
> > 127 instead.
> >
> > This CL:
> > * Replaces 'std::vector<VideoCodec> DefaultVideoCodecList()' in
> > webrtcvideoengine2.cc with an explicit WebRtcVideoEncoderFactory for
> > internally supported software codecs instead. The purpose is to
> > streamline the payload type assignment in webrtcvideoengine2.cc which
> > will now have two encoder factories of the same
> > WebRtcVideoEncoderFactory type; one internal and one external.
> > * Removes webrtc::VideoEncoder::EncoderType and use cricket::VideoCodec
> > instead.
> > * Removes 'static VideoEncoder* Create(EncoderType codec_type)' and
> > moves the create function to the internal encoder factory instead.
> > * Removes video_encoder.cc. webrtc::VideoEncoder is now just an
> > interface without any static functions.
> > * The function GetSupportedCodecs in webrtcvideoengine2.cc unifies
> > the internal and external codecs and assigns them payload types
> > incrementally from 96 to 127.
> > * Updates webrtcvideoengine2_unittest.cc and removes assumptions about
> > what payload types will be used.
> >
> > BUG=webrtc:6677,webrtc:6705
> > R=hta@webrtc.org, ossu@webrtc.org, stefan@webrtc.org
> >
> > Committed: https://crrev.com/42043b95872b51321f508bf255d804ce3dff366b
> > Cr-Commit-Position: refs/heads/master@{#15135}
>
> TBR=hta@webrtc.org,stefan@webrtc.org,ossu@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:6677,webrtc:6705
>
> Committed: https://crrev.com/eacbaea920797ff751ca83050d140821f5055591
> Cr-Commit-Position: refs/heads/master@{#15140}
TBR=hta@webrtc.org,stefan@webrtc.org,ossu@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6677,webrtc:6705
Review-Url: https://codereview.webrtc.org/2511933002
Cr-Commit-Position: refs/heads/master@{#15148}
2016-11-18 01:34:11 -08:00
|
|
|
const cricket::VideoCodec& codec,
|
2015-05-19 23:09:35 +02:00
|
|
|
bool external);
|
2014-10-14 04:25:33 +00:00
|
|
|
webrtc::VideoEncoder* encoder;
|
2015-05-19 23:09:35 +02:00
|
|
|
webrtc::VideoEncoder* external_encoder;
|
Reland of Stop using hardcoded payload types for video codecs (patchset #1 id:1 of https://codereview.webrtc.org/2513633002/ )
Reason for revert:
The WebRtcBrowserTest.NegotiateUnsupportedVideoCodec test has been fixed in Chromium with the following change:
function removeVideoCodec(offerSdp) {
- offerSdp = offerSdp.replace('a=rtpmap:100 VP8/90000\r\n',
- 'a=rtpmap:100 XVP8/90000\r\n');
+ offerSdp = offerSdp.replace(/a=rtpmap:(\d+)\ VP8\/90000\r\n/,
+ 'a=rtpmap:$1 XVP8/90000\r\n');
return offerSdp;
}
Original issue's description:
> Revert of Stop using hardcoded payload types for video codecs (patchset #6 id:210001 of https://codereview.webrtc.org/2493133002/ )
>
> Reason for revert:
> Breaks chromium.fyi test:
> WebRtcBrowserTest.NegotiateUnsupportedVideoCodec
>
> Original issue's description:
> > Stop using hardcoded payload types for video codecs
> >
> > This CL stops using hardcoded payload types for different video codecs
> > and will dynamically assign them payload types incrementally from 96 to
> > 127 instead.
> >
> > This CL:
> > * Replaces 'std::vector<VideoCodec> DefaultVideoCodecList()' in
> > webrtcvideoengine2.cc with an explicit WebRtcVideoEncoderFactory for
> > internally supported software codecs instead. The purpose is to
> > streamline the payload type assignment in webrtcvideoengine2.cc which
> > will now have two encoder factories of the same
> > WebRtcVideoEncoderFactory type; one internal and one external.
> > * Removes webrtc::VideoEncoder::EncoderType and use cricket::VideoCodec
> > instead.
> > * Removes 'static VideoEncoder* Create(EncoderType codec_type)' and
> > moves the create function to the internal encoder factory instead.
> > * Removes video_encoder.cc. webrtc::VideoEncoder is now just an
> > interface without any static functions.
> > * The function GetSupportedCodecs in webrtcvideoengine2.cc unifies
> > the internal and external codecs and assigns them payload types
> > incrementally from 96 to 127.
> > * Updates webrtcvideoengine2_unittest.cc and removes assumptions about
> > what payload types will be used.
> >
> > BUG=webrtc:6677,webrtc:6705
> > R=hta@webrtc.org, ossu@webrtc.org, stefan@webrtc.org
> >
> > Committed: https://crrev.com/42043b95872b51321f508bf255d804ce3dff366b
> > Cr-Commit-Position: refs/heads/master@{#15135}
>
> TBR=hta@webrtc.org,stefan@webrtc.org,ossu@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:6677,webrtc:6705
>
> Committed: https://crrev.com/eacbaea920797ff751ca83050d140821f5055591
> Cr-Commit-Position: refs/heads/master@{#15140}
TBR=hta@webrtc.org,stefan@webrtc.org,ossu@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:6677,webrtc:6705
Review-Url: https://codereview.webrtc.org/2511933002
Cr-Commit-Position: refs/heads/master@{#15148}
2016-11-18 01:34:11 -08:00
|
|
|
cricket::VideoCodec codec;
|
2014-10-14 04:25:33 +00:00
|
|
|
bool external;
|
|
|
|
|
};
|
|
|
|
|
|
2016-09-27 03:52:02 -07:00
|
|
|
rtc::scoped_refptr<webrtc::VideoEncoderConfig::EncoderSpecificSettings>
|
2016-10-02 23:45:26 -07:00
|
|
|
ConfigureVideoEncoderSettings(const VideoCodec& codec);
|
|
|
|
|
AllocatedEncoder CreateVideoEncoder(const VideoCodec& codec);
|
|
|
|
|
void DestroyVideoEncoder(AllocatedEncoder* encoder);
|
|
|
|
|
void SetCodec(const VideoCodecSettings& codec);
|
|
|
|
|
void RecreateWebRtcStream();
|
2014-11-07 10:54:43 +00:00
|
|
|
webrtc::VideoEncoderConfig CreateVideoEncoderConfig(
|
2016-10-02 23:45:26 -07:00
|
|
|
const VideoCodec& codec) const;
|
|
|
|
|
void ReconfigureEncoder();
|
2016-03-16 19:07:43 -07:00
|
|
|
bool ValidateRtpParameters(const webrtc::RtpParameters& parameters);
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2016-03-22 15:42:00 -07:00
|
|
|
// Calls Start or Stop according to whether or not |sending_| is true,
|
|
|
|
|
// and whether or not the encoding in |rtp_parameters_| is active.
|
2016-10-02 23:45:26 -07:00
|
|
|
void UpdateSendState();
|
2016-03-22 15:42:00 -07:00
|
|
|
|
2016-02-29 00:04:41 -08:00
|
|
|
rtc::ThreadChecker thread_checker_;
|
|
|
|
|
rtc::AsyncInvoker invoker_;
|
|
|
|
|
rtc::Thread* worker_thread_;
|
2016-10-02 23:45:26 -07:00
|
|
|
const std::vector<uint32_t> ssrcs_ ACCESS_ON(&thread_checker_);
|
|
|
|
|
const std::vector<SsrcGroup> ssrc_groups_ ACCESS_ON(&thread_checker_);
|
2014-05-13 11:07:01 +00:00
|
|
|
webrtc::Call* const call_;
|
2016-11-01 11:45:46 -07:00
|
|
|
const bool enable_cpu_overuse_detection_;
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
rtc::VideoSourceInterface<webrtc::VideoFrame>* source_
|
2016-10-02 23:45:26 -07:00
|
|
|
ACCESS_ON(&thread_checker_);
|
2014-11-07 10:54:43 +00:00
|
|
|
WebRtcVideoEncoderFactory* const external_encoder_factory_
|
2016-10-02 23:45:26 -07:00
|
|
|
ACCESS_ON(&thread_checker_);
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2016-10-02 23:45:26 -07:00
|
|
|
webrtc::VideoSendStream* stream_ ACCESS_ON(&thread_checker_);
|
2016-09-16 07:53:41 -07:00
|
|
|
rtc::VideoSinkInterface<webrtc::VideoFrame>* encoder_sink_
|
2017-01-13 05:57:25 -08:00
|
|
|
ACCESS_ON(&thread_checker_);
|
2016-03-16 19:07:43 -07:00
|
|
|
// Contains settings that are the same for all streams in the MediaChannel,
|
|
|
|
|
// such as codecs, header extensions, and the global bitrate limit for the
|
|
|
|
|
// entire channel.
|
2016-10-02 23:45:26 -07:00
|
|
|
VideoSendStreamParameters parameters_ ACCESS_ON(&thread_checker_);
|
2016-03-16 19:07:43 -07:00
|
|
|
// Contains settings that are unique for each stream, such as max_bitrate.
|
2016-04-20 16:23:10 -07:00
|
|
|
// Does *not* contain codecs, however.
|
2016-03-16 19:07:43 -07:00
|
|
|
// TODO(skvlad): Move ssrcs_ and ssrc_groups_ into rtp_parameters_.
|
|
|
|
|
// TODO(skvlad): Combine parameters_ and rtp_parameters_ once we have only
|
|
|
|
|
// one stream per MediaChannel.
|
2016-10-02 23:45:26 -07:00
|
|
|
webrtc::RtpParameters rtp_parameters_ ACCESS_ON(&thread_checker_);
|
|
|
|
|
AllocatedEncoder allocated_encoder_ ACCESS_ON(&thread_checker_);
|
2014-06-06 10:49:19 +00:00
|
|
|
|
2016-10-02 23:45:26 -07:00
|
|
|
bool sending_ ACCESS_ON(&thread_checker_);
|
2014-05-13 11:07:01 +00:00
|
|
|
};
|
|
|
|
|
|
2014-07-18 09:35:58 +00:00
|
|
|
// Wrapper for the receiver part, contains configs etc. that are needed to
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
// reconstruct the underlying VideoReceiveStream.
|
2016-03-23 04:48:10 -07:00
|
|
|
class WebRtcVideoReceiveStream
|
|
|
|
|
: public rtc::VideoSinkInterface<webrtc::VideoFrame> {
|
2014-07-18 09:35:58 +00:00
|
|
|
public:
|
|
|
|
|
WebRtcVideoReceiveStream(
|
2015-05-28 13:39:50 +02:00
|
|
|
webrtc::Call* call,
|
|
|
|
|
const StreamParams& sp,
|
2016-06-10 17:58:01 +02:00
|
|
|
webrtc::VideoReceiveStream::Config config,
|
2014-10-29 15:28:39 +00:00
|
|
|
WebRtcVideoDecoderFactory* external_decoder_factory,
|
2015-03-06 15:35:19 +00:00
|
|
|
bool default_stream,
|
2016-11-22 02:16:47 -08:00
|
|
|
const std::vector<VideoCodecSettings>& recv_codecs,
|
2017-01-13 07:41:19 -08:00
|
|
|
const webrtc::FlexfecReceiveStream::Config& flexfec_config);
|
2014-07-18 09:35:58 +00:00
|
|
|
~WebRtcVideoReceiveStream();
|
|
|
|
|
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
const std::vector<uint32_t>& GetSsrcs() const;
|
2016-06-22 00:46:15 -07:00
|
|
|
rtc::Optional<uint32_t> GetFirstPrimarySsrc() const;
|
2015-03-26 16:23:04 +01:00
|
|
|
|
2015-05-22 18:48:36 +02:00
|
|
|
void SetLocalSsrc(uint32_t local_ssrc);
|
2016-03-18 15:02:07 -07:00
|
|
|
// TODO(deadbeef): Move these feedback parameters into the recv parameters.
|
2015-11-20 18:05:48 -08:00
|
|
|
void SetFeedbackParameters(bool nack_enabled,
|
|
|
|
|
bool remb_enabled,
|
2016-03-18 15:02:07 -07:00
|
|
|
bool transport_cc_enabled,
|
|
|
|
|
webrtc::RtcpMode rtcp_mode);
|
2016-01-28 15:58:41 -08:00
|
|
|
void SetRecvParameters(const ChangedRecvParameters& recv_params);
|
2014-07-18 09:35:58 +00:00
|
|
|
|
2016-03-21 01:27:56 -07:00
|
|
|
void OnFrame(const webrtc::VideoFrame& frame) override;
|
2015-03-06 15:35:19 +00:00
|
|
|
bool IsDefaultStream() const;
|
2014-07-18 09:35:58 +00:00
|
|
|
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
void SetSink(rtc::VideoSinkInterface<webrtc::VideoFrame>* sink);
|
2014-07-18 09:35:58 +00:00
|
|
|
|
2016-08-11 08:41:18 -07:00
|
|
|
VideoReceiverInfo GetVideoReceiverInfo(bool log_stats);
|
2014-07-18 11:11:55 +00:00
|
|
|
|
2014-07-18 09:35:58 +00:00
|
|
|
private:
|
2014-10-29 15:28:39 +00:00
|
|
|
struct AllocatedDecoder {
|
2014-11-03 14:46:44 +00:00
|
|
|
AllocatedDecoder(webrtc::VideoDecoder* decoder,
|
|
|
|
|
webrtc::VideoCodecType type,
|
2015-05-18 19:42:03 +02:00
|
|
|
bool external);
|
2014-10-29 15:28:39 +00:00
|
|
|
webrtc::VideoDecoder* decoder;
|
2015-05-18 19:42:03 +02:00
|
|
|
// Decoder wrapped into a fallback decoder to permit software fallback.
|
|
|
|
|
webrtc::VideoDecoder* external_decoder;
|
2014-11-03 14:46:44 +00:00
|
|
|
webrtc::VideoCodecType type;
|
2014-10-29 15:28:39 +00:00
|
|
|
bool external;
|
|
|
|
|
};
|
|
|
|
|
|
2014-07-18 09:35:58 +00:00
|
|
|
void RecreateWebRtcStream();
|
|
|
|
|
|
2016-01-28 15:58:41 -08:00
|
|
|
void ConfigureCodecs(const std::vector<VideoCodecSettings>& recv_codecs,
|
|
|
|
|
std::vector<AllocatedDecoder>* old_codecs);
|
2014-11-03 14:46:44 +00:00
|
|
|
AllocatedDecoder CreateOrReuseVideoDecoder(
|
|
|
|
|
std::vector<AllocatedDecoder>* old_decoder,
|
|
|
|
|
const VideoCodec& codec);
|
|
|
|
|
void ClearDecoders(std::vector<AllocatedDecoder>* allocated_decoders);
|
2014-10-29 15:28:39 +00:00
|
|
|
|
2015-08-28 07:35:32 -07:00
|
|
|
std::string GetCodecNameFromPayloadType(int payload_type);
|
|
|
|
|
|
2014-07-18 09:35:58 +00:00
|
|
|
webrtc::Call* const call_;
|
2016-06-22 00:46:15 -07:00
|
|
|
StreamParams stream_params_;
|
2014-07-18 09:35:58 +00:00
|
|
|
|
2016-11-22 02:16:47 -08:00
|
|
|
// Both |stream_| and |flexfec_stream_| are managed by |this|. They are
|
|
|
|
|
// destroyed by calling call_->DestroyVideoReceiveStream and
|
|
|
|
|
// call_->DestroyFlexfecReceiveStream, respectively.
|
2014-07-18 09:35:58 +00:00
|
|
|
webrtc::VideoReceiveStream* stream_;
|
2015-03-06 15:35:19 +00:00
|
|
|
const bool default_stream_;
|
2014-07-18 09:35:58 +00:00
|
|
|
webrtc::VideoReceiveStream::Config config_;
|
2017-01-13 07:41:19 -08:00
|
|
|
webrtc::FlexfecReceiveStream::Config flexfec_config_;
|
2016-11-22 02:16:47 -08:00
|
|
|
webrtc::FlexfecReceiveStream* flexfec_stream_;
|
2014-07-18 09:35:58 +00:00
|
|
|
|
2014-10-29 15:28:39 +00:00
|
|
|
WebRtcVideoDecoderFactory* const external_decoder_factory_;
|
|
|
|
|
std::vector<AllocatedDecoder> allocated_decoders_;
|
|
|
|
|
|
2016-01-28 04:47:08 -08:00
|
|
|
rtc::CriticalSection sink_lock_;
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink_ GUARDED_BY(sink_lock_);
|
2015-01-27 09:57:01 +00:00
|
|
|
// Expands remote RTP timestamps to int64_t to be able to estimate how long
|
|
|
|
|
// the stream has been running.
|
|
|
|
|
rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_
|
2016-01-28 04:47:08 -08:00
|
|
|
GUARDED_BY(sink_lock_);
|
|
|
|
|
int64_t first_frame_timestamp_ GUARDED_BY(sink_lock_);
|
2015-01-27 09:57:01 +00:00
|
|
|
// Start NTP time is estimated as current remote NTP time (estimated from
|
|
|
|
|
// RTCP) minus the elapsed time, as soon as remote NTP time is available.
|
2016-01-28 04:47:08 -08:00
|
|
|
int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_);
|
2014-07-18 09:35:58 +00:00
|
|
|
};
|
|
|
|
|
|
2014-05-13 11:07:01 +00:00
|
|
|
void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine);
|
|
|
|
|
|
2015-10-02 03:39:33 -07:00
|
|
|
bool SendRtp(const uint8_t* data,
|
|
|
|
|
size_t len,
|
|
|
|
|
const webrtc::PacketOptions& options) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
bool SendRtcp(const uint8_t* data, size_t len) override;
|
2014-05-13 11:07:01 +00:00
|
|
|
|
|
|
|
|
static std::vector<VideoCodecSettings> MapCodecs(
|
|
|
|
|
const std::vector<VideoCodec>& codecs);
|
2016-11-08 01:12:54 -08:00
|
|
|
// Select what video codec will be used for sending, i.e. what codec is used
|
|
|
|
|
// for local encoding, based on supported remote codecs. The first remote
|
|
|
|
|
// codec that is supported locally will be selected.
|
|
|
|
|
rtc::Optional<VideoCodecSettings> SelectSendVideoCodec(
|
|
|
|
|
const std::vector<VideoCodecSettings>& remote_mapped_codecs) const;
|
|
|
|
|
|
2015-08-20 17:19:20 -07:00
|
|
|
static bool ReceiveCodecsHaveChanged(std::vector<VideoCodecSettings> before,
|
|
|
|
|
std::vector<VideoCodecSettings> after);
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2016-08-11 08:41:18 -07:00
|
|
|
void FillSenderStats(VideoMediaInfo* info, bool log_stats);
|
|
|
|
|
void FillReceiverStats(VideoMediaInfo* info, bool log_stats);
|
2014-12-11 13:26:09 +00:00
|
|
|
void FillBandwidthEstimationStats(const webrtc::Call::Stats& stats,
|
|
|
|
|
VideoMediaInfo* info);
|
2016-11-14 02:28:16 -08:00
|
|
|
void FillSendAndReceiveCodecStats(VideoMediaInfo* video_media_info);
|
2014-07-18 11:11:55 +00:00
|
|
|
|
2015-05-07 14:07:48 +02:00
|
|
|
rtc::ThreadChecker thread_checker_;
|
|
|
|
|
|
2014-05-13 11:07:01 +00:00
|
|
|
uint32_t rtcp_receiver_report_ssrc_;
|
|
|
|
|
bool sending_;
|
2015-09-15 12:26:33 +02:00
|
|
|
webrtc::Call* const call_;
|
2014-10-03 11:25:45 +00:00
|
|
|
|
2014-08-12 23:17:13 +00:00
|
|
|
DefaultUnsignalledSsrcHandler default_unsignalled_ssrc_handler_;
|
|
|
|
|
UnsignalledSsrcHandler* const unsignalled_ssrc_handler_;
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2016-03-01 04:29:59 -08:00
|
|
|
const MediaConfig::Video video_config_;
|
2016-02-12 02:27:06 -08:00
|
|
|
|
2014-10-08 14:48:08 +00:00
|
|
|
rtc::CriticalSection stream_crit_;
|
2014-05-13 11:07:01 +00:00
|
|
|
// Using primary-ssrc (first ssrc) as key.
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
std::map<uint32_t, WebRtcVideoSendStream*> send_streams_
|
2014-10-08 14:48:08 +00:00
|
|
|
GUARDED_BY(stream_crit_);
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
std::map<uint32_t, WebRtcVideoReceiveStream*> receive_streams_
|
2014-10-08 14:48:08 +00:00
|
|
|
GUARDED_BY(stream_crit_);
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
std::set<uint32_t> send_ssrcs_ GUARDED_BY(stream_crit_);
|
|
|
|
|
std::set<uint32_t> receive_ssrcs_ GUARDED_BY(stream_crit_);
|
2014-05-13 11:07:01 +00:00
|
|
|
|
2015-11-10 22:34:18 +01:00
|
|
|
rtc::Optional<VideoCodecSettings> send_codec_;
|
Avoid unnecessary HW video encoder reconfiguration
This change reduces the number of times the Android hardware video
encoder is reconfigured when making an outgoing call. With this change,
the encoder should only be initialized once as opposed to the ~3 times
it happens currently.
Before the fix, the following sequence of events caused the extra
reconfigurations:
1. After the SetLocalDescription call, the WebRtcVideoSendStream is created.
All frames from the camera are dropped until the corresponding
VideoSendStream is created.
2. SetRemoteDescription() triggers the VideoSendStream creation. At
this point, the encoder is configured for the first time, with the
frame dimensions set to a low resolution default (176x144).
3. When the first video frame is received from the camera after the
VideoSendStreamIsCreated, the encoder is reconfigured to the correct
dimensions. If we are using the Android hardware encoder, the default
configuration is set to encode from a memory buffer (use_surface=false).
4. When the frame is passed down to the encoder in
androidmediaencoder_jni.cc EncodeOnCodecThread(), it may be stored in
a texture instead of a memory buffer. In this case, yet another
reconfiguration takes place to enable encoding from a texture.
5. Even if the resolution and texture flag were known at the start of
the call, there would be a reconfiguration involved if the camera is
rotated (such as when making a call from a phone in portrait orientation).
The reason for that is that at construction time, WebRtcVideoEngine2
sets the VideoSinkWants structure parameter to request frames rotated
by the source; the early frames will then arrive in portrait resolution.
When the remote description is finally set, if the rotation RTP extension
is supported by the remote receiver, the source is asked to provide
non-rotated frames. The very next frame will then arrive in landscape
resolution with a non-zero rotation value to be applied by the receiver.
Since the encoder was configured with the last (portrait) frame size,
it's going to need to be reconfigured again.
The fix makes the following changes:
1. WebRtcVideoSendStream::OnFrame() now caches the last seen frame
dimensions, and whether the frame was stored in a texture.
2. When the encoder is configured the first time
(WebRtcVideoSendStream::SetCodec()) - the last seen frame dimensions
are used instead of the default dimensions.
3. A flag that indicates if encoding is to be done from a texture has
been added to the webrtc::VideoStream and webrtc::VideoCodec structs,
and it's been wired up to be passed down all the way to the JNI code in
androidmediaencoder_jni.cc.
4. MediaCodecVideoEncoder::InitEncode is now reading the is_surface
flag from the VideoCodec structure instead of guessing the default as
false. This way we end up with the correct encoder configuration the
first time around.
5. WebRtcVideoSendStream now takes an optimistic guess and requests non-
rotated frames when the supported RtpExtensions list is not available.
This makes the "early" frames arrive non-rotated, and the cached dimensions
will be correct for the common case when the rotation extension is supported.
If the other side is an older endpoint which does not support rotation,
the encoder will have to be reconfigured - but it's better to penalize the
uncommon case rather than the common one.
Review-Url: https://codereview.webrtc.org/2067103002
Cr-Commit-Position: refs/heads/master@{#13173}
2016-06-16 12:08:03 -07:00
|
|
|
rtc::Optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_;
|
2014-06-16 17:32:02 +00:00
|
|
|
|
2014-10-14 04:25:33 +00:00
|
|
|
WebRtcVideoEncoderFactory* const external_encoder_factory_;
|
|
|
|
|
WebRtcVideoDecoderFactory* const external_decoder_factory_;
|
2014-05-13 11:07:01 +00:00
|
|
|
std::vector<VideoCodecSettings> recv_codecs_;
|
2014-06-16 17:32:02 +00:00
|
|
|
std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
|
2014-11-25 14:03:34 +00:00
|
|
|
webrtc::Call::Config::BitrateConfig bitrate_config_;
|
2015-12-09 12:37:51 -08:00
|
|
|
// TODO(deadbeef): Don't duplicate information between
|
|
|
|
|
// send_params/recv_params, rtp_extensions, options, etc.
|
|
|
|
|
VideoSendParameters send_params_;
|
2016-03-16 02:22:50 -07:00
|
|
|
VideoOptions default_send_options_;
|
2015-12-09 12:37:51 -08:00
|
|
|
VideoRecvParameters recv_params_;
|
2016-08-11 08:41:18 -07:00
|
|
|
int64_t last_stats_log_ms_;
|
2014-05-13 11:07:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace cricket
|
|
|
|
|
|
2016-02-12 06:39:40 +01:00
|
|
|
#endif // WEBRTC_MEDIA_ENGINE_WEBRTCVIDEOENGINE2_H_
|