mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1161079: Fix VideoCodecStats to allow for collecting encoder and decoder stats r=jib
This commit is contained in:
parent
4ab5fc7861
commit
fbdca54511
@ -16,14 +16,14 @@ using namespace webrtc;
|
||||
static const char* logTag ="WebrtcVideoSessionConduit";
|
||||
|
||||
VideoCodecStatistics::VideoCodecStatistics(int channel,
|
||||
ViECodec* codec,
|
||||
bool encoder) :
|
||||
ViECodec* codec) :
|
||||
mChannel(channel),
|
||||
mSentRawFrames(0),
|
||||
mPtrViECodec(codec),
|
||||
mEncoderDroppedFrames(0),
|
||||
mDecoderDiscardedPackets(0),
|
||||
mEncoderMode(encoder),
|
||||
mRegisteredEncode(false),
|
||||
mRegisteredDecode(false),
|
||||
mReceiveState(kReceiveStateInitial)
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
, mRecoveredBeforeLoss(0)
|
||||
@ -31,22 +31,29 @@ VideoCodecStatistics::VideoCodecStatistics(int channel,
|
||||
#endif
|
||||
{
|
||||
MOZ_ASSERT(mPtrViECodec);
|
||||
if (mEncoderMode) {
|
||||
mPtrViECodec->RegisterEncoderObserver(mChannel, *this);
|
||||
} else {
|
||||
mPtrViECodec->RegisterDecoderObserver(mChannel, *this);
|
||||
}
|
||||
}
|
||||
|
||||
VideoCodecStatistics::~VideoCodecStatistics()
|
||||
{
|
||||
if (mEncoderMode) {
|
||||
if (mRegisteredEncode) {
|
||||
mPtrViECodec->DeregisterEncoderObserver(mChannel);
|
||||
} else {
|
||||
}
|
||||
if (mRegisteredDecode) {
|
||||
mPtrViECodec->DeregisterDecoderObserver(mChannel);
|
||||
}
|
||||
}
|
||||
|
||||
void VideoCodecStatistics::Register(bool encoder)
|
||||
{
|
||||
if (encoder && !mRegisteredEncode) {
|
||||
mPtrViECodec->RegisterEncoderObserver(mChannel, *this);
|
||||
mRegisteredEncode = true;
|
||||
} else if (!encoder && !mRegisteredDecode) {
|
||||
mPtrViECodec->RegisterDecoderObserver(mChannel, *this);
|
||||
mRegisteredDecode = true;
|
||||
}
|
||||
}
|
||||
|
||||
void VideoCodecStatistics::OutgoingRate(const int video_channel,
|
||||
const uint32_t framerate,
|
||||
const uint32_t bitrate)
|
||||
|
@ -21,8 +21,9 @@ class VideoCodecStatistics : public webrtc::ViEEncoderObserver
|
||||
, public webrtc::ViEDecoderObserver
|
||||
{
|
||||
public:
|
||||
VideoCodecStatistics(int channel, webrtc::ViECodec* vieCodec, bool encoder);
|
||||
VideoCodecStatistics(int channel, webrtc::ViECodec* vieCodec);
|
||||
~VideoCodecStatistics();
|
||||
void Register(bool encoder);
|
||||
|
||||
void SentFrame();
|
||||
virtual void OutgoingRate(const int video_channel,
|
||||
@ -92,7 +93,8 @@ private:
|
||||
RunningStat mDecoderBitRate;
|
||||
RunningStat mDecoderFps;
|
||||
uint32_t mDecoderDiscardedPackets;
|
||||
const bool mEncoderMode;
|
||||
bool mRegisteredEncode;
|
||||
bool mRegisteredDecode;
|
||||
|
||||
webrtc::VideoReceiveState mReceiveState;
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
|
@ -644,8 +644,9 @@ WebrtcVideoConduit::ConfigureSendMediaCodec(const VideoCodecConfig* codecConfig)
|
||||
}
|
||||
|
||||
if (!mVideoCodecStat) {
|
||||
mVideoCodecStat = new VideoCodecStatistics(mChannel, mPtrViECodec, true);
|
||||
mVideoCodecStat = new VideoCodecStatistics(mChannel, mPtrViECodec);
|
||||
}
|
||||
mVideoCodecStat->Register(true);
|
||||
|
||||
mSendingWidth = 0;
|
||||
mSendingHeight = 0;
|
||||
@ -800,8 +801,9 @@ WebrtcVideoConduit::ConfigureRecvMediaCodecs(
|
||||
}
|
||||
|
||||
if (!mVideoCodecStat) {
|
||||
mVideoCodecStat = new VideoCodecStatistics(mChannel, mPtrViECodec, false);
|
||||
mVideoCodecStat = new VideoCodecStatistics(mChannel, mPtrViECodec);
|
||||
}
|
||||
mVideoCodecStat->Register(false);
|
||||
|
||||
// XXX Currently, we gather up all of the feedback types that the remote
|
||||
// party indicated it supports for all video codecs and configure the entire
|
||||
|
Loading…
Reference in New Issue
Block a user