History

avformat/mov: get the correct fragment stsd_id when decrypting the sample

When determining whether a packet should be decrypted, should use the stsd_id of the fragment where the current packet is located.

Wang Yaqiang committed 4 years ago

Commit 07447821 parent 3ade6a82 files · +5 −3Browse files

Showing the changes to libavformat (2 of 2 files). Show all

Unified · Split

2 files
  1. libavformat/isom.h +1 −0
  2. libavformat/mov.c +4 −3
libavformat/isom.h+1−0
@@ -139,6 +139,7 @@ typedef struct MOVFragmentStreamInfo { · 138 unmodified lines
139139 int index_base;
140140 int index_entry;
141141 MOVEncryptionIndex *encryption_index;
142+ int stsd_id; // current fragment stsd_id
142143 } MOVFragmentStreamInfo;
143144
144145 typedef struct MOVFragmentIndexItem {
libavformat/mov.c+4−3
@@ -4958,9 +4958,10 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 4957 unmodified lines
49584958 av_log(c->fc, AV_LOG_TRACE, "frag flags 0x%x\n", frag->flags);
49594959
49604960 frag_stream_info = get_current_frag_stream_info(&c->frag_index);
4961− if (frag_stream_info)
4961+ if (frag_stream_info) {
49624962 frag_stream_info->next_trun_dts = AV_NOPTS_VALUE;
4963−
4963+ frag_stream_info->stsd_id = frag->stsd_id;
4964+ }
49644965 return 0;
49654966 }
49664967
@@ -7225,7 +7226,7 @@ static int cenc_filter(MOVContext *mov, AVStream* st, MOVStreamContext *sc, AVPa · 2258 unmodified lines
72257226 encryption_index = NULL;
72267227 if (frag_stream_info) {
72277228 // Note this only supports encryption info in the first sample descriptor.
7228− if (mov->fragment.stsd_id == 1) {
7229+ if (frag_stream_info->stsd_id == 1) {
72297230 if (frag_stream_info->encryption_index) {
72307231 encrypted_index = current_index - frag_stream_info->index_base;
72317232 encryption_index = frag_stream_info->encryption_index;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t