Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: content/renderer/media/render_media_log.cc

Issue 877273002: Add media log messages to the main log (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Report PIPELINE_ERROR to LOG(ERROR) + minor fixes Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/base/media_log.h » ('j') | media/base/media_log.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/media/render_media_log.h" 5 #include "content/renderer/media/render_media_log.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
(...skipping 19 matching lines...) Expand all
30 // Keep track of the latest buffered extents properties to avoid sending 30 // Keep track of the latest buffered extents properties to avoid sending
31 // thousands of events over IPC. See http://crbug.com/352585 for details. 31 // thousands of events over IPC. See http://crbug.com/352585 for details.
32 // 32 //
33 // TODO(scherkus): We should overhaul MediaLog entirely to have clearer 33 // TODO(scherkus): We should overhaul MediaLog entirely to have clearer
34 // separation of properties vs. events. 34 // separation of properties vs. events.
35 if (event->type == media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED) 35 if (event->type == media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED)
36 last_buffered_extents_changed_event_.swap(event); 36 last_buffered_extents_changed_event_.swap(event);
37 else 37 else
38 queued_media_events_.push_back(*event); 38 queued_media_events_.push_back(*event);
39 39
40 if (event->type == media::MediaLogEvent::PIPELINE_ERROR) {
41 LOG(ERROR) << media::MediaLog::MediaEventToLogString(*event.get());
wolenetz 2015/02/13 20:36:36 nit: *. --> ->
servolk 2015/03/26 00:04:08 This won't work (compile error). We are not trying
wolenetz 2015/03/26 01:38:52 Silly me. Precedence bit me.
42 } else if (event->type != media::MediaLogEvent::BUFFERED_EXTENTS_CHANGED &&
43 event->type != media::MediaLogEvent::PROPERTY_CHANGE &&
44 event->type != media::MediaLogEvent::NETWORK_ACTIVITY_SET) {
45 DVLOG(1) << "MediaEvent: "
46 << media::MediaLog::MediaEventToLogString(*event.get());
wolenetz 2015/02/13 20:36:36 nit: ditto
servolk 2015/03/26 00:04:08 See above
wolenetz 2015/03/26 01:38:52 Acknowledged.
47 }
48
40 // Limit the send rate of high frequency events. 49 // Limit the send rate of high frequency events.
41 base::TimeTicks curr_time = tick_clock_->NowTicks(); 50 base::TimeTicks curr_time = tick_clock_->NowTicks();
42 if ((curr_time - last_ipc_send_time_) < base::TimeDelta::FromSeconds(1)) 51 if ((curr_time - last_ipc_send_time_) < base::TimeDelta::FromSeconds(1))
43 return; 52 return;
44 last_ipc_send_time_ = curr_time; 53 last_ipc_send_time_ = curr_time;
45 54
46 if (last_buffered_extents_changed_event_) { 55 if (last_buffered_extents_changed_event_) {
47 queued_media_events_.push_back(*last_buffered_extents_changed_event_); 56 queued_media_events_.push_back(*last_buffered_extents_changed_event_);
48 last_buffered_extents_changed_event_.reset(); 57 last_buffered_extents_changed_event_.reset();
49 } 58 }
50 59
51 DVLOG(1) << "media log events array size " << queued_media_events_.size(); 60 DVLOG(1) << "media log events array size " << queued_media_events_.size();
52 61
53 RenderThread::Get()->Send( 62 RenderThread::Get()->Send(
54 new ViewHostMsg_MediaLogEvents(queued_media_events_)); 63 new ViewHostMsg_MediaLogEvents(queued_media_events_));
55 queued_media_events_.clear(); 64 queued_media_events_.clear();
56 } 65 }
57 66
58 RenderMediaLog::~RenderMediaLog() {} 67 RenderMediaLog::~RenderMediaLog() {}
59 68
60 void RenderMediaLog::SetTickClockForTesting( 69 void RenderMediaLog::SetTickClockForTesting(
61 scoped_ptr<base::TickClock> tick_clock) { 70 scoped_ptr<base::TickClock> tick_clock) {
62 tick_clock_.swap(tick_clock); 71 tick_clock_.swap(tick_clock);
63 last_ipc_send_time_ = tick_clock_->NowTicks(); 72 last_ipc_send_time_ = tick_clock_->NowTicks();
64 } 73 }
65 74
66 } // namespace content 75 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/base/media_log.h » ('j') | media/base/media_log.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698