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

Side by Side Diff: media/base/mac/videotoolbox_helpers.h

Issue 1636083003: H264 HW encode using VideoToolbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: miu@ and jfroy@ comments Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_ 5 #ifndef MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_
6 #define IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_ 6 #define MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/mac/scoped_cftyperef.h"
9 #include "base/macros.h" 9 #include "media/base/mac/videotoolbox_glue.h"
10 #include "ios/public/provider/web/web_ui_ios_message_handler.h" 10 #include "media/base/media_export.h"
11 11
12 /////////////////////////////////////////////////////////////////////////////// 12 namespace media {
13 // MetricsHandler
14 13
15 // Let the page contents record UMA actions. Only use when you can't do it from 14 namespace video_toolbox {
16 // C++. For example, we currently use it to let the NTP log the position of the
17 // Most Visited or Bookmark the user clicked on, as we don't get that
18 // information through RequestOpenURL. You will need to update the metrics
19 // dashboard with the action names you use, as our processor won't catch that
20 // information (treat it as RecordComputedMetrics)
21 15
22 namespace base { 16 // Create a CFDictionaryRef with the given keys and values.
23 class ListValue; 17 MEDIA_EXPORT base::ScopedCFTypeRef<CFDictionaryRef>
24 } 18 DictionaryWithKeysAndValues(CFTypeRef* keys, CFTypeRef* values, size_t size);
25 19
26 class MetricsHandler : public web::WebUIIOSMessageHandler { 20 // Create a CFDictionaryRef with the given key and value.
21 MEDIA_EXPORT base::ScopedCFTypeRef<CFDictionaryRef> DictionaryWithKeyValue(
22 CFTypeRef key,
23 CFTypeRef value);
24
25 // Create a CFArrayRef with the given array of integers.
26 MEDIA_EXPORT base::ScopedCFTypeRef<CFArrayRef> ArrayWithIntegers(const int* v,
27 size_t size);
28
29 // Copy a H.264 frame stored in a CM sample buffer to an Annex B buffer. Copies
30 // parameter sets for keyframes before the frame data as well.
31 MEDIA_EXPORT bool CopySampleBufferToAnnexBBuffer(
32 CoreMediaGlue::CMSampleBufferRef sbuf,
33 bool keyframe,
34 std::string* annexb_buffer);
35 MEDIA_EXPORT bool CopySampleBufferToAnnexBBuffer(
36 CoreMediaGlue::CMSampleBufferRef sbuf,
37 bool keyframe,
38 size_t annexb_buffer_size,
39 char* annexb_buffer,
40 size_t* used_buffer_size);
41
42 // Helper class to add session properties to a VTCompressionSessionRef.
43 class MEDIA_EXPORT SessionPropertySetter {
27 public: 44 public:
28 MetricsHandler(); 45 SessionPropertySetter();
miu 2016/02/11 21:09:40 Please remove the zero-arg and copy ctors (see com
emircan 2016/02/12 03:40:56 Done.
29 ~MetricsHandler() override; 46 SessionPropertySetter(
47 base::ScopedCFTypeRef<VideoToolboxGlue::VTCompressionSessionRef> session,
48 const VideoToolboxGlue* const glue);
49 SessionPropertySetter(const SessionPropertySetter& setter);
50 ~SessionPropertySetter();
30 51
31 // WebUIIOSMessageHandler implementation. 52 bool SetSessionProperty(CFStringRef key, int32_t value);
32 void RegisterMessages() override; 53 bool SetSessionProperty(CFStringRef key, bool value);
33 54 bool SetSessionProperty(CFStringRef key, CFStringRef value);
34 // Callback for the "metricsHandler:recordAction" message. This records a
35 // user action.
36 void HandleRecordAction(const base::ListValue* args);
37
38 // TODO(dbeam): http://crbug.com/104338
39
40 // Callback for the "metricsHandler:recordInHistogram" message. This records
41 // into a histogram. |args| contains the histogram name, the value to record,
42 // and the maximum allowed value, which can be at most 4000. The histogram
43 // will use at most 100 buckets, one for each 1, 10, or 100 different values,
44 // depending on the maximum value.
45 void HandleRecordInHistogram(const base::ListValue* args);
46 55
47 private: 56 private:
48 DISALLOW_COPY_AND_ASSIGN(MetricsHandler); 57 base::ScopedCFTypeRef<VideoToolboxGlue::VTCompressionSessionRef> session_;
58 const VideoToolboxGlue* glue_;
49 }; 59 };
50 60
51 #endif // IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_ 61 } // namespace video_toolbox
62
63 } // namespace media
64
65 #endif // MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698