OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/media/webrtc_logging_handler_host.h" | 5 #include "chrome/browser/media/webrtc_logging_handler_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/cpu.h" | 11 #include "base/cpu.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "build/build_config.h" |
18 #include "chrome/browser/bad_message.h" | 19 #include "chrome/browser/bad_message.h" |
19 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
21 #include "chrome/browser/media/webrtc_log_list.h" | 22 #include "chrome/browser/media/webrtc_log_list.h" |
22 #include "chrome/browser/media/webrtc_log_uploader.h" | 23 #include "chrome/browser/media/webrtc_log_uploader.h" |
23 #include "chrome/browser/media/webrtc_rtp_dump_handler.h" | 24 #include "chrome/browser/media/webrtc_rtp_dump_handler.h" |
24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/common/channel_info.h" | 26 #include "chrome/common/channel_info.h" |
26 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/media/webrtc_logging_messages.h" | 28 #include "chrome/common/media/webrtc_logging_messages.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 BrowserThread::UI, | 403 BrowserThread::UI, |
403 FROM_HERE, | 404 FROM_HERE, |
404 base::Bind(stop_rtp_dump_callback_, | 405 base::Bind(stop_rtp_dump_callback_, |
405 type == RTP_DUMP_INCOMING || type == RTP_DUMP_BOTH, | 406 type == RTP_DUMP_INCOMING || type == RTP_DUMP_BOTH, |
406 type == RTP_DUMP_OUTGOING || type == RTP_DUMP_BOTH)); | 407 type == RTP_DUMP_OUTGOING || type == RTP_DUMP_BOTH)); |
407 } | 408 } |
408 | 409 |
409 rtp_dump_handler_->StopDump(type, callback); | 410 rtp_dump_handler_->StopDump(type, callback); |
410 } | 411 } |
411 | 412 |
412 void WebRtcLoggingHandlerHost::OnRtpPacket(scoped_ptr<uint8[]> packet_header, | 413 void WebRtcLoggingHandlerHost::OnRtpPacket(scoped_ptr<uint8_t[]> packet_header, |
413 size_t header_length, | 414 size_t header_length, |
414 size_t packet_length, | 415 size_t packet_length, |
415 bool incoming) { | 416 bool incoming) { |
416 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 417 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
417 | 418 |
418 BrowserThread::PostTask( | 419 BrowserThread::PostTask( |
419 BrowserThread::IO, | 420 BrowserThread::IO, |
420 FROM_HERE, | 421 FROM_HERE, |
421 base::Bind(&WebRtcLoggingHandlerHost::DumpRtpPacketOnIOThread, | 422 base::Bind(&WebRtcLoggingHandlerHost::DumpRtpPacketOnIOThread, |
422 this, | 423 this, |
423 base::Passed(&packet_header), | 424 base::Passed(&packet_header), |
424 header_length, | 425 header_length, |
425 packet_length, | 426 packet_length, |
426 incoming)); | 427 incoming)); |
427 } | 428 } |
428 | 429 |
429 void WebRtcLoggingHandlerHost::DumpRtpPacketOnIOThread( | 430 void WebRtcLoggingHandlerHost::DumpRtpPacketOnIOThread( |
430 scoped_ptr<uint8[]> packet_header, | 431 scoped_ptr<uint8_t[]> packet_header, |
431 size_t header_length, | 432 size_t header_length, |
432 size_t packet_length, | 433 size_t packet_length, |
433 bool incoming) { | 434 bool incoming) { |
434 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 435 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
435 | 436 |
436 // |rtp_dump_handler_| could be NULL if we are waiting for the FILE thread to | 437 // |rtp_dump_handler_| could be NULL if we are waiting for the FILE thread to |
437 // create/ensure the log directory. | 438 // create/ensure the log directory. |
438 if (rtp_dump_handler_) { | 439 if (rtp_dump_handler_) { |
439 rtp_dump_handler_->OnRtpPacket( | 440 rtp_dump_handler_->OnRtpPacket( |
440 packet_header.get(), header_length, packet_length, incoming); | 441 packet_header.get(), header_length, packet_length, incoming); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 | 865 |
865 if (!is_audio_debug_recordings_in_progress_) { | 866 if (!is_audio_debug_recordings_in_progress_) { |
866 error_callback.Run("No audio debug recording in progress"); | 867 error_callback.Run("No audio debug recording in progress"); |
867 return; | 868 return; |
868 } | 869 } |
869 | 870 |
870 host->DisableAudioDebugRecordings(); | 871 host->DisableAudioDebugRecordings(); |
871 is_audio_debug_recordings_in_progress_ = false; | 872 is_audio_debug_recordings_in_progress_ = false; |
872 callback.Run(prefix_path.AsUTF8Unsafe(), true /* stopped */, is_manual_stop); | 873 callback.Run(prefix_path.AsUTF8Unsafe(), true /* stopped */, is_manual_stop); |
873 } | 874 } |
OLD | NEW |