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

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

Issue 1371933005: MediaStream Recorder: add usage counter to WebRTC.webkitApiCount UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 5 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
« no previous file with comments | « no previous file | content/renderer/media/webrtc_uma_histograms.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/media_recorder_handler.h" 5 #include "content/renderer/media/media_recorder_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/renderer/media/video_track_recorder.h" 10 #include "content/renderer/media/video_track_recorder.h"
11 #include "content/renderer/media/webrtc_uma_histograms.h"
11 #include "media/base/bind_to_current_loop.h" 12 #include "media/base/bind_to_current_loop.h"
12 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
13 #include "media/capture/webm_muxer.h" 14 #include "media/capture/webm_muxer.h"
14 #include "third_party/WebKit/public/platform/WebMediaRecorderHandlerClient.h" 15 #include "third_party/WebKit/public/platform/WebMediaRecorderHandlerClient.h"
15 #include "third_party/WebKit/public/platform/WebString.h" 16 #include "third_party/WebKit/public/platform/WebString.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 MediaRecorderHandler::MediaRecorderHandler() 20 MediaRecorderHandler::MediaRecorderHandler()
20 : recording_(false), client_(nullptr), weak_factory_(this) { 21 : recording_(false), client_(nullptr), weak_factory_(this) {
(...skipping 12 matching lines...) Expand all
33 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 34 DCHECK(main_render_thread_checker_.CalledOnValidThread());
34 // TODO(mcasas): For the time being only empty or "video/vp8" are supported. 35 // TODO(mcasas): For the time being only empty or "video/vp8" are supported.
35 return mimeType.isEmpty() || mimeType.utf8().compare("video/vp8") == 0; 36 return mimeType.isEmpty() || mimeType.utf8().compare("video/vp8") == 0;
36 } 37 }
37 38
38 bool MediaRecorderHandler::initialize( 39 bool MediaRecorderHandler::initialize(
39 blink::WebMediaRecorderHandlerClient* client, 40 blink::WebMediaRecorderHandlerClient* client,
40 const blink::WebMediaStream& media_stream, 41 const blink::WebMediaStream& media_stream,
41 const blink::WebString& mimeType) { 42 const blink::WebString& mimeType) {
42 DCHECK(main_render_thread_checker_.CalledOnValidThread()); 43 DCHECK(main_render_thread_checker_.CalledOnValidThread());
44 // Save histogram data so we can see how much MediaStream Recorder is used.
45 // The histogram counts the number of calls to the JS API.
46 UpdateWebRTCMethodCount(WEBKIT_MEDIA_STREAM_RECORDER);
47
43 if (!canSupportMimeType(mimeType)) { 48 if (!canSupportMimeType(mimeType)) {
44 DLOG(ERROR) << "Can't support type " << mimeType.utf8(); 49 DLOG(ERROR) << "Can't support type " << mimeType.utf8();
45 return false; 50 return false;
46 } 51 }
47 media_stream_ = media_stream; 52 media_stream_ = media_stream;
48 DCHECK(client); 53 DCHECK(client);
49 client_ = client; 54 client_ = client;
50 55
51 return true; 56 return true;
52 } 57 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 141 }
137 142
138 void MediaRecorderHandler::OnVideoFrameForTesting( 143 void MediaRecorderHandler::OnVideoFrameForTesting(
139 const scoped_refptr<media::VideoFrame>& frame, 144 const scoped_refptr<media::VideoFrame>& frame,
140 const base::TimeTicks& timestamp) { 145 const base::TimeTicks& timestamp) {
141 for (auto* recorder : video_recorders_) 146 for (auto* recorder : video_recorders_)
142 recorder->OnVideoFrameForTesting(frame, timestamp); 147 recorder->OnVideoFrameForTesting(frame, timestamp);
143 } 148 }
144 149
145 } // namespace content 150 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/webrtc_uma_histograms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698