Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: webrtc/pc/rtcstatscollector.cc

Issue 2964593002: Adding stats that can be used to compute output audio levels. (Closed)
Patch Set: Add test coverage in AudioSendStreamTest. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/pc/rtcstats_integrationtest.cc ('k') | webrtc/pc/rtcstatscollector_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 timestamp_us, 367 timestamp_us,
368 RTCMediaStreamTrackKind::kAudio)); 368 RTCMediaStreamTrackKind::kAudio));
369 SetMediaStreamTrackStatsFromMediaStreamTrackInterface( 369 SetMediaStreamTrackStatsFromMediaStreamTrackInterface(
370 audio_track, audio_track_stats.get()); 370 audio_track, audio_track_stats.get());
371 audio_track_stats->remote_source = false; 371 audio_track_stats->remote_source = false;
372 audio_track_stats->detached = false; 372 audio_track_stats->detached = false;
373 if (voice_sender_info.audio_level >= 0) { 373 if (voice_sender_info.audio_level >= 0) {
374 audio_track_stats->audio_level = DoubleAudioLevelFromIntAudioLevel( 374 audio_track_stats->audio_level = DoubleAudioLevelFromIntAudioLevel(
375 voice_sender_info.audio_level); 375 voice_sender_info.audio_level);
376 } 376 }
377 audio_track_stats->total_audio_energy = voice_sender_info.total_input_energy;
378 audio_track_stats->total_samples_duration =
379 voice_sender_info.total_input_duration;
377 if (voice_sender_info.echo_return_loss != -100) { 380 if (voice_sender_info.echo_return_loss != -100) {
378 audio_track_stats->echo_return_loss = static_cast<double>( 381 audio_track_stats->echo_return_loss = static_cast<double>(
379 voice_sender_info.echo_return_loss); 382 voice_sender_info.echo_return_loss);
380 } 383 }
381 if (voice_sender_info.echo_return_loss_enhancement != -100) { 384 if (voice_sender_info.echo_return_loss_enhancement != -100) {
382 audio_track_stats->echo_return_loss_enhancement = static_cast<double>( 385 audio_track_stats->echo_return_loss_enhancement = static_cast<double>(
383 voice_sender_info.echo_return_loss_enhancement); 386 voice_sender_info.echo_return_loss_enhancement);
384 } 387 }
385 return audio_track_stats; 388 return audio_track_stats;
386 } 389 }
(...skipping 11 matching lines...) Expand all
398 timestamp_us, 401 timestamp_us,
399 RTCMediaStreamTrackKind::kAudio)); 402 RTCMediaStreamTrackKind::kAudio));
400 SetMediaStreamTrackStatsFromMediaStreamTrackInterface( 403 SetMediaStreamTrackStatsFromMediaStreamTrackInterface(
401 audio_track, audio_track_stats.get()); 404 audio_track, audio_track_stats.get());
402 audio_track_stats->remote_source = true; 405 audio_track_stats->remote_source = true;
403 audio_track_stats->detached = false; 406 audio_track_stats->detached = false;
404 if (voice_receiver_info.audio_level >= 0) { 407 if (voice_receiver_info.audio_level >= 0) {
405 audio_track_stats->audio_level = DoubleAudioLevelFromIntAudioLevel( 408 audio_track_stats->audio_level = DoubleAudioLevelFromIntAudioLevel(
406 voice_receiver_info.audio_level); 409 voice_receiver_info.audio_level);
407 } 410 }
411 audio_track_stats->total_audio_energy =
412 voice_receiver_info.total_output_energy;
413 audio_track_stats->total_samples_duration =
414 voice_receiver_info.total_output_duration;
408 return audio_track_stats; 415 return audio_track_stats;
409 } 416 }
410 417
411 std::unique_ptr<RTCMediaStreamTrackStats> 418 std::unique_ptr<RTCMediaStreamTrackStats>
412 ProduceMediaStreamTrackStatsFromVideoSenderInfo( 419 ProduceMediaStreamTrackStatsFromVideoSenderInfo(
413 int64_t timestamp_us, 420 int64_t timestamp_us,
414 const VideoTrackInterface& video_track, 421 const VideoTrackInterface& video_track,
415 const cricket::VideoSenderInfo& video_sender_info) { 422 const cricket::VideoSenderInfo& video_sender_info) {
416 std::unique_ptr<RTCMediaStreamTrackStats> video_track_stats( 423 std::unique_ptr<RTCMediaStreamTrackStats> video_track_stats(
417 new RTCMediaStreamTrackStats( 424 new RTCMediaStreamTrackStats(
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 const std::string& type) { 1255 const std::string& type) {
1249 return CandidateTypeToRTCIceCandidateType(type); 1256 return CandidateTypeToRTCIceCandidateType(type);
1250 } 1257 }
1251 1258
1252 const char* DataStateToRTCDataChannelStateForTesting( 1259 const char* DataStateToRTCDataChannelStateForTesting(
1253 DataChannelInterface::DataState state) { 1260 DataChannelInterface::DataState state) {
1254 return DataStateToRTCDataChannelState(state); 1261 return DataStateToRTCDataChannelState(state);
1255 } 1262 }
1256 1263
1257 } // namespace webrtc 1264 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/pc/rtcstats_integrationtest.cc ('k') | webrtc/pc/rtcstatscollector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698