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

Unified Diff: native_client_sdk/src/examples/api/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: native_client_sdk/src/examples/api/video_decode/video_decode.cc
diff --git a/native_client_sdk/src/examples/api/video_decode/video_decode.cc b/native_client_sdk/src/examples/api/video_decode/video_decode.cc
index 9664c9b6407ddb85969923a90fe9c5d87d6440e1..607f30a0edeb1f8164a3ae7c4059a2665ecfe3de 100644
--- a/native_client_sdk/src/examples/api/video_decode/video_decode.cc
+++ b/native_client_sdk/src/examples/api/video_decode/video_decode.cc
@@ -53,12 +53,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 {
@@ -80,7 +83,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
@@ -179,6 +184,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_;
@@ -276,6 +282,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.
@@ -342,9 +349,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) {
@@ -446,11 +455,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