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

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: Addressed more review comments. Created 5 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 * 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 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 adm_->Release(); 1252 adm_->Release();
1253 adm_ = NULL; 1253 adm_ = NULL;
1254 } 1254 }
1255 if (adm) { 1255 if (adm) {
1256 adm_ = adm; 1256 adm_ = adm;
1257 adm_->AddRef(); 1257 adm_->AddRef();
1258 } 1258 }
1259 return true; 1259 return true;
1260 } 1260 }
1261 1261
1262 bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file) { 1262 bool WebRtcVoiceEngine::StartAecDump(rtc::PlatformFile file,
1263 int64_t max_size_bytes) {
1263 FILE* aec_dump_file_stream = rtc::FdopenPlatformFileForWriting(file); 1264 FILE* aec_dump_file_stream = rtc::FdopenPlatformFileForWriting(file);
1264 if (!aec_dump_file_stream) { 1265 if (!aec_dump_file_stream) {
1265 LOG(LS_ERROR) << "Could not open AEC dump file stream."; 1266 LOG(LS_ERROR) << "Could not open AEC dump file stream.";
1266 if (!rtc::ClosePlatformFile(file)) 1267 if (!rtc::ClosePlatformFile(file))
1267 LOG(LS_WARNING) << "Could not close file."; 1268 LOG(LS_WARNING) << "Could not close file.";
1268 return false; 1269 return false;
1269 } 1270 }
1270 StopAecDump(); 1271 StopAecDump();
1271 if (voe_wrapper_->processing()->StartDebugRecording(aec_dump_file_stream) != 1272 if (voe_wrapper_->base()->audio_processing()->StartDebugRecording(
1273 aec_dump_file_stream, max_size_bytes) !=
1272 webrtc::AudioProcessing::kNoError) { 1274 webrtc::AudioProcessing::kNoError) {
1273 LOG_RTCERR0(StartDebugRecording); 1275 LOG_RTCERR0(StartDebugRecording);
1274 fclose(aec_dump_file_stream); 1276 fclose(aec_dump_file_stream);
1275 return false; 1277 return false;
1276 } 1278 }
1277 is_dumping_aec_ = true; 1279 is_dumping_aec_ = true;
1278 return true; 1280 return true;
1279 } 1281 }
1280 1282
1281 void WebRtcVoiceEngine::StartAecDump(const std::string& filename) { 1283 void WebRtcVoiceEngine::StartAecDump(const std::string& filename) {
1282 if (!is_dumping_aec_) { 1284 if (!is_dumping_aec_) {
1283 // Start dumping AEC when we are not dumping. 1285 // Start dumping AEC when we are not dumping.
1284 if (voe_wrapper_->processing()->StartDebugRecording( 1286 if (voe_wrapper_->base()->audio_processing()->StartDebugRecording(
1285 filename.c_str()) != webrtc::AudioProcessing::kNoError) { 1287 filename.c_str(), -1) != webrtc::AudioProcessing::kNoError) {
1286 LOG_RTCERR1(StartDebugRecording, filename.c_str()); 1288 LOG_RTCERR1(StartDebugRecording, filename.c_str());
1287 } else { 1289 } else {
1288 is_dumping_aec_ = true; 1290 is_dumping_aec_ = true;
1289 } 1291 }
1290 } 1292 }
1291 } 1293 }
1292 1294
1293 void WebRtcVoiceEngine::StopAecDump() { 1295 void WebRtcVoiceEngine::StopAecDump() {
1294 if (is_dumping_aec_) { 1296 if (is_dumping_aec_) {
1295 // Stop dumping AEC when we are dumping. 1297 // Stop dumping AEC when we are dumping.
1296 if (voe_wrapper_->processing()->StopDebugRecording() != 1298 if (voe_wrapper_->base()->audio_processing()->StopDebugRecording() !=
1297 webrtc::AudioProcessing::kNoError) { 1299 webrtc::AudioProcessing::kNoError) {
1298 LOG_RTCERR0(StopDebugRecording); 1300 LOG_RTCERR0(StopDebugRecording);
1299 } 1301 }
1300 is_dumping_aec_ = false; 1302 is_dumping_aec_ = false;
1301 } 1303 }
1302 } 1304 }
1303 1305
1304 bool WebRtcVoiceEngine::StartRtcEventLog(rtc::PlatformFile file) { 1306 bool WebRtcVoiceEngine::StartRtcEventLog(rtc::PlatformFile file) {
1305 return voe_wrapper_->codec()->GetEventLog()->StartLogging(file); 1307 return voe_wrapper_->codec()->GetEventLog()->StartLogging(file);
1306 } 1308 }
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
2995 LOG(LS_WARNING) << "Unknown codec " << ToString(codec); 2997 LOG(LS_WARNING) << "Unknown codec " << ToString(codec);
2996 return false; 2998 return false;
2997 } 2999 }
2998 } 3000 }
2999 return true; 3001 return true;
3000 } 3002 }
3001 3003
3002 } // namespace cricket 3004 } // namespace cricket
3003 3005
3004 #endif // HAVE_WEBRTC_VOICE 3006 #endif // HAVE_WEBRTC_VOICE
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698