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

Side by Side Diff: media/base/android/android_overlay.h

Issue 2692863011: Add ContentVideoViewOverlay to AVDA. (Closed)
Patch Set: fixed avda unittest Created 3 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
« no previous file with comments | « media/base/android/BUILD.gn ('k') | media/base/android/android_overlay.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
6 #define MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
7
8 #include "base/android/scoped_java_ref.h"
9 #include "base/callback.h"
10 #include "base/macros.h"
11 #include "media/base/media_export.h"
12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gl/android/scoped_java_surface.h"
14
15 namespace media {
16
17 // Client interface to an AndroidOverlay. Once constructed, you can expect to
18 // receive either a call to ReadyCB or a call to FailedCB to indicate whether
19 // the overlay is ready, or isn't going to be ready. If one does get ReadyCB,
20 // then one may GetJavaSurface() to retrieve the java Surface object. One
21 // will get DestroyedCB eventually after ReadyCB, assuming that one doesn't
22 // delete the overlay before that.
23 // When DestroyedCB arrives, you should stop using the Android Surface and
24 // delete the AndroidOverlay instance. Currently, the exact contract depends
25 // on the concrete implementation. Once ContentVideoView is deprecated, it will
26 // be: it is not guaranteed that any AndroidOverlay instances will operate until
27 // the destroyed instance is deleted. This must happen on the thread that was
28 // used to create it. It does not have to happen immediately, or before the
29 // callback returns.
30 // With CVV, one must still delete the overlay on the main thread, and it
31 // doesn't have to happen before this returns. However, one must signal the
32 // CVV onSurfaceDestroyed handler on some thread before returning from the
33 // callback. AVDACodecAllocator::ReleaseMediaCodec handles signaling. The
34 // fundamental difference is that CVV blocks the UI thread in the browser, which
35 // makes it unsafe to let the gpu main thread proceed without risk of deadlock
36 // AndroidOverlay isn't technically supposed to do that.
37 class MEDIA_EXPORT AndroidOverlay {
38 public:
39 // Called when the overlay is ready for use, via |GetJavaSurface()|.
40 using ReadyCB = base::Callback<void()>;
41
42 // Called when overlay has failed before |ReadyCB| is called. Will not be
43 // called after ReadyCB. It will be the last callback for the overlay.
44 using FailedCB = base::Callback<void()>;
45
46 // Called when the overlay has been destroyed. This will not be called unless
47 // ReadyCB has been called. It will be the last callback for the overlay.
48 using DestroyedCB = base::Callback<void()>;
49
50 // Configuration used to create an overlay.
51 struct Config {
52 public:
53 Config();
54 Config(const Config&);
55 ~Config();
56
57 gfx::Rect rect;
58
59 ReadyCB ready_cb;
60 FailedCB failed_cb;
61 DestroyedCB destroyed_cb;
62 };
63
64 virtual ~AndroidOverlay() {}
65
66 // Schedules a relayout of this overlay. If called before the client is
67 // notified that the surface is created, then the call will be ignored.
68 virtual void ScheduleLayout(const gfx::Rect& rect) = 0;
69
70 // May be called during / after ReadyCB and before DestroyedCB.
71 virtual const base::android::JavaRef<jobject>& GetJavaSurface() const = 0;
72
73 protected:
74 AndroidOverlay() {}
75
76 DISALLOW_COPY_AND_ASSIGN(AndroidOverlay);
77 };
78
79 } // namespace media
80
81 #endif // MEDIA_BASE_ANDROID_ANDROID_OVERLAY_H_
OLDNEW
« no previous file with comments | « media/base/android/BUILD.gn ('k') | media/base/android/android_overlay.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698