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

Side by Side Diff: media/gpu/vp9_decoder.cc

Issue 2926593002: V4L2SVDA/VAAPIVDA: use visible size from decoder and pass to client (Closed)
Patch Set: V4L2SVDA/VAAPIVDA: use visible size from decoder and pass to client Created 3 years, 6 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #include "media/gpu/vp9_decoder.h" 5 #include "media/gpu/vp9_decoder.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 curr_frame_hdr_.reset(); 107 curr_frame_hdr_.reset();
108 continue; 108 continue;
109 } 109 }
110 110
111 gfx::Size new_pic_size(curr_frame_hdr_->frame_width, 111 gfx::Size new_pic_size(curr_frame_hdr_->frame_width,
112 curr_frame_hdr_->frame_height); 112 curr_frame_hdr_->frame_height);
113 DCHECK(!new_pic_size.IsEmpty()); 113 DCHECK(!new_pic_size.IsEmpty());
114 114
115 gfx::Rect new_render_rect(curr_frame_hdr_->render_width,
116 curr_frame_hdr_->render_height);
117 // Due to specification render size should be set as not larger than frame
118 // size, or set as frame size if render_and_frame_size_different == 0. For
119 // safety we check the validity of render size or leave it as (0, 0).
120 if (!gfx::Rect(new_pic_size).Contains(new_render_rect))
121 new_render_rect = gfx::Rect();
122 DVLOG(1) << "Render resolution: " << new_render_rect.ToString();
123
115 if (new_pic_size != pic_size_) { 124 if (new_pic_size != pic_size_) {
116 DVLOG(1) << "New resolution: " << new_pic_size.ToString(); 125 DVLOG(1) << "New resolution: " << new_pic_size.ToString();
117 126
118 if (!curr_frame_hdr_->IsKeyframe()) { 127 if (!curr_frame_hdr_->IsKeyframe()) {
119 // TODO(posciak): This is doable, but requires a few modifications to 128 // TODO(posciak): This is doable, but requires a few modifications to
120 // VDA implementations to allow multiple picture buffer sets in flight. 129 // VDA implementations to allow multiple picture buffer sets in flight.
121 DVLOG(1) << "Resolution change currently supported for keyframes only"; 130 DVLOG(1) << "Resolution change currently supported for keyframes only";
122 SetError(); 131 SetError();
123 return kDecodeError; 132 return kDecodeError;
124 } 133 }
125 134
126 // TODO(posciak): This requires us to be on a keyframe (see above) and is 135 // TODO(posciak): This requires us to be on a keyframe (see above) and is
127 // required, because VDA clients expect all surfaces to be returned before 136 // required, because VDA clients expect all surfaces to be returned before
128 // they can cycle surface sets after receiving kAllocateNewSurfaces. 137 // they can cycle surface sets after receiving kAllocateNewSurfaces.
129 // This is only an implementation detail of VDAs and can be improved. 138 // This is only an implementation detail of VDAs and can be improved.
130 for (auto& ref_frame : ref_frames_) 139 for (auto& ref_frame : ref_frames_)
131 ref_frame = nullptr; 140 ref_frame = nullptr;
132 141
133 pic_size_ = new_pic_size; 142 pic_size_ = new_pic_size;
134 return kAllocateNewSurfaces; 143 return kAllocateNewSurfaces;
135 } 144 }
136 145
137 scoped_refptr<VP9Picture> pic = accelerator_->CreateVP9Picture(); 146 scoped_refptr<VP9Picture> pic = accelerator_->CreateVP9Picture();
138 if (!pic) 147 if (!pic)
139 return kRanOutOfSurfaces; 148 return kRanOutOfSurfaces;
140 149
150 pic->visible_rect = new_render_rect;
141 pic->frame_hdr.reset(curr_frame_hdr_.release()); 151 pic->frame_hdr.reset(curr_frame_hdr_.release());
142 152
143 if (!DecodeAndOutputPicture(pic)) { 153 if (!DecodeAndOutputPicture(pic)) {
144 SetError(); 154 SetError();
145 return kDecodeError; 155 return kDecodeError;
146 } 156 }
147 } 157 }
148 } 158 }
149 159
150 void VP9Decoder::RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic) { 160 void VP9Decoder::RefreshReferenceFrames(const scoped_refptr<VP9Picture>& pic) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return pic_size_; 214 return pic_size_;
205 } 215 }
206 216
207 size_t VP9Decoder::GetRequiredNumOfPictures() const { 217 size_t VP9Decoder::GetRequiredNumOfPictures() const {
208 // kMaxVideoFrames to keep higher level media pipeline populated, +2 for the 218 // kMaxVideoFrames to keep higher level media pipeline populated, +2 for the
209 // pictures being parsed and decoded currently. 219 // pictures being parsed and decoded currently.
210 return limits::kMaxVideoFrames + kVp9NumRefFrames + 2; 220 return limits::kMaxVideoFrames + kVp9NumRefFrames + 2;
211 } 221 }
212 222
213 } // namespace media 223 } // namespace media
OLDNEW
« media/gpu/vp8_decoder.cc ('K') | « media/gpu/vp8_picture.h ('k') | media/gpu/vp9_picture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698