Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(quality) Send analytics event for video codec changes. #2558

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion modules/RTC/TraceablePeerConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as SignalingEvents from '../../service/RTC/SignalingEvents';
import { getSourceIndexFromSourceName } from '../../service/RTC/SignalingLayer';
import { VIDEO_QUALITY_LEVELS } from '../../service/RTC/StandardVideoQualitySettings';
import { VideoType } from '../../service/RTC/VideoType';
import { VIDEO_CODEC_CHANGED } from '../../service/statistics/AnalyticsEvents';
import { SS_DEFAULT_FRAME_RATE } from '../RTC/ScreenObtainer';
import browser from '../browser';
import FeatureFlags from '../flags/FeatureFlags';
Expand All @@ -19,6 +20,7 @@ import SDP from '../sdp/SDP';
import SDPUtil from '../sdp/SDPUtil';
import SdpSimulcast from '../sdp/SdpSimulcast';
import { SdpTransformWrap } from '../sdp/SdpTransformUtil';
import Statistics from '../statistics/statistics';

import JitsiRemoteTrack from './JitsiRemoteTrack';
import RTCUtils from './RTCUtils';
Expand Down Expand Up @@ -2388,7 +2390,8 @@ TraceablePeerConnection.prototype._updateVideoSenderParameters = function(nextFu
*/
TraceablePeerConnection.prototype._updateVideoSenderEncodings = function(frameHeight, localVideoTrack, preferredCodec) {
const videoSender = this.findSenderForTrack(localVideoTrack.getTrack());
const isScreensharingTrack = localVideoTrack.getVideoType() === VideoType.DESKTOP;
const videoType = localVideoTrack.getVideoType();
const isScreensharingTrack = videoType === VideoType.DESKTOP;

if (!videoSender) {
return Promise.resolve();
Expand Down Expand Up @@ -2475,6 +2478,13 @@ TraceablePeerConnection.prototype._updateVideoSenderEncodings = function(frameHe

parameters.encodings[idx].codec = matchingCodec;
needsUpdate = true;

Statistics.sendAnalytics(
VIDEO_CODEC_CHANGED,
{
value: codec,
videoType
});
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions modules/qualitycontrol/ReceiveVideoController.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default class ReceiveVideoController {
setLastNLimitedByCpu(enabled) {
if (this._lastNLimitedByCpu !== enabled) {
this._lastNLimitedByCpu = enabled;
logger.info(`ReceiveVideoController - Setting the _lastNLimitedByCpu flag to ${enabled}`);
logger.info(`ReceiveVideoController - Setting the lastNLimitedByCpu flag to ${enabled}`);
}
}

Expand Down Expand Up @@ -250,7 +250,7 @@ export default class ReceiveVideoController {
setReceiveResolutionLimitedByCpu(enabled) {
if (this._receiveResolutionLimitedByCpu !== enabled) {
this._receiveResolutionLimitedByCpu = enabled;
logger.info(`ReceiveVideoController - Setting the _receiveResolutionLimitedByCpu flag to ${enabled}`);
logger.info(`ReceiveVideoController - Setting the receiveResolutionLimitedByCpu flag to ${enabled}`);
}
}
}
11 changes: 10 additions & 1 deletion modules/xmpp/JingleSessionPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { JitsiTrackEvents } from '../../JitsiTrackEvents';
import { CodecMimeType } from '../../service/RTC/CodecMimeType';
import { MediaDirection } from '../../service/RTC/MediaDirection';
import { MediaType } from '../../service/RTC/MediaType';
import { VideoType } from '../../service/RTC/VideoType';
import {
ICE_DURATION,
ICE_STATE_CHANGED
ICE_STATE_CHANGED,
VIDEO_CODEC_CHANGED
} from '../../service/statistics/AnalyticsEvents';
import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
import { SS_DEFAULT_FRAME_RATE } from '../RTC/ScreenObtainer';
Expand Down Expand Up @@ -1200,6 +1202,13 @@ export default class JingleSessionPC extends JingleSession {
return;
}

Statistics.sendAnalytics(
VIDEO_CODEC_CHANGED,
{
value: codecList[0],
videoType: VideoType.CAMERA
});

// Initiate a renegotiate for the codec setting to take effect.
const workFunction = finishedCallback => {
this._renegotiate()
Expand Down
2 changes: 2 additions & 0 deletions service/statistics/AnalyticsEvents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe( "/service/statistics/AnalyticsEvents members", () => {
ICE_STATE_CHANGED,
NO_BYTES_SENT,
TRACK_UNMUTED,
VIDEO_CODEC_CHANGED,
createBridgeDownEvent,
createConnectionFailedEvent,
createConferenceEvent,
Expand Down Expand Up @@ -74,6 +75,7 @@ describe( "/service/statistics/AnalyticsEvents members", () => {
expect( ICE_STATE_CHANGED ).toBe( 'ice.state.changed' );
expect( NO_BYTES_SENT ).toBe( 'track.no-bytes-sent' );
expect( TRACK_UNMUTED ).toBe( 'track.unmuted' );
expect( VIDEO_CODEC_CHANGED ).toBe( 'quality.video-codec-changed' );

expect( AnalyticsEvents ).toBeDefined();

Expand Down
12 changes: 11 additions & 1 deletion service/statistics/AnalyticsEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,16 @@ export enum AnalyticsEvents {
* trackType: the type of the track ('local' or 'remote').
* value: TODO: document
*/
TRACK_UNMUTED = 'track.unmuted'
TRACK_UNMUTED = 'track.unmuted',

/**
* Indicates that the video codec changed for a local track.
*
* Properties:
* value: the video codec mimeType.
* videoType: the videoType of local track, whether its 'camera' or 'desktop'.
*/
VIDEO_CODEC_CHANGED = 'quality.video-codec-changed',
}

// exported for backward compatibility
Expand All @@ -238,6 +247,7 @@ export const ICE_ESTABLISHMENT_DURATION_DIFF = AnalyticsEvents.ICE_ESTABLISHMENT
export const ICE_STATE_CHANGED = AnalyticsEvents.ICE_STATE_CHANGED;
export const NO_BYTES_SENT = AnalyticsEvents.NO_BYTES_SENT;
export const TRACK_UNMUTED = AnalyticsEvents.TRACK_UNMUTED;
export const VIDEO_CODEC_CHANGED = AnalyticsEvents.VIDEO_CODEC_CHANGED;

/**
* Creates an operational event which indicates that we have received a
Expand Down