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

Unified Diff: ppapi/examples/video_decode/video_decode.cc

Issue 703753002: Pepper: Expose visible_rect to PPB_VideoDecoder.GetPicture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/examples/video_decode/video_decode.cc
diff --git a/ppapi/examples/video_decode/video_decode.cc b/ppapi/examples/video_decode/video_decode.cc
index acd1869476447b982496c62b0b21f18ac77d367b..b68ca68dcdd0d0382ab26b28ef6c2bbf29923adb 100644
--- a/ppapi/examples/video_decode/video_decode.cc
+++ b/ppapi/examples/video_decode/video_decode.cc
@@ -54,12 +54,15 @@ class Decoder;
class MyInstance;
struct PendingPicture {
- PendingPicture(Decoder* decoder, const PP_VideoPicture& picture)
- : decoder(decoder), picture(picture) {}
+ PendingPicture(Decoder* decoder,
+ const PP_VideoPicture& picture,
+ const PP_Rect& visible_rect)
+ : decoder(decoder), picture(picture), visible_rect(visible_rect) {}
~PendingPicture() {}
Decoder* decoder;
PP_VideoPicture picture;
+ PP_Rect visible_rect;
};
class MyInstance : public pp::Instance, public pp::Graphics3DClient {
@@ -81,7 +84,9 @@ class MyInstance : public pp::Instance, public pp::Graphics3DClient {
assert(false && "Unexpectedly lost graphics context");
}
- void PaintPicture(Decoder* decoder, const PP_VideoPicture& picture);
+ void PaintPicture(Decoder* decoder,
+ const PP_VideoPicture& picture,
+ const PP_Rect& visible_rect);
private:
// Log an error to the developer console and stderr by creating a temporary
@@ -180,6 +185,7 @@ class Decoder {
pp::VideoDecoder* decoder_;
pp::CompletionCallbackFactory<Decoder> callback_factory_;
+ PP_Rect picture_visible_rect_;
size_t encoded_data_next_pos_to_decode_;
int next_picture_id_;
@@ -277,6 +283,7 @@ void Decoder::Start() {
// Register callback to get the first picture. We call GetPicture again in
// PictureReady to continuously receive pictures as they're decoded.
decoder_->GetPicture(
+ &picture_visible_rect_,
callback_factory_.NewCallbackWithOutput(&Decoder::PictureReady));
// Start the decode loop.
@@ -343,9 +350,11 @@ void Decoder::PictureReady(int32_t result, PP_VideoPicture picture) {
decode_time_[picture.decode_id % kMaxDecodeDelay];
total_latency_ += latency;
+ PP_Rect visible_rect = picture_visible_rect_;
decoder_->GetPicture(
+ &picture_visible_rect_,
callback_factory_.NewCallbackWithOutput(&Decoder::PictureReady));
- instance_->PaintPicture(this, picture);
+ instance_->PaintPicture(this, picture, visible_rect);
}
void Decoder::FlushDone(int32_t result) {
@@ -447,11 +456,12 @@ void MyInstance::InitializeDecoders() {
}
void MyInstance::PaintPicture(Decoder* decoder,
- const PP_VideoPicture& picture) {
+ const PP_VideoPicture& picture,
+ const PP_Rect& visible_rect) {
if (first_frame_delivered_ticks_ == -1)
assert((first_frame_delivered_ticks_ = core_if_->GetTimeTicks()) != -1);
- pending_pictures_.push(PendingPicture(decoder, picture));
+ pending_pictures_.push(PendingPicture(decoder, picture, visible_rect));
if (!is_painting_)
PaintNextPicture();
}

Powered by Google App Engine
This is Rietveld 408576698