@@ -3358,7 +3358,7 @@ impl Client {
3358
3358
. lock ( )
3359
3359
. expect ( "Get e2ee context to encrypt media" ) ;
3360
3360
3361
- let unencrypted_header_len = Self :: unencrypted_media_header_len ( is_audio, false ) ;
3361
+ let unencrypted_header_len = Self :: unencrypted_media_header_len ( is_audio, !is_audio ) ;
3362
3362
Self :: encrypt (
3363
3363
& mut frame_crypto_context,
3364
3364
unencrypted_header_len,
@@ -5393,15 +5393,12 @@ mod tests {
5393
5393
let plaintext = & b"Fake Video Needs To Be Bigger" [ ..] ;
5394
5394
let ciphertext1 = client1. encrypt_media ( is_audio, plaintext) . unwrap ( ) ;
5395
5395
5396
- // Check that the first 10 bytes of video is left unencrypted
5397
- // and the rest has changed
5398
- assert_eq ! ( plaintext[ ..10 ] , ciphertext1[ ..10 ] ) ;
5399
5396
assert_ne ! ( plaintext, & ciphertext1[ ..plaintext. len( ) ] ) ;
5400
5397
5401
5398
assert_eq ! (
5402
5399
plaintext,
5403
5400
client2
5404
- . decrypt_media( client1. demux_id, is_audio, & ciphertext1, false )
5401
+ . decrypt_media( client1. demux_id, is_audio, & ciphertext1, true )
5405
5402
. unwrap( )
5406
5403
) ;
5407
5404
@@ -5604,7 +5601,7 @@ mod tests {
5604
5601
assert_eq ! (
5605
5602
plaintext,
5606
5603
client2
5607
- . decrypt_media( client1. demux_id, is_audio, & ciphertext, false )
5604
+ . decrypt_media( client1. demux_id, is_audio, & ciphertext, true )
5608
5605
. unwrap( )
5609
5606
) ;
5610
5607
}
0 commit comments