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

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

Issue 1413483003: Added option to specify a maximum file size when recording an AEC dump. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added function to avoid breaking Chromium. Created 5 years 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 | « talk/media/webrtc/webrtcvoiceengine.h ('k') | talk/session/media/channelmanager.h » ('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 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 adm_->Release(); 1009 adm_->Release();
1010 adm_ = NULL; 1010 adm_ = NULL;
1011 } 1011 }
1012 if (adm) { 1012 if (adm) {
1013 adm_ = adm; 1013 adm_ = adm;
1014 adm_->AddRef(); 1014 adm_->AddRef();
1015 } 1015 }
1016 return true; 1016 return true;
1017 } 1017 }
1018 1018
1019 bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file) { 1019 bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file,
1020 int64_t max_size_bytes) {
1020 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1021 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1021 FILE* aec_dump_file_stream = rtc::FdopenPlatformFileForWriting(file); 1022 FILE* aec_dump_file_stream = rtc::FdopenPlatformFileForWriting(file);
1022 if (!aec_dump_file_stream) { 1023 if (!aec_dump_file_stream) {
1023 LOG(LS_ERROR) << "Could not open AEC dump file stream."; 1024 LOG(LS_ERROR) << "Could not open AEC dump file stream.";
1024 if (!rtc::ClosePlatformFile(file)) 1025 if (!rtc::ClosePlatformFile(file))
1025 LOG(LS_WARNING) << "Could not close file."; 1026 LOG(LS_WARNING) << "Could not close file.";
1026 return false; 1027 return false;
1027 } 1028 }
1028 StopAecDump(); 1029 StopAecDump();
1029 if (voe_wrapper_->processing()->StartDebugRecording(aec_dump_file_stream) != 1030 if (voe_wrapper_->base()->audio_processing()->StartDebugRecording(
1031 aec_dump_file_stream, max_size_bytes) !=
1030 webrtc::AudioProcessing::kNoError) { 1032 webrtc::AudioProcessing::kNoError) {
1031 LOG_RTCERR0(StartDebugRecording); 1033 LOG_RTCERR0(StartDebugRecording);
1032 fclose(aec_dump_file_stream); 1034 fclose(aec_dump_file_stream);
1033 return false; 1035 return false;
1034 } 1036 }
1035 is_dumping_aec_ = true; 1037 is_dumping_aec_ = true;
1036 return true; 1038 return true;
1037 } 1039 }
1038 1040
1039 void WebRtcVoiceEngine::StartAecDump(const std::string& filename) { 1041 void WebRtcVoiceEngine::StartAecDump(const std::string& filename) {
1040 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1042 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1041 if (!is_dumping_aec_) { 1043 if (!is_dumping_aec_) {
1042 // Start dumping AEC when we are not dumping. 1044 // Start dumping AEC when we are not dumping.
1043 if (voe_wrapper_->processing()->StartDebugRecording( 1045 if (voe_wrapper_->base()->audio_processing()->StartDebugRecording(
1044 filename.c_str()) != webrtc::AudioProcessing::kNoError) { 1046 filename.c_str(), -1) != webrtc::AudioProcessing::kNoError) {
1045 LOG_RTCERR1(StartDebugRecording, filename.c_str()); 1047 LOG_RTCERR1(StartDebugRecording, filename.c_str());
1046 } else { 1048 } else {
1047 is_dumping_aec_ = true; 1049 is_dumping_aec_ = true;
1048 } 1050 }
1049 } 1051 }
1050 } 1052 }
1051 1053
1052 void WebRtcVoiceEngine::StopAecDump() { 1054 void WebRtcVoiceEngine::StopAecDump() {
1053 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1055 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1054 if (is_dumping_aec_) { 1056 if (is_dumping_aec_) {
1055 // Stop dumping AEC when we are dumping. 1057 // Stop dumping AEC when we are dumping.
1056 if (voe_wrapper_->processing()->StopDebugRecording() != 1058 if (voe_wrapper_->base()->audio_processing()->StopDebugRecording() !=
1057 webrtc::AudioProcessing::kNoError) { 1059 webrtc::AudioProcessing::kNoError) {
1058 LOG_RTCERR0(StopDebugRecording); 1060 LOG_RTCERR0(StopDebugRecording);
1059 } 1061 }
1060 is_dumping_aec_ = false; 1062 is_dumping_aec_ = false;
1061 } 1063 }
1062 } 1064 }
1063 1065
1064 bool WebRtcVoiceEngine::StartRtcEventLog(rtc::PlatformFile file) { 1066 bool WebRtcVoiceEngine::StartRtcEventLog(rtc::PlatformFile file) {
1065 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 1067 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
1066 return voe_wrapper_->codec()->GetEventLog()->StartLogging(file); 1068 return voe_wrapper_->codec()->GetEventLog()->StartLogging(file);
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 } 2507 }
2506 } else { 2508 } else {
2507 LOG(LS_INFO) << "Stopping playout for channel #" << channel; 2509 LOG(LS_INFO) << "Stopping playout for channel #" << channel;
2508 engine()->voe()->base()->StopPlayout(channel); 2510 engine()->voe()->base()->StopPlayout(channel);
2509 } 2511 }
2510 return true; 2512 return true;
2511 } 2513 }
2512 } // namespace cricket 2514 } // namespace cricket
2513 2515
2514 #endif // HAVE_WEBRTC_VOICE 2516 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « talk/media/webrtc/webrtcvoiceengine.h ('k') | talk/session/media/channelmanager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698