Bug 1400757 - Add telemetry to MediaRecorder and TrackEncoder to track basic usage. r=francois,pehrsons

Add telemetry to collect the following:
- Number of times a MediaRecorder is started during a session
- Duration of media recordings
- How often we're timing out init of audio and video track encoders

MozReview-Commit-ID: 9Pc2oKNCH1M

--HG--
extra : rebase_source : 16414a5ffa95413458d36295e5508df4c16e6fa9
This commit is contained in:
Bryce Van Dyk 2017-09-19 07:34:02 +12:00
Родитель 4935882f43
Коммит 06435b3208
5 изменённых файлов: 48 добавлений и 0 удалений

Просмотреть файл

@ -1199,6 +1199,8 @@ MediaRecorder::Start(const Optional<int32_t>& aTimeSlice, ErrorResult& aResult)
mSessions.AppendElement();
mSessions.LastElement() = new Session(this, timeSlice);
mSessions.LastElement()->Start();
mStartTime = TimeStamp::Now();
Telemetry::ScalarAdd(Telemetry::ScalarID::MEDIARECORDER_RECORDING_COUNT, 1);
}
void
@ -1574,6 +1576,12 @@ MediaRecorder::StopForSessionDestruction()
mState = RecordingState::Inactive;
MOZ_ASSERT(mSessions.Length() > 0);
mSessions.LastElement()->Stop();
// This is a coarse calculation and does not reflect the duration of the
// final recording for reasons such as pauses. However it allows us an idea
// of how long people are running their recorders for.
TimeDuration timeDelta = TimeStamp::Now() - mStartTime;
Telemetry::Accumulate(Telemetry::MEDIA_RECORDER_RECORDING_DURATION,
timeDelta.ToSeconds());
}
void

Просмотреть файл

@ -168,6 +168,8 @@ protected:
uint32_t mVideoBitsPerSecond;
uint32_t mBitsPerSecond;
TimeStamp mStartTime;
// DOMExceptions that are created early and possibly thrown in NotifyError.
// Creating them early allows us to capture the JS stack for which cannot be
// done at the time the error event is fired.

Просмотреть файл

@ -229,6 +229,8 @@ AudioTrackEncoder::TryInit(const AudioSegment& aSegment, StreamTime aDuration)
AUDIO_INIT_FAILED_DURATION,
DEFAULT_CHANNELS));
nsresult rv = Init(DEFAULT_CHANNELS, mTrackRate);
Telemetry::Accumulate(
Telemetry::MEDIA_RECORDER_TRACK_ENCODER_INIT_TIMEOUT_TYPE, 0);
if (NS_FAILED(rv)) {
TRACK_LOG(LogLevel::Error,
("[AudioTrackEncoder %p]: Default-channel-init failed.", this));
@ -522,6 +524,8 @@ VideoTrackEncoder::Init(const VideoSegment& aSegment, StreamTime aDuration)
TRACK_LOG(LogLevel::Warning,
("[VideoTrackEncoder %p]: No successful init for %ds.",
this, VIDEO_INIT_FAILED_DURATION));
Telemetry::Accumulate(
Telemetry::MEDIA_RECORDER_TRACK_ENCODER_INIT_TIMEOUT_TYPE, 1);
OnError();
return;
}

Просмотреть файл

@ -9268,6 +9268,25 @@
"n_values": 8,
"description": "Type of call: (Bitmask) Audio = 1, Video = 2, DataChannels = 4"
},
"MEDIA_RECORDER_RECORDING_DURATION": {
"record_in_processes": ["main", "content"],
"alert_emails": ["bvandyk@mozilla.com"],
"expires_in_version": "60",
"kind": "exponential",
"high": 3600,
"n_buckets": 100,
"bug_numbers": [1400757],
"description": "The length of time (in seconds) that a recording lasted. Recorded when a recorder stops"
},
"MEDIA_RECORDER_TRACK_ENCODER_INIT_TIMEOUT_TYPE": {
"record_in_processes": ["main", "content"],
"alert_emails": ["bvandyk@mozilla.com"],
"expires_in_version": "60",
"kind": "enumerated",
"n_values": 4,
"bug_numbers": [1400757],
"description": "Records the type of timeout that happened while attempting to init the encoder. Audio = 0, Video = 1. Recorded immediately following a timeout"
},
"DEVTOOLS_ENTRY_POINT": {
"record_in_processes": ["main"],
"bug_numbers": [1378863],

Просмотреть файл

@ -633,6 +633,21 @@ webrtc.nicer:
- 'main'
- 'content'
mediarecorder:
recording_count:
bug_numbers:
- 1400757
description: >
The number of times a MediaRecorder has been started. Recorded when a MediaRecorder starts
expires: "60"
kind: uint
notification_emails:
- bvandyk@mozilla.com
release_channel_collection: opt-in
record_in_processes:
- main
- content
# The following section contains content process base counters.
dom.contentprocess:
troubled_due_to_memory: