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

Unified Diff: media/base/media_file_checker.h

Issue 20572004: Add media file validation to utility process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 4 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/media_file_checker.h
diff --git a/media/base/media_file_checker.h b/media/base/media_file_checker.h
new file mode 100644
index 0000000000000000000000000000000000000000..4e12dd2b2ebf40372868379d096b454ee13256e8
--- /dev/null
+++ b/media/base/media_file_checker.h
@@ -0,0 +1,41 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BASE_MEDIA_FILE_CHECKER_H_
+#define MEDIA_BASE_MEDIA_FILE_CHECKER_H_
+
+#include "base/basictypes.h"
+#include "base/files/scoped_platform_file_closer.h"
+#include "base/platform_file.h"
+#include "media/base/media_export.h"
+
+namespace base {
+class TimeDelta;
+}
+
+namespace media {
+
+// Open and read |file| to determine if it appears to be a valid media file.
DaleCurtis 2013/08/08 21:04:33 Sounds like this comment should go with the constr
vandebo (ex-Chrome) 2013/08/08 23:04:18 Rephrased comment.
+// The entire file is not decoded so a positive result from this class does
+// not make the file safe to use in the browser process.
+class MEDIA_EXPORT MediaFileChecker {
+ public:
+ explicit MediaFileChecker(base::PlatformFile file);
DaleCurtis 2013/08/08 21:04:33 Should this be const&?
vandebo (ex-Chrome) 2013/08/08 23:04:18 Done.
+ ~MediaFileChecker();
+
+ // After opening |file|, up to |check_time| amount of wall-clock time is spent
+ // decoding the file. The amount of audio/video data decoded will depend on
+ // the bitrate of the file and the speed of the CPU.
+ bool Start(const base::TimeDelta& check_time);
DaleCurtis 2013/08/08 21:04:33 Time structs are just int64s in the end, so it's n
vandebo (ex-Chrome) 2013/08/08 23:04:18 Done.
+
+ private:
+ base::PlatformFile file_;
+ base::ScopedPlatformFileCloser file_closer_;
+
+ DISALLOW_COPY_AND_ASSIGN(MediaFileChecker);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_MEDIA_FILE_CHECKER_H_

Powered by Google App Engine
This is Rietveld 408576698