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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2503383002: Expose RtpCodecParameters to VoiceMediaInfo stats. (Closed)
Patch Set: Addressed comments, using int Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 2457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 call_->OnTransportOverheadChanged(webrtc::MediaType::AUDIO, 2468 call_->OnTransportOverheadChanged(webrtc::MediaType::AUDIO,
2469 transport_overhead_per_packet); 2469 transport_overhead_per_packet);
2470 } 2470 }
2471 2471
2472 bool WebRtcVoiceMediaChannel::GetStats(VoiceMediaInfo* info) { 2472 bool WebRtcVoiceMediaChannel::GetStats(VoiceMediaInfo* info) {
2473 TRACE_EVENT0("webrtc", "WebRtcVoiceMediaChannel::GetStats"); 2473 TRACE_EVENT0("webrtc", "WebRtcVoiceMediaChannel::GetStats");
2474 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2474 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2475 RTC_DCHECK(info); 2475 RTC_DCHECK(info);
2476 2476
2477 // Get SSRC and stats for each sender. 2477 // Get SSRC and stats for each sender.
2478 RTC_DCHECK(info->senders.size() == 0); 2478 RTC_DCHECK_EQ(info->senders.size(), 0U);
2479 for (const auto& stream : send_streams_) { 2479 for (const auto& stream : send_streams_) {
2480 webrtc::AudioSendStream::Stats stats = stream.second->GetStats(); 2480 webrtc::AudioSendStream::Stats stats = stream.second->GetStats();
2481 VoiceSenderInfo sinfo; 2481 VoiceSenderInfo sinfo;
2482 sinfo.add_ssrc(stats.local_ssrc); 2482 sinfo.add_ssrc(stats.local_ssrc);
2483 sinfo.bytes_sent = stats.bytes_sent; 2483 sinfo.bytes_sent = stats.bytes_sent;
2484 sinfo.packets_sent = stats.packets_sent; 2484 sinfo.packets_sent = stats.packets_sent;
2485 sinfo.packets_lost = stats.packets_lost; 2485 sinfo.packets_lost = stats.packets_lost;
2486 sinfo.fraction_lost = stats.fraction_lost; 2486 sinfo.fraction_lost = stats.fraction_lost;
2487 sinfo.codec_name = stats.codec_name; 2487 sinfo.codec_name = stats.codec_name;
2488 sinfo.codec_payload_type = stats.codec_payload_type;
2488 sinfo.ext_seqnum = stats.ext_seqnum; 2489 sinfo.ext_seqnum = stats.ext_seqnum;
2489 sinfo.jitter_ms = stats.jitter_ms; 2490 sinfo.jitter_ms = stats.jitter_ms;
2490 sinfo.rtt_ms = stats.rtt_ms; 2491 sinfo.rtt_ms = stats.rtt_ms;
2491 sinfo.audio_level = stats.audio_level; 2492 sinfo.audio_level = stats.audio_level;
2492 sinfo.aec_quality_min = stats.aec_quality_min; 2493 sinfo.aec_quality_min = stats.aec_quality_min;
2493 sinfo.echo_delay_median_ms = stats.echo_delay_median_ms; 2494 sinfo.echo_delay_median_ms = stats.echo_delay_median_ms;
2494 sinfo.echo_delay_std_ms = stats.echo_delay_std_ms; 2495 sinfo.echo_delay_std_ms = stats.echo_delay_std_ms;
2495 sinfo.echo_return_loss = stats.echo_return_loss; 2496 sinfo.echo_return_loss = stats.echo_return_loss;
2496 sinfo.echo_return_loss_enhancement = stats.echo_return_loss_enhancement; 2497 sinfo.echo_return_loss_enhancement = stats.echo_return_loss_enhancement;
2497 sinfo.residual_echo_likelihood = stats.residual_echo_likelihood; 2498 sinfo.residual_echo_likelihood = stats.residual_echo_likelihood;
2498 sinfo.typing_noise_detected = (send_ ? stats.typing_noise_detected : false); 2499 sinfo.typing_noise_detected = (send_ ? stats.typing_noise_detected : false);
2499 info->senders.push_back(sinfo); 2500 info->senders.push_back(sinfo);
2500 } 2501 }
2501 2502
2502 // Get SSRC and stats for each receiver. 2503 // Get SSRC and stats for each receiver.
2503 RTC_DCHECK(info->receivers.size() == 0); 2504 RTC_DCHECK_EQ(info->receivers.size(), 0U);
2504 for (const auto& stream : recv_streams_) { 2505 for (const auto& stream : recv_streams_) {
2505 webrtc::AudioReceiveStream::Stats stats = stream.second->GetStats(); 2506 webrtc::AudioReceiveStream::Stats stats = stream.second->GetStats();
2506 VoiceReceiverInfo rinfo; 2507 VoiceReceiverInfo rinfo;
2507 rinfo.add_ssrc(stats.remote_ssrc); 2508 rinfo.add_ssrc(stats.remote_ssrc);
2508 rinfo.bytes_rcvd = stats.bytes_rcvd; 2509 rinfo.bytes_rcvd = stats.bytes_rcvd;
2509 rinfo.packets_rcvd = stats.packets_rcvd; 2510 rinfo.packets_rcvd = stats.packets_rcvd;
2510 rinfo.packets_lost = stats.packets_lost; 2511 rinfo.packets_lost = stats.packets_lost;
2511 rinfo.fraction_lost = stats.fraction_lost; 2512 rinfo.fraction_lost = stats.fraction_lost;
2512 rinfo.codec_name = stats.codec_name; 2513 rinfo.codec_name = stats.codec_name;
2514 rinfo.codec_payload_type = stats.codec_payload_type;
2513 rinfo.ext_seqnum = stats.ext_seqnum; 2515 rinfo.ext_seqnum = stats.ext_seqnum;
2514 rinfo.jitter_ms = stats.jitter_ms; 2516 rinfo.jitter_ms = stats.jitter_ms;
2515 rinfo.jitter_buffer_ms = stats.jitter_buffer_ms; 2517 rinfo.jitter_buffer_ms = stats.jitter_buffer_ms;
2516 rinfo.jitter_buffer_preferred_ms = stats.jitter_buffer_preferred_ms; 2518 rinfo.jitter_buffer_preferred_ms = stats.jitter_buffer_preferred_ms;
2517 rinfo.delay_estimate_ms = stats.delay_estimate_ms; 2519 rinfo.delay_estimate_ms = stats.delay_estimate_ms;
2518 rinfo.audio_level = stats.audio_level; 2520 rinfo.audio_level = stats.audio_level;
2519 rinfo.expand_rate = stats.expand_rate; 2521 rinfo.expand_rate = stats.expand_rate;
2520 rinfo.speech_expand_rate = stats.speech_expand_rate; 2522 rinfo.speech_expand_rate = stats.speech_expand_rate;
2521 rinfo.secondary_decoded_rate = stats.secondary_decoded_rate; 2523 rinfo.secondary_decoded_rate = stats.secondary_decoded_rate;
2522 rinfo.accelerate_rate = stats.accelerate_rate; 2524 rinfo.accelerate_rate = stats.accelerate_rate;
2523 rinfo.preemptive_expand_rate = stats.preemptive_expand_rate; 2525 rinfo.preemptive_expand_rate = stats.preemptive_expand_rate;
2524 rinfo.decoding_calls_to_silence_generator = 2526 rinfo.decoding_calls_to_silence_generator =
2525 stats.decoding_calls_to_silence_generator; 2527 stats.decoding_calls_to_silence_generator;
2526 rinfo.decoding_calls_to_neteq = stats.decoding_calls_to_neteq; 2528 rinfo.decoding_calls_to_neteq = stats.decoding_calls_to_neteq;
2527 rinfo.decoding_normal = stats.decoding_normal; 2529 rinfo.decoding_normal = stats.decoding_normal;
2528 rinfo.decoding_plc = stats.decoding_plc; 2530 rinfo.decoding_plc = stats.decoding_plc;
2529 rinfo.decoding_cng = stats.decoding_cng; 2531 rinfo.decoding_cng = stats.decoding_cng;
2530 rinfo.decoding_plc_cng = stats.decoding_plc_cng; 2532 rinfo.decoding_plc_cng = stats.decoding_plc_cng;
2531 rinfo.decoding_muted_output = stats.decoding_muted_output; 2533 rinfo.decoding_muted_output = stats.decoding_muted_output;
2532 rinfo.capture_start_ntp_time_ms = stats.capture_start_ntp_time_ms; 2534 rinfo.capture_start_ntp_time_ms = stats.capture_start_ntp_time_ms;
2533 info->receivers.push_back(rinfo); 2535 info->receivers.push_back(rinfo);
2534 } 2536 }
2535 2537
2538 // Get codec info
2539 for (const AudioCodec& codec : send_codecs_) {
2540 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters();
2541 info->send_codecs.insert(
2542 std::make_pair(codec_params.payload_type, std::move(codec_params)));
2543 }
2544 for (const AudioCodec& codec : recv_codecs_) {
2545 webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters();
2546 info->receive_codecs.insert(
2547 std::make_pair(codec_params.payload_type, std::move(codec_params)));
2548 }
2549
2536 return true; 2550 return true;
2537 } 2551 }
2538 2552
2539 void WebRtcVoiceMediaChannel::SetRawAudioSink( 2553 void WebRtcVoiceMediaChannel::SetRawAudioSink(
2540 uint32_t ssrc, 2554 uint32_t ssrc,
2541 std::unique_ptr<webrtc::AudioSinkInterface> sink) { 2555 std::unique_ptr<webrtc::AudioSinkInterface> sink) {
2542 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2556 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2543 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::SetRawAudioSink: ssrc:" << ssrc 2557 LOG(LS_VERBOSE) << "WebRtcVoiceMediaChannel::SetRawAudioSink: ssrc:" << ssrc
2544 << " " << (sink ? "(ptr)" : "NULL"); 2558 << " " << (sink ? "(ptr)" : "NULL");
2545 if (ssrc == 0) { 2559 if (ssrc == 0) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2592 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2579 const auto it = send_streams_.find(ssrc); 2593 const auto it = send_streams_.find(ssrc);
2580 if (it != send_streams_.end()) { 2594 if (it != send_streams_.end()) {
2581 return it->second->channel(); 2595 return it->second->channel();
2582 } 2596 }
2583 return -1; 2597 return -1;
2584 } 2598 }
2585 } // namespace cricket 2599 } // namespace cricket
2586 2600
2587 #endif // HAVE_WEBRTC_VOICE 2601 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698