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

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

Issue 1128383003: Implementation of MediaCodecPlayer stage 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed some comments Created 5 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2015 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_MEDIA_CODEC_VIDEO_DECODER_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_
7
8 #include <set>
9 #include "media/base/android/media_codec_decoder.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gl/android/scoped_java_surface.h"
12
13 namespace media {
14
15 // Video decoder for MediaCodecPlayer
16 class MediaCodecVideoDecoder : public MediaCodecDecoder {
17 public:
18 // Typedefs for the notification callbacks
19 typedef base::Callback<
20 void (base::TimeDelta duration, const gfx::Size& video_size)>
21 MetadataChangedCallback;
22
23 MediaCodecVideoDecoder(
24 const scoped_refptr<base::SingleThreadTaskRunner>& media_runner,
25 const scoped_refptr<base::SingleThreadTaskRunner>& ui_runner,
26 const base::Closure& request_data_cb,
27 const base::Closure& starvation_cb,
28 const base::Closure& stop_done_cb,
29 const base::Closure& error_cb,
30 const MetadataChangedCallback& metadata_changed_cb,
31 const base::Closure& request_resources_cb);
32 ~MediaCodecVideoDecoder() override;
33
34 const char * class_name() const override { return "VideoDecoder"; }
35
36 bool HasStream() const override;
37 void SetDemuxerConfigs(const DemuxerConfigs& configs) override;
38 void ReleaseDecoderResources() override;
39
40 // Stores the video surface to use with upcoming Configure()
41 void SetPendingSurface(gfx::ScopedJavaSurface surface);
42
43 // Returns true if there is a video surface to use.
44 bool HasPendingSurface() const;
45
46 protected:
47 bool IsCodecReconfigureNeeded(const DemuxerConfigs& curr,
48 const DemuxerConfigs& next) const override;
49 ConfigStatus ConfigureInternal() override;
50 void SynchronizePTSWithTime(base::TimeDelta current_time) override;
51 void OnOutputFormatChanged() override;
52 void Render(int buffer_index, size_t size, bool render_output,
53 base::TimeDelta pts, bool eos_encountered) override;
54
55 int NumDelayedRenderTasks() const override;
56 void ReleaseDelayedBuffers() override;
57
58 private:
59 // A helper method that releases output buffers and does
60 // post-release checks. Might be called by Render() or posted
61 // for later execution.
62 void ReleaseOutputBuffer(int buffer_index, bool render,
63 bool eos_encountered);
64
65 // Data.
66
67 // Configuration received from demuxer
68 DemuxerConfigs configs_;
69
70 // Video surface that we render to.
71 gfx::ScopedJavaSurface surface_;
72
73 // Inform the called that video size has changed.
74 MetadataChangedCallback metadata_changed_cb_;
75
76 // Inform the caller that the MediaCodec is created.
77 base::Closure request_resources_cb_;
78
79 // Current video size to be reported to player
80 gfx::Size video_size_;
81
82 // Indexes ouf output buffers that are posted for rendering.
83 std::set<int> delayed_buffers_;
84
85 // Associate presentation timestamps with time
86 base::TimeTicks start_time_ticks_;
87 base::TimeDelta start_pts_;
88
89 // Mantain last seen PTS for stand-alone EOS
90 base::TimeDelta last_seen_pts_;
91
92 DISALLOW_COPY_AND_ASSIGN(MediaCodecVideoDecoder);
93 };
94
95 } // namespace media
96
97 #endif // MEDIA_BASE_ANDROID_MEDIA_CODEC_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698