Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/media/webrtc/transportbridge/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  RtpLogger.cpp

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */


// Original author: nohlmeier@mozilla.com

#include "RtpLogger.h"

#include <ctime>
#include <iomanip>
#include <sstream>

#include "mozilla/Logging.h"
#ifdef _WIN32
#  include <sys/timeb.h>
#  include <time.h>
#else
#  include <sys/time.h>
#endif

// Logging context
using namespace mozilla;

mozilla::LazyLogModule gRtpLoggerLog("RtpLogger");

namespace mozilla {

bool RtpLogger::IsPacketLoggingOn() {
  return MOZ_LOG_TEST(gRtpLoggerLog, LogLevel::Debug);
}

void RtpLogger::LogPacket(const MediaPacket& packet, bool input,
                          std::string desc) {
  if (MOZ_LOG_TEST(gRtpLoggerLog, LogLevel::Debug)) {
    bool isRtp = (packet.type() == MediaPacket::RTP);
    std::stringstream ss;
    /* This creates text2pcap compatible format, e.g.:
     *  RTCP_PACKET O 10:36:26.864934  000000 80 c8 00 06 6d ...
     */

    ss << (input ? "I " : "O ");
    std::time_t t = std::time(nullptr);
    std::tm tm = *std::localtime(&t);
    char buf[9];
    if (0 < strftime(buf, sizeof(buf), "%H:%M:%S", &tm)) {
      ss << buf;
    }
    ss << std::setfill('0');
#ifdef _WIN32
    struct timeb tb;
    ftime(&tb);
    ss << "." << (tb.millitm) << " ";
#else
    struct timeval tv;
    gettimeofday(&tv, NULL);
    ss << "." << (tv.tv_usec) << " ";
#endif
    ss << " 000000";
    ss << std::hex << std::setfill('0');
    for (size_t i = 0; i < packet.len(); ++i) {
      ss << " " << std::setw(2) << (int)packet.data()[i];
    }
    MOZ_LOG_FMT(gRtpLoggerLog, LogLevel::Debug, "{} {}|>> {}", desc.c_str(),
                (isRtp ? "RTP_PACKET" : "RTCP_PACKET"), ss.str().c_str());
  }
}

}  // namespace mozilla

Messung V0.5 in Prozent
C=91 H=98 G=94

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.