diff options
Diffstat (limited to 'media/cast')
-rw-r--r-- | media/cast/logging/logging.cc | 113 | ||||
-rw-r--r-- | media/cast/logging/logging.h | 92 |
2 files changed, 0 insertions, 205 deletions
diff --git a/media/cast/logging/logging.cc b/media/cast/logging/logging.cc deleted file mode 100644 index ce68aa4..0000000 --- a/media/cast/logging/logging.cc +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "media/cast/logging/logging.h" - -#include "base/debug/trace_event.h" -#include "base/logging.h" -#include "base/metrics/histogram.h" - -namespace media { -namespace cast { - -Logging::Logging(base::TickClock* clock) - : clock_(clock), - frame_map_(), - packet_map_(), - generic_map_(), - weak_factory_(this) {} - -Logging::~Logging() {} - -void Logging::InsertFrameEvent(CastLoggingEvent event, - uint32 rtp_timestamp, - uint8 frame_id) { - // Is this a new event? - FrameLogMap::iterator it = frame_map_.find(event); - if (it == frame_map_.end()) { - // Create new entry. - FrameLogData data(clock_); - data.Insert(rtp_timestamp, frame_id); - frame_map_.insert(std::make_pair(event, &data)); - } else { - // Insert to existing entry. - it->second->Insert(rtp_timestamp, frame_id); - } -} - -void Logging::InsertFrameEventWithSize(CastLoggingEvent event, - uint32 rtp_timestamp, - uint8 frame_id, - int size) { - // Is this a new event? - FrameLogMap::iterator it = frame_map_.find(event); - if (it == frame_map_.end()) { - // Create new entry. - FrameLogData data(clock_); - data.InsertWithSize(rtp_timestamp, frame_id, size); - frame_map_.insert(std::make_pair(event, &data)); - } else { - // Insert to existing entry. - it->second->InsertWithSize(rtp_timestamp, frame_id, size); - } -} - -void Logging::InsertFrameEventWithDelay(CastLoggingEvent event, - uint32 rtp_timestamp, - uint8 frame_id, - base::TimeDelta delay) { - // Is this a new event? - FrameLogMap::iterator it = frame_map_.find(event); - if (it == frame_map_.end()) { - // Create new entry. - FrameLogData data(clock_); - data.InsertWithDelay(rtp_timestamp, frame_id, delay); - frame_map_.insert(std::make_pair(event, &data)); - } else { - // Insert to existing entry. - it->second->InsertWithDelay(rtp_timestamp, frame_id, delay); - } -} - -void Logging::InsertPacketEvent(CastLoggingEvent event, - uint32 rtp_timestamp, - uint8 frame_id, - uint16 packet_id, - uint16 max_packet_id, - int size) { - // Is this a new event? - PacketLogMap::iterator it = packet_map_.find(event); - if (it == packet_map_.end()) { - // Create new entry. - PacketLogData data(clock_); - data.Insert(rtp_timestamp, frame_id, packet_id, max_packet_id, size); - packet_map_.insert(std::make_pair(event, &data)); - } else { - // Insert to existing entry. - it->second->Insert(rtp_timestamp, frame_id, packet_id, max_packet_id, size); - } -} - -void Logging::InsertGenericEvent(CastLoggingEvent event, int value) { - // Is this a new event? - GenericLogMap::iterator it = generic_map_.find(event); - if (it == generic_map_.end()) { - // Create new entry. - GenericLogData data(clock_); - data.Insert(value); - generic_map_.insert(std::make_pair(event, &data)); - } else { - // Insert to existing entry. - it->second->Insert(value); - } -} - -void Logging::Reset() { - frame_map_.clear(); - packet_map_.clear(); - generic_map_.clear(); -} -} // namespace cast -} // namespace media - diff --git a/media/cast/logging/logging.h b/media/cast/logging/logging.h deleted file mode 100644 index 426fe3a..0000000 --- a/media/cast/logging/logging.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MEDIA_CAST_LOGGING_LOGGING_H_ -#define MEDIA_CAST_LOGGING_LOGGING_H_ - -// Generic class that handles event logging for the cast library. -// Logging has three possible forms: -// 1. [default] Raw data accessible by the application. -// 2. [optional] UMA stats. -// 3. [optional] Tracing. - -#include <map> -#include <string> -#include <vector> - -#include "base/basictypes.h" -#include "base/memory/linked_ptr.h" -#include "base/memory/weak_ptr.h" -#include "base/threading/non_thread_safe.h" -#include "base/time/tick_clock.h" -#include "base/time/time.h" -#include "media/cast/logging/logging_defines.h" -#include "media/cast/logging/logging_internal.h" - -namespace media { -namespace cast { - -// Store all log types in a map based on the event. -typedef std::map<CastLoggingEvent, linked_ptr<FrameLogData> > FrameLogMap; -typedef std::map<CastLoggingEvent, linked_ptr<PacketLogData> > PacketLogMap; -typedef std::map<CastLoggingEvent, linked_ptr<GenericLogData> > GenericLogMap; - - -// This class is not thread safe, and should only be called from the main -// thread. -class Logging : public base::NonThreadSafe, - public base::SupportsWeakPtr<Logging> { - public: - // When tracing is enabled - all events will be added to the trace. - Logging(base::TickClock* clock); - ~Logging(); - // Inform of new event: three types of events: frame, packets and generic. - // Frame events can be inserted with different parameters. - void InsertFrameEvent(CastLoggingEvent event, - uint32 rtp_timestamp, - uint8 frame_id); - // Size - Inserting the size implies that this is an encoded frame. - void InsertFrameEventWithSize(CastLoggingEvent event, - uint32 rtp_timestamp, - uint8 frame_id, - int frame_size); - // Render/playout delay - void InsertFrameEventWithDelay(CastLoggingEvent event, - uint32 rtp_timestamp, - uint8 frame_id, - base::TimeDelta delay); - - // Insert a packet event. - void InsertPacketEvent(CastLoggingEvent event, - uint32 rtp_timestamp, - uint8 frame_id, - uint16 packet_id, - uint16 max_packet_id, - int size); - - void InsertGenericEvent(CastLoggingEvent event, int value); - - // Get log data. - void GetRawFrameData(FrameLogMap frame_data); - void GetRawPacketData(PacketLogMap packet_data); - void GetRawGenericData(GenericLogMap generic_data); - - // Reset all log data (not flags). - void Reset(); - - private: - base::WeakPtrFactory<Logging> weak_factory_; - base::TickClock* const clock_; // Not owned by this class. - FrameLogMap frame_map_; - PacketLogMap packet_map_; - GenericLogMap generic_map_; - - DISALLOW_COPY_AND_ASSIGN(Logging); -}; - -} // namespace cast -} // namespace media - -#endif // MEDIA_CAST_LOGGING_LOGGING_H_ - |