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

Side by Side Diff: content/browser/renderer_host/media/peer_connection_tracker_host.cc

Issue 617093003: Add MediaStreamSource frame rate calculation to the tracker. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding type name. Fixing IPC type problem. Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" 4 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h"
5 5
6 #include "base/power_monitor/power_monitor.h" 6 #include "base/power_monitor/power_monitor.h"
7 #include "content/browser/media/webrtc_internals.h" 7 #include "content/browser/media/webrtc_internals.h"
8 #include "content/common/media/peer_connection_tracker_messages.h" 8 #include "content/common/media/peer_connection_tracker_messages.h"
9 #include "content/public/browser/render_process_host.h" 9 #include "content/public/browser/render_process_host.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 PeerConnectionTrackerHost::PeerConnectionTrackerHost(int render_process_id) 13 PeerConnectionTrackerHost::PeerConnectionTrackerHost(int render_process_id)
14 : BrowserMessageFilter(PeerConnectionTrackerMsgStart), 14 : BrowserMessageFilter(PeerConnectionTrackerMsgStart),
15 render_process_id_(render_process_id) { 15 render_process_id_(render_process_id) {
16 } 16 }
17 17
18 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message) { 18 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message) {
19 bool handled = true; 19 bool handled = true;
20 20
21 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTrackerHost, message) 21 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTrackerHost, message)
22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection, 22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection,
23 OnAddPeerConnection) 23 OnAddPeerConnection)
24 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection, 24 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection,
25 OnRemovePeerConnection) 25 OnRemovePeerConnection)
26 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_UpdatePeerConnection, 26 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_UpdatePeerConnection,
27 OnUpdatePeerConnection) 27 OnUpdatePeerConnection)
28 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddStats, OnAddStats) 28 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddStats, OnAddStats)
29 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_GetUserMedia, OnGetUserMedia) 29 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_GetUserMedia, OnGetUserMedia)
30 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddVideoStats,
31 OnAddVideoStats)
30 IPC_MESSAGE_UNHANDLED(handled = false) 32 IPC_MESSAGE_UNHANDLED(handled = false)
31 IPC_END_MESSAGE_MAP() 33 IPC_END_MESSAGE_MAP()
32 return handled; 34 return handled;
33 } 35 }
34 36
35 void PeerConnectionTrackerHost::OverrideThreadForMessage( 37 void PeerConnectionTrackerHost::OverrideThreadForMessage(
36 const IPC::Message& message, BrowserThread::ID* thread) { 38 const IPC::Message& message, BrowserThread::ID* thread) {
37 if (IPC_MESSAGE_CLASS(message) == PeerConnectionTrackerMsgStart) 39 if (IPC_MESSAGE_CLASS(message) == PeerConnectionTrackerMsgStart)
38 *thread = BrowserThread::UI; 40 *thread = BrowserThread::UI;
39 } 41 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const std::string& video_constraints) { 101 const std::string& video_constraints) {
100 WebRTCInternals::GetInstance()->OnGetUserMedia(render_process_id_, 102 WebRTCInternals::GetInstance()->OnGetUserMedia(render_process_id_,
101 peer_pid(), 103 peer_pid(),
102 origin, 104 origin,
103 audio, 105 audio,
104 video, 106 video,
105 audio_constraints, 107 audio_constraints,
106 video_constraints); 108 video_constraints);
107 } 109 }
108 110
111 void PeerConnectionTrackerHost::OnAddVideoStats(const std::string& video_id,
112 float input_frame_rate,
113 int number_of_dropped_frames) {
114 WebRTCInternals::GetInstance()->OnAddVideoStats(
115 peer_pid(), video_id, input_frame_rate, number_of_dropped_frames);
116 }
117
109 void PeerConnectionTrackerHost::OnSuspend() { 118 void PeerConnectionTrackerHost::OnSuspend() {
110 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 119 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
111 base::Bind(&PeerConnectionTrackerHost::SendOnSuspendOnUIThread, this)); 120 base::Bind(&PeerConnectionTrackerHost::SendOnSuspendOnUIThread, this));
112 } 121 }
113 122
114 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { 123 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() {
115 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 124 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
116 content::RenderProcessHost* host = 125 content::RenderProcessHost* host =
117 content::RenderProcessHost::FromID(render_process_id_); 126 content::RenderProcessHost::FromID(render_process_id_);
118 if (host) 127 if (host)
119 host->Send(new PeerConnectionTracker_OnSuspend()); 128 host->Send(new PeerConnectionTracker_OnSuspend());
120 } 129 }
121 130
122 } // namespace content 131 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698