Ignore title parameter for navigator.registerProtocolHandler
[chromium-blink-merge.git] / media / cast / logging / logging_raw.cc
blob229064d7b69277e9b41514981ea9144d708e30cd
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
3 // found in the LICENSE file.
5 #include "media/cast/logging/logging_raw.h"
7 #include <algorithm>
9 #include "base/logging.h"
10 #include "base/time/time.h"
12 namespace media {
13 namespace cast {
15 LoggingRaw::LoggingRaw() {}
17 LoggingRaw::~LoggingRaw() {}
19 void LoggingRaw::InsertFrameEvent(const base::TimeTicks& time_of_event,
20 CastLoggingEvent event,
21 EventMediaType event_media_type,
22 uint32 rtp_timestamp,
23 uint32 frame_id) {
24 InsertBaseFrameEvent(time_of_event, event, event_media_type, frame_id,
25 rtp_timestamp, base::TimeDelta(), 0, false, 0);
28 void LoggingRaw::InsertEncodedFrameEvent(const base::TimeTicks& time_of_event,
29 CastLoggingEvent event,
30 EventMediaType event_media_type,
31 uint32 rtp_timestamp, uint32 frame_id,
32 int size, bool key_frame,
33 int target_bitrate) {
34 InsertBaseFrameEvent(time_of_event, event, event_media_type,
35 frame_id, rtp_timestamp, base::TimeDelta(), size,
36 key_frame, target_bitrate);
39 void LoggingRaw::InsertFrameEventWithDelay(const base::TimeTicks& time_of_event,
40 CastLoggingEvent event,
41 EventMediaType event_media_type,
42 uint32 rtp_timestamp,
43 uint32 frame_id,
44 base::TimeDelta delay) {
45 InsertBaseFrameEvent(time_of_event, event, event_media_type, frame_id,
46 rtp_timestamp, delay, 0, false, 0);
49 void LoggingRaw::InsertBaseFrameEvent(const base::TimeTicks& time_of_event,
50 CastLoggingEvent event,
51 EventMediaType event_media_type,
52 uint32 frame_id,
53 uint32 rtp_timestamp,
54 base::TimeDelta delay, int size,
55 bool key_frame, int target_bitrate) {
56 FrameEvent frame_event;
57 frame_event.rtp_timestamp = rtp_timestamp;
58 frame_event.frame_id = frame_id;
59 frame_event.size = size;
60 frame_event.timestamp = time_of_event;
61 frame_event.type = event;
62 frame_event.media_type = event_media_type;
63 frame_event.delay_delta = delay;
64 frame_event.key_frame = key_frame;
65 frame_event.target_bitrate = target_bitrate;
66 for (std::vector<RawEventSubscriber*>::const_iterator it =
67 subscribers_.begin();
68 it != subscribers_.end(); ++it) {
69 (*it)->OnReceiveFrameEvent(frame_event);
73 void LoggingRaw::InsertPacketEvent(const base::TimeTicks& time_of_event,
74 CastLoggingEvent event,
75 EventMediaType event_media_type,
76 uint32 rtp_timestamp,
77 uint32 frame_id, uint16 packet_id,
78 uint16 max_packet_id, size_t size) {
79 PacketEvent packet_event;
80 packet_event.rtp_timestamp = rtp_timestamp;
81 packet_event.frame_id = frame_id;
82 packet_event.max_packet_id = max_packet_id;
83 packet_event.packet_id = packet_id;
84 packet_event.size = size;
85 packet_event.timestamp = time_of_event;
86 packet_event.type = event;
87 packet_event.media_type = event_media_type;
88 for (std::vector<RawEventSubscriber*>::const_iterator it =
89 subscribers_.begin();
90 it != subscribers_.end(); ++it) {
91 (*it)->OnReceivePacketEvent(packet_event);
95 void LoggingRaw::AddSubscriber(RawEventSubscriber* subscriber) {
96 DCHECK(subscriber);
97 DCHECK(std::find(subscribers_.begin(), subscribers_.end(), subscriber) ==
98 subscribers_.end());
100 subscribers_.push_back(subscriber);
103 void LoggingRaw::RemoveSubscriber(RawEventSubscriber* subscriber) {
104 DCHECK(subscriber);
105 DCHECK(std::find(subscribers_.begin(), subscribers_.end(), subscriber) !=
106 subscribers_.end());
108 subscribers_.erase(
109 std::remove(subscribers_.begin(), subscribers_.end(), subscriber),
110 subscribers_.end());
113 } // namespace cast
114 } // namespace media