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

Side by Side Diff: media/blink/webmediaplayer_impl.h

Issue 2643743002: Mojify demuxers and allow running {Chunk/FFmpeg}Demuxer in a Utility Process (Closed)
Patch Set: Rebase and make sure to unbind mojom::DemuxerPtr on the bound thread during termination Created 3 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
« no previous file with comments | « media/blink/BUILD.gn ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/cancelable_callback.h" 14 #include "base/cancelable_callback.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/memory_pressure_listener.h" 18 #include "base/memory/memory_pressure_listener.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "base/optional.h" 21 #include "base/optional.h"
22 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
23 #include "base/time/default_tick_clock.h" 23 #include "base/time/default_tick_clock.h"
24 #include "base/time/time.h" 24 #include "base/time/time.h"
25 #include "base/timer/elapsed_timer.h" 25 #include "base/timer/elapsed_timer.h"
26 #include "base/timer/timer.h" 26 #include "base/timer/timer.h"
27 #include "build/build_config.h" 27 #include "build/build_config.h"
28 #include "media/base/demuxer_factory.h"
28 #include "media/base/media_observer.h" 29 #include "media/base/media_observer.h"
29 #include "media/base/media_tracks.h" 30 #include "media/base/media_tracks.h"
30 #include "media/base/pipeline_impl.h" 31 #include "media/base/pipeline_impl.h"
31 #include "media/base/renderer_factory.h" 32 #include "media/base/renderer_factory.h"
32 #include "media/base/surface_manager.h" 33 #include "media/base/surface_manager.h"
33 #include "media/base/text_track.h" 34 #include "media/base/text_track.h"
34 #include "media/blink/buffered_data_source_host_impl.h" 35 #include "media/blink/buffered_data_source_host_impl.h"
35 #include "media/blink/media_blink_export.h" 36 #include "media/blink/media_blink_export.h"
36 #include "media/blink/multibuffer_data_source.h" 37 #include "media/blink/multibuffer_data_source.h"
37 #include "media/blink/video_frame_compositor.h" 38 #include "media/blink/video_frame_compositor.h"
(...skipping 27 matching lines...) Expand all
65 class WebLayerImpl; 66 class WebLayerImpl;
66 } 67 }
67 68
68 namespace gpu { 69 namespace gpu {
69 namespace gles2 { 70 namespace gles2 {
70 class GLES2Interface; 71 class GLES2Interface;
71 } 72 }
72 } 73 }
73 74
74 namespace media { 75 namespace media {
75 class ChunkDemuxer; 76 class SourceBuffer;
76 class ContentDecryptionModule; 77 class ContentDecryptionModule;
77 class MediaLog; 78 class MediaLog;
78 class UrlIndex; 79 class UrlIndex;
79 class VideoFrameCompositor; 80 class VideoFrameCompositor;
80 class WatchTimeReporter; 81 class WatchTimeReporter;
81 class WebAudioSourceProviderImpl; 82 class WebAudioSourceProviderImpl;
82 class WebMediaPlayerDelegate; 83 class WebMediaPlayerDelegate;
83 84
84 // The canonical implementation of blink::WebMediaPlayer that's backed by 85 // The canonical implementation of blink::WebMediaPlayer that's backed by
85 // Pipeline. Handles normal resource loading, Media Source, and 86 // Pipeline. Handles normal resource loading, Media Source, and
86 // Encrypted Media. 87 // Encrypted Media.
87 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl 88 class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
88 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), 89 : public NON_EXPORTED_BASE(blink::WebMediaPlayer),
89 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer), 90 public NON_EXPORTED_BASE(WebMediaPlayerDelegate::Observer),
90 public NON_EXPORTED_BASE(Pipeline::Client), 91 public NON_EXPORTED_BASE(Pipeline::Client),
91 public base::SupportsWeakPtr<WebMediaPlayerImpl> { 92 public base::SupportsWeakPtr<WebMediaPlayerImpl> {
92 public: 93 public:
93 // Constructs a WebMediaPlayer implementation using Chromium's media stack. 94 // Constructs a WebMediaPlayer implementation using Chromium's media stack.
94 // |delegate| and |renderer_factory| must not be null. 95 // |delegate| and |renderer_factory| must not be null.
95 WebMediaPlayerImpl( 96 WebMediaPlayerImpl(
96 blink::WebLocalFrame* frame, 97 blink::WebLocalFrame* frame,
97 blink::WebMediaPlayerClient* client, 98 blink::WebMediaPlayerClient* client,
98 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client, 99 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
99 WebMediaPlayerDelegate* delegate, 100 WebMediaPlayerDelegate* delegate,
101 std::unique_ptr<DemuxerFactory> demuxer_factory,
100 std::unique_ptr<RendererFactory> renderer_factory, 102 std::unique_ptr<RendererFactory> renderer_factory,
101 linked_ptr<UrlIndex> url_index, 103 linked_ptr<UrlIndex> url_index,
102 const WebMediaPlayerParams& params); 104 const WebMediaPlayerParams& params);
103 ~WebMediaPlayerImpl() override; 105 ~WebMediaPlayerImpl() override;
104 106
105 void load(LoadType load_type, 107 void load(LoadType load_type,
106 const blink::WebMediaPlayerSource& source, 108 const blink::WebMediaPlayerSource& source,
107 CORSMode cors_mode) override; 109 CORSMode cors_mode) override;
108 110
109 // Playback controls. 111 // Playback controls.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 void NotifyDownloading(bool is_downloading); 285 void NotifyDownloading(bool is_downloading);
284 286
285 // Called by SurfaceManager when a surface is created. 287 // Called by SurfaceManager when a surface is created.
286 void OnSurfaceCreated(int surface_id); 288 void OnSurfaceCreated(int surface_id);
287 289
288 // Called by GpuVideoDecoder on Android to request a surface to render to (if 290 // Called by GpuVideoDecoder on Android to request a surface to render to (if
289 // necessary). 291 // necessary).
290 void OnSurfaceRequested(bool decoder_requires_restart_for_overlay, 292 void OnSurfaceRequested(bool decoder_requires_restart_for_overlay,
291 const SurfaceCreatedCB& surface_created_cb); 293 const SurfaceCreatedCB& surface_created_cb);
292 294
295 std::unique_ptr<Demuxer> CreateDemuxer();
296
293 // Creates a Renderer via the |renderer_factory_|. 297 // Creates a Renderer via the |renderer_factory_|.
294 std::unique_ptr<Renderer> CreateRenderer(); 298 std::unique_ptr<Renderer> CreateRenderer();
295 299
296 // Finishes starting the pipeline due to a call to load(). 300 // Finishes starting the pipeline due to a call to load().
297 void StartPipeline(); 301 void StartPipeline();
298 302
299 // Helpers that set the network/ready state and notifies the client if 303 // Helpers that set the network/ready state and notifies the client if
300 // they've changed. 304 // they've changed.
301 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); 305 void SetNetworkState(blink::WebMediaPlayer::NetworkState state);
302 void SetReadyState(blink::WebMediaPlayer::ReadyState state); 306 void SetReadyState(blink::WebMediaPlayer::ReadyState state);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 bool supports_save_; 567 bool supports_save_;
564 568
565 // These two are mutually exclusive: 569 // These two are mutually exclusive:
566 // |data_source_| is used for regular resource loads. 570 // |data_source_| is used for regular resource loads.
567 // |chunk_demuxer_| is used for Media Source resource loads. 571 // |chunk_demuxer_| is used for Media Source resource loads.
568 // 572 //
569 // |demuxer_| will contain the appropriate demuxer based on which resource 573 // |demuxer_| will contain the appropriate demuxer based on which resource
570 // load strategy we're using. 574 // load strategy we're using.
571 std::unique_ptr<MultibufferDataSource> data_source_; 575 std::unique_ptr<MultibufferDataSource> data_source_;
572 std::unique_ptr<Demuxer> demuxer_; 576 std::unique_ptr<Demuxer> demuxer_;
573 ChunkDemuxer* chunk_demuxer_; 577 media::SourceBuffer* source_buffer_;
574 578
575 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; 579 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
576 580
577 BufferedDataSourceHostImpl buffered_data_source_host_; 581 BufferedDataSourceHostImpl buffered_data_source_host_;
578 linked_ptr<UrlIndex> url_index_; 582 linked_ptr<UrlIndex> url_index_;
579 583
580 // Video rendering members. 584 // Video rendering members.
581 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; 585 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_;
582 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|. 586 VideoFrameCompositor* compositor_; // Deleted on |compositor_task_runner_|.
583 SkCanvasVideoRenderer skcanvas_video_renderer_; 587 SkCanvasVideoRenderer skcanvas_video_renderer_;
(...skipping 16 matching lines...) Expand all
600 WebMediaPlayerCast cast_impl_; 604 WebMediaPlayerCast cast_impl_;
601 #endif 605 #endif
602 606
603 // The last volume received by setVolume() and the last volume multiplier from 607 // The last volume received by setVolume() and the last volume multiplier from
604 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less 608 // OnVolumeMultiplierUpdate(). The multiplier is typical 1.0, but may be less
605 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking) 609 // if the WebMediaPlayerDelegate has requested a volume reduction (ducking)
606 // for a transient sound. Playout volume is derived by volume * multiplier. 610 // for a transient sound. Playout volume is derived by volume * multiplier.
607 double volume_; 611 double volume_;
608 double volume_multiplier_; 612 double volume_multiplier_;
609 613
614 std::unique_ptr<DemuxerFactory> demuxer_factory_;
610 std::unique_ptr<RendererFactory> renderer_factory_; 615 std::unique_ptr<RendererFactory> renderer_factory_;
611 616
612 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen. 617 // For requesting surfaces on behalf of the Android H/W decoder in fullscreen.
613 // This will be null everywhere but Android. 618 // This will be null everywhere but Android.
614 SurfaceManager* surface_manager_; 619 SurfaceManager* surface_manager_;
615 620
616 // For canceling ongoing surface creation requests when exiting fullscreen. 621 // For canceling ongoing surface creation requests when exiting fullscreen.
617 base::CancelableCallback<void(int)> surface_created_cb_; 622 base::CancelableCallback<void(int)> surface_created_cb_;
618 623
619 // The current overlay surface id. Populated while in fullscreen once the 624 // The current overlay surface id. Populated while in fullscreen once the
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 699
695 // Pipeline media duration overridden by tests. 700 // Pipeline media duration overridden by tests.
696 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_; 701 base::Optional<base::TimeDelta> pipeline_media_duration_for_test_;
697 702
698 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); 703 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
699 }; 704 };
700 705
701 } // namespace media 706 } // namespace media
702 707
703 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_ 708 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_IMPL_H_
OLDNEW
« no previous file with comments | « media/blink/BUILD.gn ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698