OLD | NEW |
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/v4l2_slice_video_decode_accelerator.h" | 5 #include "media/gpu/v4l2_slice_video_decode_accelerator.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <linux/videodev2.h> | 9 #include <linux/videodev2.h> |
10 #include <poll.h> | 10 #include <poll.h> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 // Mark the surface as decoded. This will also release all references, as | 83 // Mark the surface as decoded. This will also release all references, as |
84 // they are not needed anymore and execute the done callback, if not null. | 84 // they are not needed anymore and execute the done callback, if not null. |
85 void SetDecoded(); | 85 void SetDecoded(); |
86 bool decoded() const { return decoded_; } | 86 bool decoded() const { return decoded_; } |
87 | 87 |
88 int32_t bitstream_id() const { return bitstream_id_; } | 88 int32_t bitstream_id() const { return bitstream_id_; } |
89 int input_record() const { return input_record_; } | 89 int input_record() const { return input_record_; } |
90 int output_record() const { return output_record_; } | 90 int output_record() const { return output_record_; } |
91 uint32_t config_store() const { return config_store_; } | 91 uint32_t config_store() const { return config_store_; } |
| 92 gfx::Rect visible_rect() const { return visible_rect_; } |
| 93 |
| 94 void SetVisibleRect(const gfx::Rect& visible_rect) { |
| 95 visible_rect_ = visible_rect; |
| 96 } |
92 | 97 |
93 // Take references to each reference surface and keep them until the | 98 // Take references to each reference surface and keep them until the |
94 // target surface is decoded. | 99 // target surface is decoded. |
95 void SetReferenceSurfaces( | 100 void SetReferenceSurfaces( |
96 const std::vector<scoped_refptr<V4L2DecodeSurface>>& ref_surfaces); | 101 const std::vector<scoped_refptr<V4L2DecodeSurface>>& ref_surfaces); |
97 | 102 |
98 // If provided via this method, |done_cb| callback will be executed after | 103 // If provided via this method, |done_cb| callback will be executed after |
99 // decoding into this surface is finished. The callback is reset afterwards, | 104 // decoding into this surface is finished. The callback is reset afterwards, |
100 // so it needs to be set again before each decode operation. | 105 // so it needs to be set again before each decode operation. |
101 void SetDecodeDoneCallback(const base::Closure& done_cb) { | 106 void SetDecodeDoneCallback(const base::Closure& done_cb) { |
102 DCHECK(done_cb_.is_null()); | 107 DCHECK(done_cb_.is_null()); |
103 done_cb_ = done_cb; | 108 done_cb_ = done_cb; |
104 } | 109 } |
105 | 110 |
106 std::string ToString() const; | 111 std::string ToString() const; |
107 | 112 |
108 private: | 113 private: |
109 friend class base::RefCounted<V4L2DecodeSurface>; | 114 friend class base::RefCounted<V4L2DecodeSurface>; |
110 ~V4L2DecodeSurface(); | 115 ~V4L2DecodeSurface(); |
111 | 116 |
112 int32_t bitstream_id_; | 117 int32_t bitstream_id_; |
113 int input_record_; | 118 int input_record_; |
114 int output_record_; | 119 int output_record_; |
115 uint32_t config_store_; | 120 uint32_t config_store_; |
| 121 gfx::Rect visible_rect_; |
116 | 122 |
117 bool decoded_; | 123 bool decoded_; |
118 ReleaseCB release_cb_; | 124 ReleaseCB release_cb_; |
119 base::Closure done_cb_; | 125 base::Closure done_cb_; |
120 | 126 |
121 std::vector<scoped_refptr<V4L2DecodeSurface>> reference_surfaces_; | 127 std::vector<scoped_refptr<V4L2DecodeSurface>> reference_surfaces_; |
122 | 128 |
123 DISALLOW_COPY_AND_ASSIGN(V4L2DecodeSurface); | 129 DISALLOW_COPY_AND_ASSIGN(V4L2DecodeSurface); |
124 }; | 130 }; |
125 | 131 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 281 |
276 bool SubmitSlice(const H264PPS* pps, | 282 bool SubmitSlice(const H264PPS* pps, |
277 const H264SliceHeader* slice_hdr, | 283 const H264SliceHeader* slice_hdr, |
278 const H264Picture::Vector& ref_pic_list0, | 284 const H264Picture::Vector& ref_pic_list0, |
279 const H264Picture::Vector& ref_pic_list1, | 285 const H264Picture::Vector& ref_pic_list1, |
280 const scoped_refptr<H264Picture>& pic, | 286 const scoped_refptr<H264Picture>& pic, |
281 const uint8_t* data, | 287 const uint8_t* data, |
282 size_t size) override; | 288 size_t size) override; |
283 | 289 |
284 bool SubmitDecode(const scoped_refptr<H264Picture>& pic) override; | 290 bool SubmitDecode(const scoped_refptr<H264Picture>& pic) override; |
285 bool OutputPicture(const scoped_refptr<H264Picture>& pic) override; | 291 bool OutputPicture(const scoped_refptr<H264Picture>& pic, |
| 292 const gfx::Rect& visible_rect) override; |
286 | 293 |
287 void Reset() override; | 294 void Reset() override; |
288 | 295 |
289 private: | 296 private: |
290 // Max size of reference list. | 297 // Max size of reference list. |
291 static const size_t kDPBIndicesListSize = 32; | 298 static const size_t kDPBIndicesListSize = 32; |
292 void H264PictureListToDPBIndicesList(const H264Picture::Vector& src_pic_list, | 299 void H264PictureListToDPBIndicesList(const H264Picture::Vector& src_pic_list, |
293 uint8_t dst_list[kDPBIndicesListSize]); | 300 uint8_t dst_list[kDPBIndicesListSize]); |
294 | 301 |
295 void H264DPBToV4L2DPB( | 302 void H264DPBToV4L2DPB( |
(...skipping 22 matching lines...) Expand all Loading... |
318 | 325 |
319 // VP8Decoder::VP8Accelerator implementation. | 326 // VP8Decoder::VP8Accelerator implementation. |
320 scoped_refptr<VP8Picture> CreateVP8Picture() override; | 327 scoped_refptr<VP8Picture> CreateVP8Picture() override; |
321 | 328 |
322 bool SubmitDecode(const scoped_refptr<VP8Picture>& pic, | 329 bool SubmitDecode(const scoped_refptr<VP8Picture>& pic, |
323 const Vp8FrameHeader* frame_hdr, | 330 const Vp8FrameHeader* frame_hdr, |
324 const scoped_refptr<VP8Picture>& last_frame, | 331 const scoped_refptr<VP8Picture>& last_frame, |
325 const scoped_refptr<VP8Picture>& golden_frame, | 332 const scoped_refptr<VP8Picture>& golden_frame, |
326 const scoped_refptr<VP8Picture>& alt_frame) override; | 333 const scoped_refptr<VP8Picture>& alt_frame) override; |
327 | 334 |
328 bool OutputPicture(const scoped_refptr<VP8Picture>& pic) override; | 335 bool OutputPicture(const scoped_refptr<VP8Picture>& pic, |
| 336 const gfx::Rect& visible_rect) override; |
329 | 337 |
330 private: | 338 private: |
331 scoped_refptr<V4L2DecodeSurface> VP8PictureToV4L2DecodeSurface( | 339 scoped_refptr<V4L2DecodeSurface> VP8PictureToV4L2DecodeSurface( |
332 const scoped_refptr<VP8Picture>& pic); | 340 const scoped_refptr<VP8Picture>& pic); |
333 | 341 |
334 V4L2SliceVideoDecodeAccelerator* v4l2_dec_; | 342 V4L2SliceVideoDecodeAccelerator* v4l2_dec_; |
335 | 343 |
336 DISALLOW_COPY_AND_ASSIGN(V4L2VP8Accelerator); | 344 DISALLOW_COPY_AND_ASSIGN(V4L2VP8Accelerator); |
337 }; | 345 }; |
338 | 346 |
339 class V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator | 347 class V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator |
340 : public VP9Decoder::VP9Accelerator { | 348 : public VP9Decoder::VP9Accelerator { |
341 public: | 349 public: |
342 explicit V4L2VP9Accelerator(V4L2SliceVideoDecodeAccelerator* v4l2_dec); | 350 explicit V4L2VP9Accelerator(V4L2SliceVideoDecodeAccelerator* v4l2_dec); |
343 ~V4L2VP9Accelerator() override; | 351 ~V4L2VP9Accelerator() override; |
344 | 352 |
345 // VP9Decoder::VP9Accelerator implementation. | 353 // VP9Decoder::VP9Accelerator implementation. |
346 scoped_refptr<VP9Picture> CreateVP9Picture() override; | 354 scoped_refptr<VP9Picture> CreateVP9Picture() override; |
347 | 355 |
348 bool SubmitDecode(const scoped_refptr<VP9Picture>& pic, | 356 bool SubmitDecode(const scoped_refptr<VP9Picture>& pic, |
349 const Vp9SegmentationParams& segm_params, | 357 const Vp9SegmentationParams& segm_params, |
350 const Vp9LoopFilterParams& lf_params, | 358 const Vp9LoopFilterParams& lf_params, |
351 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures, | 359 const std::vector<scoped_refptr<VP9Picture>>& ref_pictures, |
352 const base::Closure& done_cb) override; | 360 const base::Closure& done_cb) override; |
353 | 361 |
354 bool OutputPicture(const scoped_refptr<VP9Picture>& pic) override; | 362 bool OutputPicture(const scoped_refptr<VP9Picture>& pic, |
| 363 const gfx::Rect& visible_rect) override; |
355 | 364 |
356 bool GetFrameContext(const scoped_refptr<VP9Picture>& pic, | 365 bool GetFrameContext(const scoped_refptr<VP9Picture>& pic, |
357 Vp9FrameContext* frame_ctx) override; | 366 Vp9FrameContext* frame_ctx) override; |
358 | 367 |
359 bool IsFrameContextRequired() const override { | 368 bool IsFrameContextRequired() const override { |
360 return device_needs_frame_context_; | 369 return device_needs_frame_context_; |
361 } | 370 } |
362 | 371 |
363 private: | 372 private: |
364 scoped_refptr<V4L2DecodeSurface> VP9PictureToV4L2DecodeSurface( | 373 scoped_refptr<V4L2DecodeSurface> VP9PictureToV4L2DecodeSurface( |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 } | 802 } |
794 | 803 |
795 bool V4L2SliceVideoDecodeAccelerator::CreateOutputBuffers() { | 804 bool V4L2SliceVideoDecodeAccelerator::CreateOutputBuffers() { |
796 DVLOGF(3); | 805 DVLOGF(3); |
797 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); | 806 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
798 DCHECK(!output_streamon_); | 807 DCHECK(!output_streamon_); |
799 DCHECK(output_buffer_map_.empty()); | 808 DCHECK(output_buffer_map_.empty()); |
800 DCHECK(surfaces_at_display_.empty()); | 809 DCHECK(surfaces_at_display_.empty()); |
801 DCHECK(surfaces_at_device_.empty()); | 810 DCHECK(surfaces_at_device_.empty()); |
802 | 811 |
803 visible_size_ = decoder_->GetPicSize(); | 812 gfx::Size pic_size = decoder_->GetPicSize(); |
804 size_t num_pictures = decoder_->GetRequiredNumOfPictures(); | 813 size_t num_pictures = decoder_->GetRequiredNumOfPictures(); |
805 | 814 |
806 DCHECK_GT(num_pictures, 0u); | 815 DCHECK_GT(num_pictures, 0u); |
807 DCHECK(!visible_size_.IsEmpty()); | 816 DCHECK(!pic_size.IsEmpty()); |
808 | 817 |
809 struct v4l2_format format; | 818 struct v4l2_format format; |
810 memset(&format, 0, sizeof(format)); | 819 memset(&format, 0, sizeof(format)); |
811 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; | 820 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; |
812 format.fmt.pix_mp.pixelformat = output_format_fourcc_; | 821 format.fmt.pix_mp.pixelformat = output_format_fourcc_; |
813 format.fmt.pix_mp.width = visible_size_.width(); | 822 format.fmt.pix_mp.width = pic_size.width(); |
814 format.fmt.pix_mp.height = visible_size_.height(); | 823 format.fmt.pix_mp.height = pic_size.height(); |
815 format.fmt.pix_mp.num_planes = input_planes_count_; | 824 format.fmt.pix_mp.num_planes = input_planes_count_; |
816 | 825 |
817 if (device_->Ioctl(VIDIOC_S_FMT, &format) != 0) { | 826 if (device_->Ioctl(VIDIOC_S_FMT, &format) != 0) { |
818 PLOGF(ERROR) << "Failed setting format to: " << output_format_fourcc_; | 827 PLOGF(ERROR) << "Failed setting format to: " << output_format_fourcc_; |
819 NOTIFY_ERROR(PLATFORM_FAILURE); | 828 NOTIFY_ERROR(PLATFORM_FAILURE); |
820 return false; | 829 return false; |
821 } | 830 } |
822 | 831 |
823 coded_size_.SetSize(base::checked_cast<int>(format.fmt.pix_mp.width), | 832 coded_size_.SetSize(base::checked_cast<int>(format.fmt.pix_mp.width), |
824 base::checked_cast<int>(format.fmt.pix_mp.height)); | 833 base::checked_cast<int>(format.fmt.pix_mp.height)); |
825 DCHECK_EQ(coded_size_.width() % 16, 0); | 834 DCHECK_EQ(coded_size_.width() % 16, 0); |
826 DCHECK_EQ(coded_size_.height() % 16, 0); | 835 DCHECK_EQ(coded_size_.height() % 16, 0); |
827 | 836 |
828 if (!gfx::Rect(coded_size_).Contains(gfx::Rect(visible_size_))) { | 837 if (!gfx::Rect(coded_size_).Contains(gfx::Rect(pic_size))) { |
829 LOGF(ERROR) << "Got invalid adjusted coded size: " | 838 LOGF(ERROR) << "Got invalid adjusted coded size: " |
830 << coded_size_.ToString(); | 839 << coded_size_.ToString(); |
831 return false; | 840 return false; |
832 } | 841 } |
833 | 842 |
834 DVLOGF(3) << "buffer_count=" << num_pictures | 843 DVLOGF(3) << "buffer_count=" << num_pictures |
835 << ", visible size=" << visible_size_.ToString() | 844 << ", pic size=" << pic_size.ToString() |
836 << ", coded size=" << coded_size_.ToString(); | 845 << ", coded size=" << coded_size_.ToString(); |
837 | 846 |
838 // With ALLOCATE mode the client can sample it as RGB and doesn't need to | 847 // With ALLOCATE mode the client can sample it as RGB and doesn't need to |
839 // know the precise format. | 848 // know the precise format. |
840 VideoPixelFormat pixel_format = | 849 VideoPixelFormat pixel_format = |
841 (output_mode_ == Config::OutputMode::IMPORT) | 850 (output_mode_ == Config::OutputMode::IMPORT) |
842 ? V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_) | 851 ? V4L2Device::V4L2PixFmtToVideoPixelFormat(output_format_fourcc_) |
843 : PIXEL_FORMAT_UNKNOWN; | 852 : PIXEL_FORMAT_UNKNOWN; |
844 | 853 |
845 child_task_runner_->PostTask( | 854 child_task_runner_->PostTask( |
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 if (!v4l2_dec_->SubmitExtControls(&ext_ctrls)) | 2528 if (!v4l2_dec_->SubmitExtControls(&ext_ctrls)) |
2520 return false; | 2529 return false; |
2521 | 2530 |
2522 Reset(); | 2531 Reset(); |
2523 | 2532 |
2524 v4l2_dec_->DecodeSurface(dec_surface); | 2533 v4l2_dec_->DecodeSurface(dec_surface); |
2525 return true; | 2534 return true; |
2526 } | 2535 } |
2527 | 2536 |
2528 bool V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::OutputPicture( | 2537 bool V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::OutputPicture( |
2529 const scoped_refptr<H264Picture>& pic) { | 2538 const scoped_refptr<H264Picture>& pic, |
| 2539 const gfx::Rect& visible_rect) { |
2530 scoped_refptr<V4L2DecodeSurface> dec_surface = | 2540 scoped_refptr<V4L2DecodeSurface> dec_surface = |
2531 H264PictureToV4L2DecodeSurface(pic); | 2541 H264PictureToV4L2DecodeSurface(pic); |
| 2542 dec_surface->SetVisibleRect(visible_rect); |
2532 v4l2_dec_->SurfaceReady(dec_surface); | 2543 v4l2_dec_->SurfaceReady(dec_surface); |
2533 return true; | 2544 return true; |
2534 } | 2545 } |
2535 | 2546 |
2536 void V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::Reset() { | 2547 void V4L2SliceVideoDecodeAccelerator::V4L2H264Accelerator::Reset() { |
2537 num_slices_ = 0; | 2548 num_slices_ = 0; |
2538 memset(&v4l2_decode_param_, 0, sizeof(v4l2_decode_param_)); | 2549 memset(&v4l2_decode_param_, 0, sizeof(v4l2_decode_param_)); |
2539 memset(&v4l2_slice_params_, 0, sizeof(v4l2_slice_params_)); | 2550 memset(&v4l2_slice_params_, 0, sizeof(v4l2_slice_params_)); |
2540 } | 2551 } |
2541 | 2552 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2750 | 2761 |
2751 if (!v4l2_dec_->SubmitSlice(dec_surface->input_record(), frame_hdr->data, | 2762 if (!v4l2_dec_->SubmitSlice(dec_surface->input_record(), frame_hdr->data, |
2752 frame_hdr->frame_size)) | 2763 frame_hdr->frame_size)) |
2753 return false; | 2764 return false; |
2754 | 2765 |
2755 v4l2_dec_->DecodeSurface(dec_surface); | 2766 v4l2_dec_->DecodeSurface(dec_surface); |
2756 return true; | 2767 return true; |
2757 } | 2768 } |
2758 | 2769 |
2759 bool V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator::OutputPicture( | 2770 bool V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator::OutputPicture( |
2760 const scoped_refptr<VP8Picture>& pic) { | 2771 const scoped_refptr<VP8Picture>& pic, |
| 2772 const gfx::Rect& visible_rect) { |
2761 scoped_refptr<V4L2DecodeSurface> dec_surface = | 2773 scoped_refptr<V4L2DecodeSurface> dec_surface = |
2762 VP8PictureToV4L2DecodeSurface(pic); | 2774 VP8PictureToV4L2DecodeSurface(pic); |
2763 | 2775 dec_surface->SetVisibleRect(visible_rect); |
2764 v4l2_dec_->SurfaceReady(dec_surface); | 2776 v4l2_dec_->SurfaceReady(dec_surface); |
2765 return true; | 2777 return true; |
2766 } | 2778 } |
2767 | 2779 |
2768 scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> | 2780 scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> |
2769 V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator:: | 2781 V4L2SliceVideoDecodeAccelerator::V4L2VP8Accelerator:: |
2770 VP8PictureToV4L2DecodeSurface(const scoped_refptr<VP8Picture>& pic) { | 2782 VP8PictureToV4L2DecodeSurface(const scoped_refptr<VP8Picture>& pic) { |
2771 V4L2VP8Picture* v4l2_pic = pic->AsV4L2VP8Picture(); | 2783 V4L2VP8Picture* v4l2_pic = pic->AsV4L2VP8Picture(); |
2772 CHECK(v4l2_pic); | 2784 CHECK(v4l2_pic); |
2773 return v4l2_pic->dec_surface(); | 2785 return v4l2_pic->dec_surface(); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3053 | 3065 |
3054 if (!v4l2_dec_->SubmitSlice(dec_surface->input_record(), frame_hdr->data, | 3066 if (!v4l2_dec_->SubmitSlice(dec_surface->input_record(), frame_hdr->data, |
3055 frame_hdr->frame_size)) | 3067 frame_hdr->frame_size)) |
3056 return false; | 3068 return false; |
3057 | 3069 |
3058 v4l2_dec_->DecodeSurface(dec_surface); | 3070 v4l2_dec_->DecodeSurface(dec_surface); |
3059 return true; | 3071 return true; |
3060 } | 3072 } |
3061 | 3073 |
3062 bool V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator::OutputPicture( | 3074 bool V4L2SliceVideoDecodeAccelerator::V4L2VP9Accelerator::OutputPicture( |
3063 const scoped_refptr<VP9Picture>& pic) { | 3075 const scoped_refptr<VP9Picture>& pic, |
| 3076 const gfx::Rect& visible_rect) { |
3064 scoped_refptr<V4L2DecodeSurface> dec_surface = | 3077 scoped_refptr<V4L2DecodeSurface> dec_surface = |
3065 VP9PictureToV4L2DecodeSurface(pic); | 3078 VP9PictureToV4L2DecodeSurface(pic); |
3066 | 3079 dec_surface->SetVisibleRect(visible_rect); |
3067 v4l2_dec_->SurfaceReady(dec_surface); | 3080 v4l2_dec_->SurfaceReady(dec_surface); |
3068 return true; | 3081 return true; |
3069 } | 3082 } |
3070 | 3083 |
3071 static void FillVp9FrameContext(struct v4l2_vp9_entropy_ctx& v4l2_entropy_ctx, | 3084 static void FillVp9FrameContext(struct v4l2_vp9_entropy_ctx& v4l2_entropy_ctx, |
3072 Vp9FrameContext* vp9_frame_ctx) { | 3085 Vp9FrameContext* vp9_frame_ctx) { |
3073 #define ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(a) \ | 3086 #define ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(a) \ |
3074 ARRAY_MEMCPY_CHECKED(vp9_frame_ctx->a, v4l2_entropy_ctx.a) | 3087 ARRAY_MEMCPY_CHECKED(vp9_frame_ctx->a, v4l2_entropy_ctx.a) |
3075 ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(tx_probs_8x8); | 3088 ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(tx_probs_8x8); |
3076 ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(tx_probs_16x16); | 3089 ARRAY_MEMCPY_CHECKED_V4L2_ENTR_TO_FRM_CTX(tx_probs_16x16); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3180 surfaces_at_display_ | 3193 surfaces_at_display_ |
3181 .insert(std::make_pair(output_record.picture_id, dec_surface)) | 3194 .insert(std::make_pair(output_record.picture_id, dec_surface)) |
3182 .second; | 3195 .second; |
3183 DCHECK(inserted); | 3196 DCHECK(inserted); |
3184 | 3197 |
3185 DCHECK(!output_record.at_client); | 3198 DCHECK(!output_record.at_client); |
3186 DCHECK(!output_record.at_device); | 3199 DCHECK(!output_record.at_device); |
3187 DCHECK_NE(output_record.picture_id, -1); | 3200 DCHECK_NE(output_record.picture_id, -1); |
3188 output_record.at_client = true; | 3201 output_record.at_client = true; |
3189 | 3202 |
3190 // TODO(posciak): Use visible size from decoder here instead | |
3191 // (crbug.com/402760). Passing (0, 0) results in the client using the | |
3192 // visible size extracted from the container instead. | |
3193 // TODO(hubbe): Insert correct color space. http://crbug.com/647725 | 3203 // TODO(hubbe): Insert correct color space. http://crbug.com/647725 |
3194 Picture picture(output_record.picture_id, dec_surface->bitstream_id(), | 3204 Picture picture(output_record.picture_id, dec_surface->bitstream_id(), |
3195 gfx::Rect(0, 0), gfx::ColorSpace(), false); | 3205 dec_surface->visible_rect(), gfx::ColorSpace(), false); |
3196 DVLOGF(3) << dec_surface->ToString() | 3206 DVLOGF(3) << dec_surface->ToString() |
3197 << ", bitstream_id: " << picture.bitstream_buffer_id() | 3207 << ", bitstream_id: " << picture.bitstream_buffer_id() |
3198 << ", picture_id: " << picture.picture_buffer_id(); | 3208 << ", picture_id: " << picture.picture_buffer_id() |
| 3209 << ", visible_rect: " << picture.visible_rect().ToString(); |
3199 pending_picture_ready_.push(PictureRecord(output_record.cleared, picture)); | 3210 pending_picture_ready_.push(PictureRecord(output_record.cleared, picture)); |
3200 SendPictureReady(); | 3211 SendPictureReady(); |
3201 output_record.cleared = true; | 3212 output_record.cleared = true; |
3202 } | 3213 } |
3203 | 3214 |
3204 scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> | 3215 scoped_refptr<V4L2SliceVideoDecodeAccelerator::V4L2DecodeSurface> |
3205 V4L2SliceVideoDecodeAccelerator::CreateSurface() { | 3216 V4L2SliceVideoDecodeAccelerator::CreateSurface() { |
3206 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); | 3217 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
3207 DCHECK_EQ(state_, kDecoding); | 3218 DCHECK_EQ(state_, kDecoding); |
3208 | 3219 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3295 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { | 3306 V4L2SliceVideoDecodeAccelerator::GetSupportedProfiles() { |
3296 scoped_refptr<V4L2Device> device = V4L2Device::Create(); | 3307 scoped_refptr<V4L2Device> device = V4L2Device::Create(); |
3297 if (!device) | 3308 if (!device) |
3298 return SupportedProfiles(); | 3309 return SupportedProfiles(); |
3299 | 3310 |
3300 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), | 3311 return device->GetSupportedDecodeProfiles(arraysize(supported_input_fourccs_), |
3301 supported_input_fourccs_); | 3312 supported_input_fourccs_); |
3302 } | 3313 } |
3303 | 3314 |
3304 } // namespace media | 3315 } // namespace media |
OLD | NEW |