Revert "Omit calls to set composing region when pasting image."
[chromium-blink-merge.git] / media / cast / logging / logging_raw.cc
blobb80c05e78a2be6891ea4d59729e8f669976d30c6
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, 0, 0, false, 0,
26 -1.0, -1.0);
29 void LoggingRaw::InsertCapturedVideoFrameEvent(
30 const base::TimeTicks& time_of_event,
31 uint32 rtp_timestamp,
32 int width,
33 int height) {
34 InsertBaseFrameEvent(time_of_event, FRAME_CAPTURE_END, VIDEO_EVENT,
35 kFrameIdUnknown, rtp_timestamp, base::TimeDelta(), width,
36 height, 0, false, 0, -1.0, -1.0);
39 void LoggingRaw::InsertEncodedFrameEvent(const base::TimeTicks& time_of_event,
40 CastLoggingEvent event,
41 EventMediaType event_media_type,
42 uint32 rtp_timestamp,
43 uint32 frame_id,
44 int encoded_size,
45 bool key_frame,
46 int target_bitrate,
47 double encoder_cpu_utilization,
48 double idealized_bitrate_utilization) {
49 InsertBaseFrameEvent(time_of_event, event, event_media_type,
50 frame_id, rtp_timestamp, base::TimeDelta(),
51 0, 0, encoded_size, key_frame, target_bitrate,
52 encoder_cpu_utilization, idealized_bitrate_utilization);
55 void LoggingRaw::InsertFrameEventWithDelay(const base::TimeTicks& time_of_event,
56 CastLoggingEvent event,
57 EventMediaType event_media_type,
58 uint32 rtp_timestamp,
59 uint32 frame_id,
60 base::TimeDelta delay) {
61 InsertBaseFrameEvent(time_of_event, event, event_media_type, frame_id,
62 rtp_timestamp, delay, 0, 0, 0, false, 0, -1.0, -1.0);
65 void LoggingRaw::InsertBaseFrameEvent(const base::TimeTicks& time_of_event,
66 CastLoggingEvent event,
67 EventMediaType event_media_type,
68 uint32 frame_id,
69 uint32 rtp_timestamp,
70 base::TimeDelta delay,
71 int width,
72 int height,
73 int encoded_size,
74 bool key_frame,
75 int target_bitrate,
76 double encoder_cpu_utilization,
77 double idealized_bitrate_utilization) {
78 FrameEvent frame_event;
79 frame_event.rtp_timestamp = rtp_timestamp;
80 frame_event.frame_id = frame_id;
81 frame_event.width = width;
82 frame_event.height = height;
83 frame_event.size = encoded_size;
84 frame_event.timestamp = time_of_event;
85 frame_event.type = event;
86 frame_event.media_type = event_media_type;
87 frame_event.delay_delta = delay;
88 frame_event.key_frame = key_frame;
89 frame_event.target_bitrate = target_bitrate;
90 frame_event.encoder_cpu_utilization = encoder_cpu_utilization;
91 frame_event.idealized_bitrate_utilization = idealized_bitrate_utilization;
92 for (std::vector<RawEventSubscriber*>::const_iterator it =
93 subscribers_.begin();
94 it != subscribers_.end(); ++it) {
95 (*it)->OnReceiveFrameEvent(frame_event);
99 void LoggingRaw::InsertPacketEvent(const base::TimeTicks& time_of_event,
100 CastLoggingEvent event,
101 EventMediaType event_media_type,
102 uint32 rtp_timestamp,
103 uint32 frame_id, uint16 packet_id,
104 uint16 max_packet_id, size_t size) {
105 PacketEvent packet_event;
106 packet_event.rtp_timestamp = rtp_timestamp;
107 packet_event.frame_id = frame_id;
108 packet_event.max_packet_id = max_packet_id;
109 packet_event.packet_id = packet_id;
110 packet_event.size = size;
111 packet_event.timestamp = time_of_event;
112 packet_event.type = event;
113 packet_event.media_type = event_media_type;
114 for (std::vector<RawEventSubscriber*>::const_iterator it =
115 subscribers_.begin();
116 it != subscribers_.end(); ++it) {
117 (*it)->OnReceivePacketEvent(packet_event);
121 void LoggingRaw::AddSubscriber(RawEventSubscriber* subscriber) {
122 DCHECK(subscriber);
123 DCHECK(std::find(subscribers_.begin(), subscribers_.end(), subscriber) ==
124 subscribers_.end());
126 subscribers_.push_back(subscriber);
129 void LoggingRaw::RemoveSubscriber(RawEventSubscriber* subscriber) {
130 DCHECK(subscriber);
131 DCHECK(std::find(subscribers_.begin(), subscribers_.end(), subscriber) !=
132 subscribers_.end());
134 subscribers_.erase(
135 std::remove(subscribers_.begin(), subscribers_.end(), subscriber),
136 subscribers_.end());
139 } // namespace cast
140 } // namespace media