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

Side by Side Diff: chrome/renderer/media/cast_session_delegate.cc

Issue 184853003: Cast: Add GetStats() extensions API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: static cast to int Created 6 years, 9 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 2013 The Chromium Authors. All rights reserved. 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 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 "chrome/renderer/media/cast_session_delegate.h" 5 #include "chrome/renderer/media/cast_session_delegate.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.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 "chrome/renderer/media/cast_threads.h" 10 #include "chrome/renderer/media/cast_threads.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return; 175 return;
176 } 176 }
177 177
178 scoped_ptr<std::string> serialized_log = 178 scoped_ptr<std::string> serialized_log =
179 log_serializer.GetSerializedLogAndReset(); 179 log_serializer.GetSerializedLogAndReset();
180 DVLOG(2) << "Serialized log length: " << serialized_log->size(); 180 DVLOG(2) << "Serialized log length: " << serialized_log->size();
181 181
182 callback.Run(serialized_log.Pass()); 182 callback.Run(serialized_log.Pass());
183 } 183 }
184 184
185 void CastSessionDelegate::GetStatsAndReset(bool is_audio,
186 const StatsCallback& callback) {
187 media::cast::FrameStatsMap frame_stats =
188 cast_environment_->Logging()->GetFrameStatsData(
189 is_audio ? media::cast::AUDIO_EVENT : media::cast::VIDEO_EVENT);
190 media::cast::PacketStatsMap packet_stats =
191 cast_environment_->Logging()->GetPacketStatsData(
192 is_audio ? media::cast::AUDIO_EVENT : media::cast::VIDEO_EVENT);
193
194 scoped_ptr<base::DictionaryValue> stats = media::cast::ConvertStats(
195 frame_stats, packet_stats);
196
197 callback.Run(stats.Pass());
198 }
199
185 void CastSessionDelegate::StatusNotificationCB( 200 void CastSessionDelegate::StatusNotificationCB(
186 media::cast::transport::CastTransportStatus unused_status) { 201 media::cast::transport::CastTransportStatus unused_status) {
187 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); 202 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
188 // TODO(hubbe): Call javascript UDPTransport error function. 203 // TODO(hubbe): Call javascript UDPTransport error function.
189 } 204 }
190 205
191 void CastSessionDelegate::StartSendingInternal() { 206 void CastSessionDelegate::StartSendingInternal() {
192 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); 207 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
193 208
194 // No transport, wait. 209 // No transport, wait.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 if (result == media::cast::STATUS_INITIALIZED) { 258 if (result == media::cast::STATUS_INITIALIZED) {
244 if (!audio_frame_input_available_callback_.is_null()) { 259 if (!audio_frame_input_available_callback_.is_null()) {
245 audio_frame_input_available_callback_.Run(cast_sender_->frame_input()); 260 audio_frame_input_available_callback_.Run(cast_sender_->frame_input());
246 } 261 }
247 if (!video_frame_input_available_callback_.is_null()) { 262 if (!video_frame_input_available_callback_.is_null()) {
248 video_frame_input_available_callback_.Run(cast_sender_->frame_input()); 263 video_frame_input_available_callback_.Run(cast_sender_->frame_input());
249 } 264 }
250 } 265 }
251 } 266 }
252 267
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_session_delegate.h ('k') | chrome/test/data/extensions/api_test/cast_streaming/basics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698