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

Unified 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: Rename vt_video_encode_accelerator to vt_video_encode_accelerator_mac. 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 side-by-side diff with in-line comments
Download patch
Index: media/base/mac/videotoolbox_helpers.h
diff --git a/ios/chrome/browser/ui/webui/history/metrics_handler.h b/media/base/mac/videotoolbox_helpers.h
similarity index 11%
copy from ios/chrome/browser/ui/webui/history/metrics_handler.h
copy to media/base/mac/videotoolbox_helpers.h
index 3d6fca9df71b61b94c26c355c7f7715d72144453..d5f999ee8407cd5a07c63b4da037eda0e15160b6 100644
--- a/ios/chrome/browser/ui/webui/history/metrics_handler.h
+++ b/media/base/mac/videotoolbox_helpers.h
@@ -2,50 +2,63 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_
-#define IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_
+#ifndef MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_
+#define MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_
-#include "base/compiler_specific.h"
-#include "base/macros.h"
-#include "ios/public/provider/web/web_ui_ios_message_handler.h"
+#include "base/mac/scoped_cftyperef.h"
+#include "media/base/mac/videotoolbox_glue.h"
+#include "media/base/media_export.h"
-///////////////////////////////////////////////////////////////////////////////
-// MetricsHandler
+namespace media {
-// Let the page contents record UMA actions. Only use when you can't do it from
-// C++. For example, we currently use it to let the NTP log the position of the
-// Most Visited or Bookmark the user clicked on, as we don't get that
-// information through RequestOpenURL. You will need to update the metrics
-// dashboard with the action names you use, as our processor won't catch that
-// information (treat it as RecordComputedMetrics)
+namespace video_toolbox {
-namespace base {
-class ListValue;
-}
+// Create a CFDictionaryRef with the given keys and values.
+MEDIA_EXPORT base::ScopedCFTypeRef<CFDictionaryRef>
+DictionaryWithKeysAndValues(CFTypeRef* keys, CFTypeRef* values, size_t size);
-class MetricsHandler : public web::WebUIIOSMessageHandler {
- public:
- MetricsHandler();
- ~MetricsHandler() override;
+// Create a CFDictionaryRef with the given key and value.
+MEDIA_EXPORT base::ScopedCFTypeRef<CFDictionaryRef> DictionaryWithKeyValue(
+ CFTypeRef key,
+ CFTypeRef value);
- // WebUIIOSMessageHandler implementation.
- void RegisterMessages() override;
+// Create a CFArrayRef with the given array of integers.
+MEDIA_EXPORT base::ScopedCFTypeRef<CFArrayRef> ArrayWithIntegers(const int* v,
+ size_t size);
- // Callback for the "metricsHandler:recordAction" message. This records a
- // user action.
- void HandleRecordAction(const base::ListValue* args);
+// Copy a H.264 frame stored in a CM sample buffer to an Annex B buffer. Copies
+// parameter sets for keyframes before the frame data as well.
+MEDIA_EXPORT bool CopySampleBufferToAnnexBBuffer(
miu 2016/02/09 23:29:22 For simplicity, you should delete the version of t
emircan 2016/02/10 05:21:53 But wouldn't it be costly to do "std::string annex
miu 2016/02/10 21:04:56 In terms of run-time cost: No, because it's still
jfroy 2016/02/10 23:15:34 My personal opinion on this is that I would only d
+ CoreMediaGlue::CMSampleBufferRef sbuf,
+ std::string* annexb_buffer,
+ bool keyframe);
+MEDIA_EXPORT bool CopySampleBufferToAnnexBBuffer(
+ CoreMediaGlue::CMSampleBufferRef sbuf,
+ uint8_t* annexb_buffer,
miu 2016/02/09 23:29:22 style: output arguments go last
+ size_t annexb_buffer_size,
+ bool keyframe,
+ size_t* used_buffer_size);
- // TODO(dbeam): http://crbug.com/104338
+// Helper class to add session properties to a VTCompressionSessionRef.
+class MEDIA_EXPORT SessionPropertySetter {
+ public:
+ SessionPropertySetter(
+ base::ScopedCFTypeRef<VideoToolboxGlue::VTCompressionSessionRef> session,
+ const VideoToolboxGlue* const glue);
+ ~SessionPropertySetter();
- // Callback for the "metricsHandler:recordInHistogram" message. This records
- // into a histogram. |args| contains the histogram name, the value to record,
- // and the maximum allowed value, which can be at most 4000. The histogram
- // will use at most 100 buckets, one for each 1, 10, or 100 different values,
- // depending on the maximum value.
- void HandleRecordInHistogram(const base::ListValue* args);
+ bool SetSessionProperty(CFStringRef key, int32_t value);
+ bool SetSessionProperty(CFStringRef key, bool value);
+ bool SetSessionProperty(CFStringRef key, CFStringRef value);
private:
- DISALLOW_COPY_AND_ASSIGN(MetricsHandler);
+ const base::ScopedCFTypeRef<VideoToolboxGlue::VTCompressionSessionRef>
+ session_;
+ const VideoToolboxGlue* const glue_;
};
-#endif // IOS_CHROME_BROWSER_UI_WEBUI_HISTORY_METRICS_HANDLER_H_
+} // namespace video_toolbox
+
+} // namespace media
+
+#endif // MEDIA_BASE_MAC_VIDEOTOOLBOX_HELPERS_H_

Powered by Google App Engine
This is Rietveld 408576698