blob: ff2f4c00e3aa29fda6da20e9976ac001f7537b19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/*
* This file defines classes for doing reference picture selection, primarily
* with VP8.
*/
/* Modified by Yoann Blein, 2012 (remove time handling for simplicity)
*/
#pragma once
#include <stdint.h>
namespace Swift {
class ReferencePictureSelection {
public:
ReferencePictureSelection();
// Report a received reference picture selection indication. This will
// introduce a new established reference if the received RPSI isn't too late.
void ReceivedRPSI(int rpsi_picture_id);
// Report a received slice loss indication. Returns true if a refresh frame
// must be sent to the receiver, which is accomplished by only predicting
// from the established reference.
// |now_ts| is the RTP timestamp corresponding to the current time. Typically
// the capture timestamp of the frame currently being processed.
// Returns true if it's time to encode a decoder refresh, otherwise false.
void ReceivedSLI();
// Returns the recommended VP8 encode flags needed. May refresh the decoder
// and/or update the reference buffers.
// |picture_id| picture id of the frame to be encoded.
// |send_refresh| should be set to true if a decoder refresh should be
// encoded, otherwise false.
// |now_ts| is the RTP timestamp corresponding to the current time. Typically
// the capture timestamp of the frame currently being processed.
// Returns the flags to be given to the libvpx encoder when encoding the next
// frame.
int EncodeFlags(int picture_id);
// Notify the RPS that the frame with picture id |picture_id| was encoded as
// a key frame, effectively updating all reference buffers.
void refFrameSent(int picture_id);
private:
bool update_golden_next_;
bool established_golden_;
bool received_ack_;
int last_sent_ref_picture_id_;
int established_ref_picture_id_;
bool send_refresh;
};
}
|