Chromium Code Reviews| OLD | NEW |
|---|---|
| (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_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ | |
| 6 #define MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ | |
| 7 | |
| 8 #include "base/bind.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/memory/weak_ptr.h" | |
| 11 #include "media/base/android/android_overlay.h" | |
| 12 #include "media/base/android/android_overlay_factory.h" | |
| 13 #include "media/gpu/android_video_surface_chooser.h" | |
| 14 #include "media/gpu/media_gpu_export.h" | |
| 15 | |
| 16 namespace media { | |
| 17 | |
| 18 // Implementation of AndroidVideoSurfaceChooser. | |
| 19 class MEDIA_GPU_EXPORT AndroidVideoSurfaceChooserImpl | |
| 20 : public AndroidVideoSurfaceChooser { | |
| 21 public: | |
| 22 AndroidVideoSurfaceChooserImpl(); | |
| 23 ~AndroidVideoSurfaceChooserImpl() override; | |
| 24 | |
| 25 // AndroidVideoSurfaceChooser | |
| 26 void Initialize( | |
| 27 UseOverlayCB use_overlay_cb, | |
| 28 UseSurfaceTextureCB use_surface_texture_cb, | |
| 29 StopUsingOverlayImmediatelyCB stop_immediately_cb, | |
| 30 std::unique_ptr<AndroidOverlayFactory> initial_factory) override; | |
| 31 void ReplaceOverlayFactory( | |
| 32 std::unique_ptr<AndroidOverlayFactory> factory) override; | |
| 33 | |
| 34 private: | |
| 35 // AndroidOverlay callbacks. | |
| 36 void OnOverlayReady(AndroidOverlay*); | |
| 37 void OnOverlayFailed(AndroidOverlay*); | |
| 38 void OnSurfaceDestroyed(AndroidOverlay*); | |
| 39 | |
| 40 // Client callbacks. | |
| 41 UseOverlayCB use_overlay_cb_; | |
| 42 UseSurfaceTextureCB use_surface_texture_cb_; | |
| 43 StopUsingOverlayImmediatelyCB stop_immediately_cb_; | |
| 44 | |
| 45 // Current overlay that we've consructed but haven't received ready / failed | |
|
watk
2017/05/02 21:00:01
"constructed"
liberato (no reviews please)
2017/05/02 21:50:05
Done.
| |
| 46 // callbacks yet. Will be nullptr if we haven't constructed one, or if we | |
| 47 // sent it to the client already once it became ready to use. | |
| 48 std::unique_ptr<AndroidOverlay> overlay_; | |
| 49 | |
| 50 // If true, we owe the client notification about whether to use an overlay | |
| 51 // or a surface texture. | |
| 52 bool client_notification_pending_ = false; | |
| 53 | |
| 54 std::unique_ptr<AndroidOverlayFactory> overlay_factory_; | |
| 55 | |
| 56 base::WeakPtrFactory<AndroidVideoSurfaceChooserImpl> weak_factory_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(AndroidVideoSurfaceChooserImpl); | |
| 59 }; | |
| 60 | |
| 61 } // namespace media | |
| 62 | |
| 63 #endif // MEDIA_GPU_ANDROID_VIDEO_SURFACE_CHOOSER_IMPL_H_ | |
| OLD | NEW |